cURL Mailing List Monthly Index Single Mail
curl-users Archives
Why doesn't curl use a GET after a 302 response?
I am trying to understand why my curl request isn't respecting the
behaviour documented for the -L option on the curl man page.
In particular:
'When curl follows a redirect and the request is not a plain
GET (for example POST or PUT), it will do the following request with a
GET if the HTTP response was 301, 302, or 303. If the response code
was any other 3xx code, curl will re-send the following request using
the same unmodified method.'
However, when I try curl issues the next request with a POST instead
of the expected GET.
Here is the command line I use:
cat /tmp/task | curl -d @- -D header -L -X POST
http://10.0.1.168:8100/rest/v1/tasks
here is the intermediate response:
cat header
HTTP/1.1 303 See Other
Access-Control-Allow-Credentials: false
Access-Control-Allow-Headers: Origin,Accept,Content-Type,Authorization
Access-Control-Allow-Origin: *
Location: http://10.0.1.168:8100/rest/v1/tasks/f2205de7b0c4f73df562067b0337b183
Date: Mon, 02 Feb 2015 13:29:11 GMT
Content-Length: 0
Content-Type: text/plain; charset=utf-8
Here are the version strings from two versions of perl I tried (Linux and OSX)
curl 7.35.0 (arm-unknown-linux-gnueabihf) libcurl/7.35.0
OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps
pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL
libz TLS-SRP
curl 7.30.0 (x86_64-apple-darwin13.0) libcurl/7.30.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps
pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-02-02
These mail archives are generated by hypermail.
|