aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src
diff options
context:
space:
mode:
authorCA Meijer <[email protected]>2013-03-02 06:48:04 +0200
committerIngela Anderton Andin <[email protected]>2014-02-05 10:32:28 +0100
commit5e7c3147b25b96cf08c3083cbb32f18f955f6f0f (patch)
tree581dc9b9be0ca879589ec6cc3a48102010507a10 /lib/inets/src
parent3ec3fcf098df6d0c2895eb11eaeb45d041cbf605 (diff)
downloadotp-5e7c3147b25b96cf08c3083cbb32f18f955f6f0f.tar.gz
otp-5e7c3147b25b96cf08c3083cbb32f18f955f6f0f.tar.bz2
otp-5e7c3147b25b96cf08c3083cbb32f18f955f6f0f.zip
Fix http_request:http_headers/1 to send content-length when length is zero
In R16B01, the http_request:http_headers/1 function removes the content-length field from the HTTP headers if the content length is zero. This results in some (perhaps many) HTTP servers rejecting POSTs and PUTs without data with a 411 status word. From RFC2616, section 14.13: "Any Content-Length greater than or EQUAL to zero is a valid value".
Diffstat (limited to 'lib/inets/src')
-rw-r--r--lib/inets/src/http_lib/http_request.erl9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/inets/src/http_lib/http_request.erl b/lib/inets/src/http_lib/http_request.erl
index c214aca4a4..b7f2379438 100644
--- a/lib/inets/src/http_lib/http_request.erl
+++ b/lib/inets/src/http_lib/http_request.erl
@@ -248,13 +248,8 @@ key_value_str(Key = 'content-language', Headers) ->
key_value_str(atom_to_list(Key),
Headers#http_request_h.'content-language');
key_value_str(Key = 'content-length', Headers) ->
- case Headers#http_request_h.'content-length' of
- "0" ->
- undefined;
- _ ->
- key_value_str(atom_to_list(Key),
- Headers#http_request_h.'content-length')
- end;
+ key_value_str(atom_to_list(Key),
+ Headers#http_request_h.'content-length');
key_value_str(Key = 'content-location', Headers) ->
key_value_str(atom_to_list(Key),
Headers#http_request_h.'content-location');