diff options
author | Loïc Hoguin <[email protected]> | 2017-12-06 14:05:30 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-12-06 14:05:30 +0100 |
commit | bc39b433bb20c44690b75bf28539983517002268 (patch) | |
tree | c335c45a92f535d2100d04f8a9df8899f459b013 /src/cowboy_router.erl | |
parent | 2eb3e3f994e464ae2678f7c3d321213e5eec9ad4 (diff) | |
download | cowboy-bc39b433bb20c44690b75bf28539983517002268.tar.gz cowboy-bc39b433bb20c44690b75bf28539983517002268.tar.bz2 cowboy-bc39b433bb20c44690b75bf28539983517002268.zip |
Properly handle OPTIONS * requests
Support for these was broken during the development
of Cowboy 2.0. It is now fixed and better handled
than it ever was.
Diffstat (limited to 'src/cowboy_router.erl')
-rw-r--r-- | src/cowboy_router.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cowboy_router.erl b/src/cowboy_router.erl index 9d25442..fb5c383 100644 --- a/src/cowboy_router.erl +++ b/src/cowboy_router.erl @@ -82,6 +82,8 @@ compile_paths([{PathMatch, Fields, Handler, Opts}|Tail], Acc) Fields, Handler, Opts}|Tail], Acc); compile_paths([{'_', Fields, Handler, Opts}|Tail], Acc) -> compile_paths(Tail, [{'_', Fields, Handler, Opts}] ++ Acc); +compile_paths([{<<"*">>, Fields, Handler, Opts}|Tail], Acc) -> + compile_paths(Tail, [{<<"*">>, Fields, Handler, Opts}|Acc]); compile_paths([{<< $/, PathMatch/bits >>, Fields, Handler, Opts}|Tail], Acc) -> PathRules = compile_rules(PathMatch, $/, [], [], <<>>), @@ -252,6 +254,8 @@ match_path([{'_', [], Handler, Opts}|_Tail], HostInfo, _, Bindings) -> {ok, Handler, Opts, Bindings, HostInfo, undefined}; match_path([{<<"*">>, _, Handler, Opts}|_Tail], HostInfo, <<"*">>, Bindings) -> {ok, Handler, Opts, Bindings, HostInfo, undefined}; +match_path([_|Tail], HostInfo, <<"*">>, Bindings) -> + match_path(Tail, HostInfo, <<"*">>, Bindings); match_path([{PathMatch, Fields, Handler, Opts}|Tail], HostInfo, Tokens, Bindings) when is_list(Tokens) -> case list_match(Tokens, PathMatch, Bindings) of |