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-1807732 ] POSTing instead of GETing when following 303

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Thu, 04 Oct 2007 13:54:11 -0700

Bugs item #1807732, was opened at 2007-10-04 14:56
Message generated for change (Comment added) made by clofresh
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1807732&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: client module
Group: bad behaviour
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Carlo Cabanilla (clofresh)
Assigned to: Daniel Stenberg (bagder)
Summary: POSTing instead of GETing when following 303

Initial Comment:
When POSTing to a URL with the -L flag and receiving a 303 status with the Location header set, curl 7.17.0 is sending a POST to the Location header's URL when it should be sending a GET, as per rfc2616:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4

curl debugging output:

$ curl -X POST http://<domain>:2001/test_result/blah_suite -v -L
* About to connect() to <domain> port 2001 (#0)
* Trying <ip address>... connected
* Connected to <domain> (<ip address>) port 2001 (#0)
> POST /test_result/blah_suite HTTP/1.1
> User-Agent: curl/7.17.0 (i686-pc-linux-gnu) libcurl/7.17.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: <domain>:2001
> Accept: */*
>
< HTTP/1.1 303 See Other
< Date: Thu, 04 Oct 2007 19:00:51 GMT
< Server: Apache/2.2.4 (Unix)
< Content-Length: 65
< Location: http://<domain>:2001/test_result/blah_suite/2007-10-04-1900
< Content-Type: text/plain
<
* Ignoring the response-body
* Connection #0 to host <domain> left intact
* Issue another request to this URL: 'http://<domain>:2001/test_result/blah_suite/2007-10-04-1900'
* Re-using existing connection! (#0) with host <domain>
* Connected to <domain> (<ip address>) port 2001 (#0)
> POST /test_result/blah_suite/2007-10-04-1900 HTTP/1.1
> User-Agent: curl/7.17.0 (i686-pc-linux-gnu) libcurl/7.17.0 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: <domain>:2001
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Date: Thu, 04 Oct 2007 19:00:51 GMT
< Server: Apache/2.2.4 (Unix)
< Content-Length: 36
< Connection: close
< Content-Type: text/plain
<
* Rewinding stream by : 1 bytes on url /test_result/blah_suite/2007-10-04-1900 (size = 36, maxdownload = 36, bytecount = 0, nread = 37)
* Closing connection #0

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

>Comment By: Carlo Cabanilla (clofresh)
Date: 2007-10-04 15:54

Message:
Logged In: YES
user_id=1344368
Originator: YES

Ah, I see what you're saying. I need to do a POST with an empty message
body though. That's why I use -X.

And also, what if I wanted to do a PUT or a DELETE? curl wouldn't be able
to follow the 303 correctly.

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

Comment By: Daniel Stenberg (bagder)
Date: 2007-10-04 15:09

Message:
Logged In: YES
user_id=1110
Originator: NO

Right, but curl doesn't know you do a POST when you fiddle with -X. If you
want curl to do a POST and know it and act accordingly you use -d or -F.

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1807732&group_id=976
Received on 2007-10-04

These mail archives are generated by hypermail.

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

File upload with ASP.NET