From 25bf23105d0ae927a9b62a1d4f4f30312481955f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 16 Sep 2004 21:28:38 +0000 Subject: Location: problem with bad original URL, identified in bug report #1029478 --- lib/transfer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3