Permalink
Browse files

Fix header matching for badly behaving servers

  • Loading branch information...
1 parent 3e559c8 commit ff360abb19a3249d676a10119c4a0c562f725f4f @pusewicz pusewicz committed with Mar 5, 2010
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/xmlrpc/src/xmlrpc.erl
@@ -183,16 +183,17 @@ parse_header(Socket, Timeout, Header) ->
{error, missing_content_length};
{ok, "\r\n"} -> {ok, Header};
{ok, HeaderField} ->
- case string:tokens(HeaderField, " \r\n") of
- ["Content-Length:", ContentLength] ->
+ [HeaderName,HeaderValue|_] = string:tokens(HeaderField, " \r\n"),
+ case [string:to_lower(HeaderName), HeaderValue] of
+ ["content-length:", ContentLength] ->
case catch list_to_integer(ContentLength) of
Value when integer(Value) ->
parse_header(Socket, Timeout,
Header#header{content_length =
Value});
_ -> {error, {invalid_content_length, ContentLength}}
end;
- ["Connection:", "close"] ->
+ ["connection:", "close"] ->
parse_header(Socket, Timeout,
Header#header{connection = close});
_ ->

0 comments on commit ff360ab

Please sign in to comment.