diff options
author | Loïc Hoguin <[email protected]> | 2013-05-16 12:56:01 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-05-16 12:56:01 +0200 |
commit | 28186a68d0c023987fe7334b0326fb6c87f9447c (patch) | |
tree | 732b0da9873c061cdda690973150e7ccbce3b99b /src/cowboy_protocol.erl | |
parent | e0b5526f1e6c0794fc76c77f0fc6a4a95696d23f (diff) | |
download | cowboy-28186a68d0c023987fe7334b0326fb6c87f9447c.tar.gz cowboy-28186a68d0c023987fe7334b0326fb6c87f9447c.tar.bz2 cowboy-28186a68d0c023987fe7334b0326fb6c87f9447c.zip |
Make the HTTP version type more practical
Now instead of {1, 1} we have 'HTTP/1.1', and instead of {1, 0}
we have 'HTTP/1.0'. This is more efficient, easier to read in
crash logs, and clearer in the code.
Diffstat (limited to 'src/cowboy_protocol.erl')
-rw-r--r-- | src/cowboy_protocol.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cowboy_protocol.erl b/src/cowboy_protocol.erl index 09dc9d7..7c80bfd 100644 --- a/src/cowboy_protocol.erl +++ b/src/cowboy_protocol.erl @@ -242,9 +242,9 @@ skip_uri_fragment(<< C, Rest/bits >>, S, M, P, Q) -> end. parse_version(<< "HTTP/1.1\r\n", Rest/bits >>, S, M, P, Q) -> - parse_header(Rest, S, M, P, Q, {1, 1}, []); + parse_header(Rest, S, M, P, Q, 'HTTP/1.1', []); parse_version(<< "HTTP/1.0\r\n", Rest/bits >>, S, M, P, Q) -> - parse_header(Rest, S, M, P, Q, {1, 0}, []); + parse_header(Rest, S, M, P, Q, 'HTTP/1.0', []); parse_version(_, State, _, _, _) -> error_terminate(505, State). @@ -411,7 +411,7 @@ parse_hd_value(<<>>, S, M, P, Q, V, H, N, SoFar) -> request(B, State=#state{transport=Transport}, M, P, Q, Version, Headers) -> case lists:keyfind(<<"host">>, 1, Headers) of - false when Version =:= {1, 1} -> + false when Version =:= 'HTTP/1.1' -> error_terminate(400, State); false -> request(B, State, M, P, Q, Version, Headers, @@ -583,7 +583,7 @@ error_terminate(Code, State=#state{socket=Socket, transport=Transport, {cowboy_req, resp_sent} -> ok after 0 -> _ = cowboy_req:reply(Code, cowboy_req:new(Socket, Transport, - undefined, <<"GET">>, <<>>, <<>>, {1, 1}, [], <<>>, + undefined, <<"GET">>, <<>>, <<>>, 'HTTP/1.1', [], <<>>, undefined, <<>>, false, Compress, OnResponse)), ok end, |