summaryrefslogtreecommitdiff
path: root/ext/soap/php_http.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2007-05-28 23:43:24 +0000
committerIlia Alshanetsky <iliaa@php.net>2007-05-28 23:43:24 +0000
commitcbcb1840f32f4b3eff6c2165ecc6f4fac8746a4b (patch)
tree2e91d5ce8fb85831987bb50b54aa584c62704cad /ext/soap/php_http.c
parent3821f0c45acc490e6b5d80494f74798049e9cd15 (diff)
downloadphp-git-cbcb1840f32f4b3eff6c2165ecc6f4fac8746a4b.tar.gz
MFB
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r--ext/soap/php_http.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 68ed03bd39..4c355696b6 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -916,19 +916,20 @@ try_again:
efree(http_body);
efree(loc);
if (new_url->scheme == NULL && new_url->path != NULL) {
- new_url->scheme = estrdup(phpurl->scheme);
- new_url->host = estrdup(phpurl->host);
+ new_url->scheme = NULL;
+ new_url->host = phpurl->host ? estrdup(phpurl->host) : NULL;
new_url->port = phpurl->port;
if (new_url->path && new_url->path[0] != '/') {
- char *t = phpurl->path?phpurl->path:"/";
+ char *t = phpurl->path;
char *p = strrchr(t, '/');
- char *s = emalloc((p - t) + strlen(new_url->path) + 2);
-
- strncpy(s, t, (p - t) + 1);
- s[(p - t) + 1] = 0;
- strcat(s, new_url->path);
- efree(new_url->path);
- new_url->path = s;
+ if (p) {
+ char *s = emalloc((p - t) + strlen(new_url->path) + 2);
+ strncpy(s, t, (p - t) + 1);
+ s[(p - t) + 1] = 0;
+ strcat(s, new_url->path);
+ efree(new_url->path);
+ new_url->path = s;
+ }
}
}
phpurl = new_url;