Osipov, Michael (GS IT PD LD PLM)
2018-07-25 13:23:04 UTC
Hi folks,
Im trying to use a REST service which returns with HTTP/1.1 201 along
with the Location of the new resource after a POST request.
Unfortunately, I cannnot write out (-w, redirect_url) the value, so does
https://github.com/curl/curl/blob/5ae22272d1506e5c0e431f4ad60f1dc446f76715/lib/http.c#L3821-L3825.
Curl always assumes the Location header is for redirects (3xx) only and
not for 2xx operations.
Is there a reason to still have this resriction these days? Do you need
another switch to explicit opt out from this?
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Im trying to use a REST service which returns with HTTP/1.1 201 along
with the Location of the new resource after a POST request.
Unfortunately, I cannnot write out (-w, redirect_url) the value, so does
$ curl --verbose -X POST --upload-file file.zip https://.../rest/documents --negotiate -u : -H "Content-Type: application/zip"
* Trying ......
* TCP_NODELAY set
* Connected to ... (...) port 8448 (#0)
* ALPN, offering http/1.1
...
* SSL certificate verify ok.
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 201
< Date: Wed, 25 Jul 2018 13:00:25 GMT
< X-Frame-Options: SAMEORIGIN
< Location: https://.../rest/documents/6667f88a-5783-11e8-857e-001f29e7988e
< Content-Length: 0
<
* Closing connection 0
The reason is* Trying ......
* TCP_NODELAY set
* Connected to ... (...) port 8448 (#0)
* ALPN, offering http/1.1
...
* SSL certificate verify ok.
POST .../rest/documents HTTP/1.1
Host: ...
User-Agent: curl/7.60.0
Accept: */*
Content-Type: application/zip
Content-Length: 918
Expect: 100-continue
...Host: ...
User-Agent: curl/7.60.0
Accept: */*
Content-Type: application/zip
Content-Length: 918
Expect: 100-continue
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 201
< Date: Wed, 25 Jul 2018 13:00:25 GMT
< X-Frame-Options: SAMEORIGIN
< Location: https://.../rest/documents/6667f88a-5783-11e8-857e-001f29e7988e
< Content-Length: 0
<
* Closing connection 0
https://github.com/curl/curl/blob/5ae22272d1506e5c0e431f4ad60f1dc446f76715/lib/http.c#L3821-L3825.
Curl always assumes the Location header is for redirects (3xx) only and
not for 2xx operations.
Is there a reason to still have this resriction these days? Do you need
another switch to explicit opt out from this?
curl 7.60.0 (i386-portbld-freebsd10.4) libcurl/7.60.0 OpenSSL/1.0.2o zlib/1.2.11
Release-Date: 2018-05-16
Protocols: file http https imap imaps pop3 pop3s rtsp smtp smtps
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets HTTPS-proxy
MichaelRelease-Date: 2018-05-16
Protocols: file http https imap imaps pop3 pop3s rtsp smtp smtps
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets HTTPS-proxy
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html