diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2003-01-03 17:05:16 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2003-01-03 17:05:16 +0000 |
commit | c52cdad25a7ac680fba05fa68b552a15e484f88e (patch) | |
tree | 6e876e084df1a4e7a162a80737d5a1048de6456d /ext/standard | |
parent | 2e52c112dfa154463ec0c622c357dbb2275f042a (diff) | |
download | php-git-c52cdad25a7ac680fba05fa68b552a15e484f88e.tar.gz |
Further fixes related to bug #21267.
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/http_fopen_wrapper.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index f13bf5f69a..c3f10fd3e9 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -346,7 +346,11 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch if (*location != '/') { if (*(location+1) != '\0') { php_dirname(resource->path, strlen(resource->path)); - snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", resource->path, location); + if (resource->path && *(resource->path) == '/' && *(resource->path + 1) == '\0') { + snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", resource->path, location); + } else { + snprintf(loc_path, sizeof(loc_path) - 1, "%s/%s", resource->path, location); + } } else { snprintf(loc_path, sizeof(loc_path) - 1, "/%s", location); } @@ -358,8 +362,7 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch } else { snprintf(new_path, sizeof(new_path) - 1, "%s://%s%s", resource->scheme, resource->host, loc_path); } - } - else { + } else { strlcpy(new_path, location, sizeof(new_path)); } stream = php_stream_url_wrap_http(NULL, new_path, mode, options, opened_path, context STREAMS_CC TSRMLS_CC); |