curl-library
"content-type:application/x-www-form-urlencoded" is wrongly added implicitly when data to be posted is 0
Date: Mon, 19 Mar 2012 10:48:19 +0800
Hey, Guys
As "http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTHTTPPOST"
said:
"A parameter set to 1 tells the library to do a regular HTTP
post. This will also make the library use a "Content-Type:
application/x-www-form-urlencoded" header. (This is by far the most
commonly used POST method)"
When I set data to be posted to zero(CURLOPT_POSTFIELDSIZE = 0 or
CURLOPT_POSTFIELDSIZE_LARGE = 0), I think curl should not add
"Content-Type: application/x-www-form-urlencoded" any more, because
there are not any data , it does not make any sense to set this
header. In a real world some servers get this header without any data
will have a wrong behavior to send back wrong data to browser client.
Chris
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-19