Reputation: 9498
Im using the curl command line tool. I do something like
curl -XPUT "https://example.org?p1=value1&p2=value2" -H"Content-Type:application/x-www-form-urlencoded"
The server replies with
HTTP/1.1 411 Length Required
The solution is usually to set the appropriate Content-Length
header.
But what is the Content-Length in this case and how to set it with curl?
Upvotes: 7
Views: 19890
Reputation: 9498
By default curl
sets appropriate Content-Length
header for you when data is provided with -d
parameter. In your case the server seems to wait for some data in the body. But for some reason you decided to pass the data in the url.
1. Simple Solution
Add -d""
to the command. This will cause curl to set the appropriate length to 0. You could also set the appropriate header to -H"Content-Length:0"
2. Why transport data as query parameters?
Try instead:
curl -XPUT -d'p1=value1\np2=value2' https://example.org
Upvotes: 11