Skip to content

Commit

Permalink
- Fixed bug #50832 (HTTP fopen wrapper does not support passwordless …
Browse files Browse the repository at this point in the history
…HTTP authentication)
  • Loading branch information
Jani Taskinen committed Jan 25, 2010
1 parent 5eb4db5 commit 5952473
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ PHP NEWS
- Fixed possible crash when a error/warning is raised during php startup.
(Pierre)

- Fixed bug #50832 (HTTP fopen wrapper does not support passwordless HTTP
authentication). (Jani)
- Fixed bug #50787 (stream_set_write_buffer() has no effect on socket streams).
(vnegrier at optilian dot com, Ilia)
- Fixed bug #50761 (system.multiCall crashes in xmlrpc extension).
Expand Down
12 changes: 8 additions & 4 deletions ext/standard/http_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,19 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
}

/* auth header if it was specified */
if (((have_header & HTTP_HEADER_AUTH) == 0) && resource->user && resource->pass) {
if (((have_header & HTTP_HEADER_AUTH) == 0) && resource->user) {
/* decode the strings first */
php_url_decode(resource->user, strlen(resource->user));
php_url_decode(resource->pass, strlen(resource->pass));

/* scratch is large enough, since it was made large enough for the whole URL */
strcpy(scratch, resource->user);
strcat(scratch, ":");
strcat(scratch, resource->pass);

/* Note: password is optional! */
if (resource->pass) {
php_url_decode(resource->pass, strlen(resource->pass));
strcat(scratch, resource->pass);
}

tmp = (char*)php_base64_encode((unsigned char*)scratch, strlen(scratch), NULL);

Expand Down Expand Up @@ -746,7 +750,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
s++; \
} \
} \
} \
}
/* check for control characters in login, password & path */
if (strncasecmp(new_path, "http://", sizeof("http://") - 1) || strncasecmp(new_path, "https://", sizeof("https://") - 1)) {
CHECK_FOR_CNTRL_CHARS(resource->user)
Expand Down

0 comments on commit 5952473

Please sign in to comment.