diff options
-rw-r--r-- | examples/rest_hello_world/README.md | 6 | ||||
-rw-r--r-- | src/cowboy.app.src | 3 | ||||
-rw-r--r-- | src/cowboy_req.erl | 21 | ||||
-rw-r--r-- | src/cowboy_rest.erl | 2 | ||||
-rw-r--r-- | src/cowboy_websocket.erl | 4 | ||||
-rw-r--r-- | test/autobahn_SUITE.erl | 6 | ||||
-rw-r--r-- | test/http_SUITE.erl | 4 | ||||
-rw-r--r-- | test/ws_SUITE.erl | 2 |
8 files changed, 18 insertions, 30 deletions
diff --git a/examples/rest_hello_world/README.md b/examples/rest_hello_world/README.md index c0b8c8d..7072e5e 100644 --- a/examples/rest_hello_world/README.md +++ b/examples/rest_hello_world/README.md @@ -28,7 +28,7 @@ server: Cowboy date: Fri, 28 Sep 2012 04:15:52 GMT content-length: 136 Content-Type: text/html -Variances: Accept +Vary: Accept <html> <head> @@ -51,7 +51,7 @@ server: Cowboy date: Fri, 28 Sep 2012 04:16:46 GMT content-length: 24 Content-Type: application/json -Variances: Accept +Vary: Accept {"rest": "Hello World!"} ``` @@ -66,7 +66,7 @@ server: Cowboy date: Fri, 28 Sep 2012 04:18:35 GMT content-length: 25 Content-Type: text/plain -Variances: Accept +Vary: Accept REST Hello World as text! ``` diff --git a/src/cowboy.app.src b/src/cowboy.app.src index e70a65f..b68ef14 100644 --- a/src/cowboy.app.src +++ b/src/cowboy.app.src @@ -20,7 +20,8 @@ {applications, [ kernel, stdlib, - ranch + ranch, + crypto ]}, {mod, {cowboy_app, []}}, {env, []} diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index 5b8cb7e..67d2a0f 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -399,7 +399,6 @@ parse_header(Name, Req=#http_req{p_headers=PHeaders}) -> %% @doc Default values for semantic header parsing. -spec parse_header_default(binary()) -> any(). -parse_header_default(<<"connection">>) -> []; parse_header_default(<<"transfer-encoding">>) -> [<<"identity">>]; parse_header_default(_Name) -> undefined. @@ -430,15 +429,9 @@ parse_header(Name, Req, Default) when Name =:= <<"accept-language">> -> cowboy_http:nonempty_list(Value, fun cowboy_http:language_range/2) end); parse_header(Name, Req, Default) when Name =:= <<"content-length">> -> - parse_header(Name, Req, Default, - fun (Value) -> - cowboy_http:digits(Value) - end); + parse_header(Name, Req, Default, fun cowboy_http:digits/1); parse_header(Name, Req, Default) when Name =:= <<"content-type">> -> - parse_header(Name, Req, Default, - fun (Value) -> - cowboy_http:content_type(Value) - end); + parse_header(Name, Req, Default, fun cowboy_http:content_type/1); parse_header(Name, Req, Default) when Name =:= <<"expect">> -> parse_header(Name, Req, Default, fun (Value) -> @@ -446,17 +439,11 @@ parse_header(Name, Req, Default) when Name =:= <<"expect">> -> end); parse_header(Name, Req, Default) when Name =:= <<"if-match">>; Name =:= <<"if-none-match">> -> - parse_header(Name, Req, Default, - fun (Value) -> - cowboy_http:entity_tag_match(Value) - end); + parse_header(Name, Req, Default, fun cowboy_http:entity_tag_match/1); parse_header(Name, Req, Default) when Name =:= <<"if-modified-since">>; Name =:= <<"if-unmodified-since">> -> - parse_header(Name, Req, Default, - fun (Value) -> - cowboy_http:http_date(Value) - end); + parse_header(Name, Req, Default, fun cowboy_http:http_date/1); %% @todo Extension parameters. parse_header(Name, Req, Default) when Name =:= <<"transfer-encoding">> -> parse_header(Name, Req, Default, diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl index 2f9faa8..c0decbd 100644 --- a/src/cowboy_rest.erl +++ b/src/cowboy_rest.erl @@ -470,7 +470,7 @@ variances(Req, State=#state{content_types_p=CTP, resource_exists(Req3, State2); [[<<", ">>, H]|Variances5] -> Req4 = cowboy_req:set_resp_header( - <<"Variances">>, [H|Variances5], Req3), + <<"Vary">>, [H|Variances5], Req3), resource_exists(Req4, State2) end. diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index dcd3008..bc88011 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -13,10 +13,6 @@ %% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. %% @doc WebSocket protocol implementation. -%% -%% When using websockets, make sure that the crypto application is -%% included in your release. If you are not using releases then there -%% is no need for concern as crypto is already included. -module(cowboy_websocket). %% API. diff --git a/test/autobahn_SUITE.erl b/test/autobahn_SUITE.erl index b05920d..9ae9d7a 100644 --- a/test/autobahn_SUITE.erl +++ b/test/autobahn_SUITE.erl @@ -36,7 +36,8 @@ groups() -> [{autobahn, [], BaseTests}]. init_per_suite(Config) -> - application:start(inets), + application:start(crypto), + application:start(ranch), application:start(cowboy), %% /tmp must be used as the parent directory for the virtualenv because %% the directory names used in CT are so long that the interpreter path @@ -56,7 +57,8 @@ init_per_suite(Config) -> end_per_suite(_Config) -> os:cmd("deactivate"), application:stop(cowboy), - application:stop(inets), + application:stop(ranch), + application:stop(crypto), ok. init_per_group(autobahn, Config) -> diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 2459d5e..4820f89 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -128,6 +128,7 @@ groups() -> init_per_suite(Config) -> application:start(inets), + application:start(crypto), application:start(ranch), application:start(cowboy), Config. @@ -135,6 +136,7 @@ init_per_suite(Config) -> end_per_suite(_Config) -> application:stop(cowboy), application:stop(ranch), + application:stop(crypto), application:stop(inets), ok. @@ -159,7 +161,6 @@ init_per_group(https, Config) -> {password, "cowboy"} ], Config1 = init_static_dir(Config), - application:start(crypto), application:start(public_key), application:start(ssl), {ok, _} = cowboy:start_https(https, 100, Opts ++ [{port, Port}], [ @@ -199,7 +200,6 @@ end_per_group(https, Config) -> cowboy:stop_listener(https), application:stop(ssl), application:stop(public_key), - application:stop(crypto), end_static_dir(Config), ok; end_per_group(http, Config) -> diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index b732eb8..0c98df0 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -33,6 +33,7 @@ groups() -> init_per_suite(Config) -> application:start(inets), + application:start(crypto), application:start(ranch), application:start(cowboy), Config. @@ -40,6 +41,7 @@ init_per_suite(Config) -> end_per_suite(_Config) -> application:stop(cowboy), application:stop(ranch), + application:stop(crypto), application:stop(inets), ok. |