cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: BUG: automatic redirects with "http://somesite.com?data"

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 18 Dec 2003 10:18:25 +0100 (CET)

On Wed, 17 Dec 2003, John McGowan wrote:

> Got a bug. It involves the handling of "http://somesite.com?data" instead of
> "http://somesite.com/?data" during automatic redirects.

Thanks for your detailed and accurate bug report!

I believe the following patch corrects this problem for you:

diff -u -r1.189 transfer.c
--- transfer.c 10 Dec 2003 15:27:27 -0000 1.189
+++ transfer.c 18 Dec 2003 09:16:52 -0000
@@ -1666,6 +1666,15 @@
       pathsep = strchr(protsep, '/');
       if(pathsep)
         *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
+ use a slash separator as it is supposed to, we need to check for a
+ ?-letter as well! */
+ pathsep = strchr(protsep, '?');
+ if(pathsep)
+ *pathsep=0;
+ }
     }

     /* If the new part contains a space, this is a mighty stupid redirect

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-18