]> granicus.if.org Git - php/commitdiff
MFH
authorIlia Alshanetsky <iliaa@php.net>
Wed, 19 Feb 2003 00:49:38 +0000 (00:49 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 19 Feb 2003 00:49:38 +0000 (00:49 +0000)
ext/standard/http_fopen_wrapper.c

index 096819c0583e2778817c1d308a849187da9cf2a2..6b701656ba5e3e6c83fb0b4120d34a73dda088e0 100644 (file)
@@ -352,8 +352,13 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch
                        *new_path='\0';
                        if (strlen(location)<8 || (strncasecmp(location, "http://", sizeof("http://")-1) && strncasecmp(location, "https://", sizeof("https://")-1))) {
                                if (*location != '/') {
-                                       if (*(location+1) != '\0') {                            
-                                               php_dirname(resource->path, strlen(resource->path));
+                                       if (*(location+1) != '\0' && resource->path) {          
+                                               char *s = strrchr(resource->path, '/');
+                                               if (!s) {
+                                                       s = resource->path;
+                                                       *s = '/';
+                                               }
+                                               s[1] = '\0'; 
                                                if (resource->path && *(resource->path) == '/' && *(resource->path + 1) == '\0') {
                                                        snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", resource->path, location);
                                                } else {