]> granicus.if.org Git - php/commitdiff
Further fixes related to bug #21267.
authorIlia Alshanetsky <iliaa@php.net>
Fri, 3 Jan 2003 17:05:16 +0000 (17:05 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 3 Jan 2003 17:05:16 +0000 (17:05 +0000)
ext/standard/http_fopen_wrapper.c

index f13bf5f69a805cb81ec556058736cf284e9da1c4..c3f10fd3e980c1b86dbffec2ba5ed803945a8440 100644 (file)
@@ -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);