cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1204435 ] Extra slash appended to data in http://somehost?data (7.14)

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 19 May 2005 00:06:19 -0700

Bugs item #1204435, was opened at 2005-05-18 19:09
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1204435&group_id=976

Category: http
Group: bad behaviour
Status: Open
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: Extra slash appended to data in http://somehost?data (7.14)

Initial Comment:
Extra slash appended to data in http://somehost?data (curl 7.14.0)

curl 7.14.0 (i686-pc-linux-gnu) libcurl/7.14.0 OpenSSL/0.9.7a zlib/1.2.1.1

curl http://somehost/?data

does a

  GET /?data
  Host: somehost

(That looks about right ...)

but

curl http://somehost?data

does a:

  GET /?data/
  Host: somehost

(i.e. if the "/" is missing, curl puts it in, twice,
      marking the end of the host and an extra one,
      for good measure, as the last character in the data)

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

>Comment By: Daniel Stenberg (bagder)
Date: 2005-05-19 09:06

Message:
Logged In: YES
user_id=1110

Ok, so try this additional patch. To be applied as well as
the previous one. Thanks for your quick feedback!

diff -u -r1.462 url.c
--- url.c 18 May 2005 20:01:01 -0000 1.462
+++ url.c 19 May 2005 07:04:47 -0000
@@ -2466,6 +2466,10 @@
 
     *tmp=0; /* now cut off the hostname at the ? */
   }
+ else if(!conn->path[0]) {
+ /* if there's no path set, use a single slash */
+ strcpy(conn->path, "/");
+ }
 
   /* If the URL is malformatted (missing a '/' after
hostname before path) we * insert a slash here. The only
letter except '/' we accept to start a path

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

Comment By: Daniel Stenberg (bagder)
Date: 2005-05-19 08:49

Message:
Logged In: YES
user_id=1110

Ouch, I see it. I'll work on a better fix.

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

Comment By: Nobody/Anonymous (nobody)
Date: 2005-05-19 00:47

Message:
Logged In: NO

Unfortunately the patch removes the slash when it should be added.

curl http://host

now sends:

 GET HTTP/1.1
 Host: host

instead of

 GET / HTTP/1.1
 Host: host

(nothing to GET in the first)

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

Comment By: Daniel Stenberg (bagder)
Date: 2005-05-18 21:50

Message:
Logged In: YES
user_id=1110

Thanks! The following little patch seems to fix it for me.
I'll commit a somewhat bigger with more comments added and a
test case added.

--- url.c 14 May 2005 06:00:40 -0000 1.461
+++ url.c 18 May 2005 19:47:50 -0000
@@ -2383,7 +2383,7 @@
   }
   else {
     /* Set default path */
- strcpy(conn->path, "/");
+ conn->path[0] = 0;
 
     if (2 > sscanf(data->change.url,
                    "%15[^\n:]://%[^\n/]%[^\n]",

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1204435&group_id=976
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-tracker
Received on 2005-05-19

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET