Location: problem with bad original URL, identified in bug report #1029478

This commit is contained in:
Daniel Stenberg
2004-09-16 21:28:38 +00:00
parent 2544c78083
commit 25bf23105d
4 changed files with 86 additions and 2 deletions

View File

@@ -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