curl-library
Re: bug in redirection
Date: Fri, 12 Oct 2001 05:20:40 -0400
Iam using 7.9
>1. I get this page:
>" http://dellapp.us.dell.com/landingstrip/ls.asp?DGC=DC
<http://dellapp.us.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite=M
SN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25m>
&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?D
GVCode=DC&mc=%25m"
right
>2. It redirects my to a different page:
>Location:
>http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m>
&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?D
GVCode=DC&mc=%25m
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m>
right
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m>
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m>
>3. We get that page, and get another redirect:
>Location:
>LS.asp?DGC=DC&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A/
/dell4me.com?DGVCode=DC&mc=%25m&Visits=1
>(this looks like the one that gave you problems.)
right
>4. We follow that and get the above URL as well, which returns a BAD
>redirect:
>Location: http://LS.asp?DGC=DC <http://LS.asp?DGC=DC>
<http://LS.asp?DGC=DC>
This is the problem.Actually this <http://LS.asp?DGC=DC> is not a
redirect.The Curl Parser searches for the protocol string in step 3
LS.asp?DGC=DC&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//
dell4me.com?DGVCode=DC&mc=%25m&Visits=1
Since the search is basically an strstr for // it returns the position
of http%3A//dell4me.com(since the url is relative) as part of the
payload and it mistakenly assumes it to be the url and starts trying
with that.
Regards
Bharath
<http://LS.asp?DGC=DC>
<http://LS.asp?DGC=DC>
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m>
Daniel Stenberg wrote:
On Thu, 11 Oct 2001, T. Bharath wrote:
> I happened to find a bug in redirection when a relative url is in the
> Location header
[cut out, check original post for details]
> The parser when trying to connect to this,searches if this has a
protocol
> field and mistakenly takes the url in the payload http%3A//dell4me.com
> From there it doesnot work right
Hm. Are you really using 7.9 here? This looks like a problem we already
fixed.
I tried the same URL, and while I got a problem too, it was not the way
you
describe it! (And when I tried a 7.8, I noticed your described problem.)
In my tests, this happens:
1. I get this page:
" http://dellapp.us.dell.com/landingstrip/ls.asp?DGC=DC
<http://dellapp.us.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite=M
SN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25m>
&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?D
GVCode=DC&mc=%25m"
2. It redirects my to a different page:
Location:
http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m>
&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?D
GVCode=DC&mc=%25m
3. We get that page, and get another redirect:
Location:
LS.asp?DGC=DC&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//
dell4me.com?DGVCode=DC&mc=%25m&Visits=1
(this looks like the one that gave you problems.)
4. We follow that and get the above URL as well, which returns a BAD
redirect:
Location: http://LS.asp?DGC=DC <http://LS.asp?DGC=DC>
This can easily be repeated on demand, if you try to get this page:
http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//LS.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m&Visits=1>
&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//LS.asp?DGC=DC
&DGU=%25m&DGSite=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//d
If
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//LS.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m&Visits=1> we try to get that redirect, we end up on:
*
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//LS.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m&Visits=1> gethostbyname_r(2) failed for LS.asp?DGC=DC
That
<http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//LS.asp?DGC=DC&DGU=%25m&DGSite
=MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25
m&Visits=1> sure looks like a bad server application.
-- <http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite =MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//LS.asp?DGC=DC&DGU=%25m&DGSite =MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25 m&Visits=1> <http://landingstrip.dell.com/landingstrip/ls.asp?DGC=DC&DGU=%25m&DGSite =MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//LS.asp?DGC=DC&DGU=%25m&DGSite =MSN&DGStor=DHS&RURL=Dell4Me&DURL=http%3A//dell4me.com?DGVCode=DC&mc=%25 m&Visits=1> Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/ <http://curl.haxx.se/>Received on 2001-10-12