From 1932aa2bf42bdee119c9a7b9e1a7a1a7e627be15 Mon Sep 17 00:00:00 2001 From: CA Meijer Date: Sat, 2 Mar 2013 06:48:04 +0200 Subject: 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". --- lib/inets/src/http_lib/http_request.erl | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib/inets/src/http_lib') diff --git a/lib/inets/src/http_lib/http_request.erl b/lib/inets/src/http_lib/http_request.erl index c214aca4a4..fbfbe7c632 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'); -- cgit v1.2.3