aboutsummaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-09-16 21:28:38 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-09-16 21:28:38 +0000
commit25bf23105d0ae927a9b62a1d4f4f30312481955f (patch)
treebc3d49d64a9a849dd625e3cbc21fb733d27d2b88 /lib/transfer.c
parent2544c7808309b1cd998688c3b845d9cc1269a327 (diff)
Location: problem with bad original URL, identified in bug report #1029478
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 2a3d0b10f..7f7211048 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1801,8 +1801,15 @@ CURLcode Curl_follow(struct SessionHandle *data,
/* We got a new absolute path for this server, cut off from the
first slash */
pathsep = strchr(protsep, '/');
- if(pathsep)
+ if(pathsep) {
+ /* When people use badly formatted URLs, such as
+ "http://www.url.com?dir=/home/daniel" we must not use the first
+ slash, if there's a ?-letter before it! */
+ char *sep = strchr(protsep, '?');
+ if(sep && (sep < pathsep))
+ pathsep = sep;
*pathsep=0;
+ }
else {
/* There was no slash. Now, since we might be operating on a badly
formatted URL, such as "http://www.url.com?id=2380" which doesn't