cURL / Mailing Lists / curl-users / Single Mail

curl-users

Trailing slash bug

From: Jesse Barnum <jsb_curl_at_360works.com>
Date: Thu, 7 Dec 2006 22:48:38 -0500

curl is incorrectly appending a trailing slash to URL requests:

~ $ curl -v "http://localhost:7244?a=1&b=2&c=3"
* About to connect() to localhost port 7244
* Trying ::1... * connected
* Connected to localhost (::1) port 7244
> GET /?a=1&b=2&c=3/ HTTP/1.1
User-Agent: curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1
OpenSSL/0.9.7i zlib/1.2.3
Host: localhost:7244
Pragma: no-cache
Accept: */*

Notice the '/' after c=3. This is causing the web server to think
that the parameter is '3/', when the intent is for it to be '3'. It
is fine to put a trailing slash at the end of a URL, but it is
incorrect to include one in the query section of the URL.

Note that if I put a trailing slash before the query string, it works
correctly. You could chalk this up to 'user error', but I don't think
that user error should cause curl to send an invalid request.

~ $ curl -v "http://localhost:7244?a=1&b=2&c=3"
* About to connect() to localhost port 7244
* Trying ::1... * connected
* Connected to localhost (::1) port 7244
> GET /?a=1&b=2&c=3/ HTTP/1.1
User-Agent: curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1
OpenSSL/0.9.7i zlib/1.2.3
Host: localhost:7244
Pragma: no-cache
Accept: */*

--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293
Received on 2006-12-08