aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorIngela Andin <[email protected]>2019-06-17 12:18:52 +0200
committerGitHub <[email protected]>2019-06-17 12:18:52 +0200
commitdc60b1db60b96f6ea300270a7fed9d82e330f86d (patch)
treedee83a0fa7e034357f67fff3d2507f5b87ad2393 /lib
parentd156b2cdceb8b2150522ba6c5ecca8734738e55e (diff)
parent58d4a482d710d002acaabd74230922202adbc165 (diff)
downloadotp-dc60b1db60b96f6ea300270a7fed9d82e330f86d.tar.gz
otp-dc60b1db60b96f6ea300270a7fed9d82e330f86d.tar.bz2
otp-dc60b1db60b96f6ea300270a7fed9d82e330f86d.zip
Merge pull request #2206 from alehar/inets/httpd_request_parse_headers_fix
inets: httpd_request - honor RFC2616 LF only as header line terminator OTP-15893
Diffstat (limited to 'lib')
-rw-r--r--lib/inets/src/http_server/httpd_request.erl4
-rw-r--r--lib/inets/test/http_format_SUITE.erl13
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/inets/src/http_server/httpd_request.erl b/lib/inets/src/http_server/httpd_request.erl
index 9d7538a13d..f3e24263b8 100644
--- a/lib/inets/src/http_server/httpd_request.erl
+++ b/lib/inets/src/http_server/httpd_request.erl
@@ -196,9 +196,9 @@ parse_headers(<<?CR,?LF,?LF,Body/binary>>, [], [], Current, Max, Options, Result
parse_headers(<<?CR,?LF,?CR,?LF,Body/binary>>, [], [], Current, Max,
Options, Result);
-parse_headers(<<?LF,?LF,Body/binary>>, [], [], Current, Max, Options, Result) ->
+parse_headers(<<?LF,?LF,Body/binary>>, Header, Headers, Current, Max, Options, Result) ->
%% If ?CR is is missing RFC2616 section-19.3
- parse_headers(<<?CR,?LF,?CR,?LF,Body/binary>>, [], [], Current, Max,
+ parse_headers(<<?CR,?LF,?CR,?LF,Body/binary>>, Header, Headers, Current, Max,
Options, Result);
parse_headers(<<?CR,?LF,?CR,?LF,Body/binary>>, [], [], _, _, _, Result) ->
diff --git a/lib/inets/test/http_format_SUITE.erl b/lib/inets/test/http_format_SUITE.erl
index 0a5aed67d5..3ff3ed4e97 100644
--- a/lib/inets/test/http_format_SUITE.erl
+++ b/lib/inets/test/http_format_SUITE.erl
@@ -414,6 +414,19 @@ http_request(Config) when is_list(Config) ->
{max_content_length, ?HTTP_MAX_CONTENT_LENGTH}
]], HttpHead2),
+ %% If ?CR is is missing RFC2616 section-19.3
+ HttpHead3 = ["GET http://www.erlang.org HTTP/1.1", [?LF],
+ "Accept: text/html", [?LF, ?LF]],
+ {"GET",
+ "http://www.erlang.org",
+ "HTTP/1.1",
+ {#http_request_h{}, [{"accept","text/html"}]}, <<>>} =
+ parse(httpd_request, parse, [[{max_header, ?HTTP_MAX_HEADER_SIZE},
+ {max_version, ?HTTP_MAX_VERSION_STRING},
+ {max_method, ?HTTP_MAX_METHOD_STRING},
+ {max_content_length, ?HTTP_MAX_CONTENT_LENGTH}
+ ]], HttpHead3),
+
%% Note the following body is not related to the headers above
HttpBody = ["<HTML>\n<HEAD>\n<TITLE> dummy </TITLE>\n</HEAD>\n<BODY>\n",
"<H1>dummy</H1>\n</BODY>\n</HTML>\n"],