cURL / Mailing Lists / curl-library / Single Mail

curl-library

[ curl-Bugs-1029478 ] redirect. Unterminated host, slash in data. Wrong redirect

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 16 Sep 2004 13:38:56 -0700

Bugs item #1029478, was opened at 2004-09-16 13:38
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1029478&group_id=976

Category: http
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: redirect. Unterminated host, slash in data. Wrong redirect

Initial Comment:
While curl can recognize a hostname which is not terminated
by a slash in "http://somesite.com?id=[data]", if curl is
set to follow redirects *and* the [data] itself contains
a slash ("/") the redirection may fail (the slash in the
data may be interpreted as the root, instead of
http://somesite.com/)

(Version: curl 7.12.2-CVS from 10 Sept 2004)

Got spam:

 URL: http://somesite.com?id=hBWhIiMmPDy9Y[data1]/[data2]
      (the data contains a "slash")

This returned a redirection:

 Location: /index_load.asp?zip_code=[data]

I had set curl to follow redirections.

Curl did *not* then send a get request to:

  http://somesite.com/index_load.asp?zip_code=[data]

instead, it misinterpreted the:

  somesite.com?id=hBWhIiMmPDy9Y[data1]/
  (which did not have a terminating slash on the hostname but
   DID have a slash the data) as the root.
  * Issue another request to this URL: 'http://somesite.com?id=hBWhIiMm[data1]/index_load.asp?zip_code=[data]

  setting the "root" to http://somesite.com?id=hBWhIiMm[data1]/
  (instead of http://somesite.com/)

  It did recognize the hostname,
   Host: somesite.com
   GET /?id=hBWhIiMmPDy9Y[data1]/index_load.asp?zip_code=[data]
  but used the wrong directory.

Changing the original URL to
  http://somesite.com/?id=hBWhIiMmPDy9Y[data1]/[data2]
(terminating the hostname) fixed the problem, of course.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1029478&group_id=976
Received on 2004-09-16