mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Use cowlib master
This commit is contained in:
parent
41ac668ac7
commit
3cede06283
5 changed files with 13 additions and 11 deletions
2
Makefile
2
Makefile
|
@ -13,6 +13,8 @@ PLT_APPS = crypto public_key ssl
|
||||||
# Dependencies.
|
# Dependencies.
|
||||||
|
|
||||||
DEPS = cowlib ranch
|
DEPS = cowlib ranch
|
||||||
|
dep_cowlib = git https://github.com/ninenines/cowlib master
|
||||||
|
|
||||||
TEST_DEPS = ct_helper gun
|
TEST_DEPS = ct_helper gun
|
||||||
dep_ct_helper = git https://github.com/extend/ct_helper.git master
|
dep_ct_helper = git https://github.com/extend/ct_helper.git master
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
}).
|
}).
|
||||||
|
|
||||||
-include_lib("cowlib/include/cow_inline.hrl").
|
-include_lib("cowlib/include/cow_inline.hrl").
|
||||||
|
-include_lib("cowlib/include/cow_parse.hrl").
|
||||||
|
|
||||||
%% API.
|
%% API.
|
||||||
|
|
||||||
|
@ -264,13 +265,12 @@ match_colon(<< _, Rest/bits >>, N) ->
|
||||||
match_colon(_, _) ->
|
match_colon(_, _) ->
|
||||||
nomatch.
|
nomatch.
|
||||||
|
|
||||||
|
parse_hd_name(<< $:, Rest/bits >>, S, M, P, Q, V, H, SoFar) ->
|
||||||
|
parse_hd_before_value(Rest, S, M, P, Q, V, H, SoFar);
|
||||||
|
parse_hd_name(<< C, Rest/bits >>, S, M, P, Q, V, H, SoFar) when ?IS_WS(C) ->
|
||||||
|
parse_hd_name_ws(Rest, S, M, P, Q, V, H, SoFar);
|
||||||
parse_hd_name(<< C, Rest/bits >>, S, M, P, Q, V, H, SoFar) ->
|
parse_hd_name(<< C, Rest/bits >>, S, M, P, Q, V, H, SoFar) ->
|
||||||
case C of
|
?LOWER(parse_hd_name, Rest, S, M, P, Q, V, H, SoFar).
|
||||||
$: -> parse_hd_before_value(Rest, S, M, P, Q, V, H, SoFar);
|
|
||||||
$\s -> parse_hd_name_ws(Rest, S, M, P, Q, V, H, SoFar);
|
|
||||||
$\t -> parse_hd_name_ws(Rest, S, M, P, Q, V, H, SoFar);
|
|
||||||
?INLINE_LOWERCASE(parse_hd_name, Rest, S, M, P, Q, V, H, SoFar)
|
|
||||||
end.
|
|
||||||
|
|
||||||
parse_hd_name_ws(<< C, Rest/bits >>, S, M, P, Q, V, H, Name) ->
|
parse_hd_name_ws(<< C, Rest/bits >>, S, M, P, Q, V, H, Name) ->
|
||||||
case C of
|
case C of
|
||||||
|
@ -429,9 +429,7 @@ parse_host(<< $:, Rest/bits >>, false, Acc) ->
|
||||||
parse_host(<< $], Rest/bits >>, true, Acc) ->
|
parse_host(<< $], Rest/bits >>, true, Acc) ->
|
||||||
parse_host(Rest, false, << Acc/binary, $] >>);
|
parse_host(Rest, false, << Acc/binary, $] >>);
|
||||||
parse_host(<< C, Rest/bits >>, E, Acc) ->
|
parse_host(<< C, Rest/bits >>, E, Acc) ->
|
||||||
case C of
|
?LOWER(parse_host, Rest, E, Acc).
|
||||||
?INLINE_LOWERCASE(parse_host, Rest, E, Acc)
|
|
||||||
end.
|
|
||||||
|
|
||||||
%% End of request parsing.
|
%% End of request parsing.
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -906,6 +906,8 @@ maybe_reply(Stacktrace, Req) ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
do_maybe_reply([{erlang, binary_to_integer, _, _}, {cow_http_hd, parse_content_length, _, _}|_], Req) ->
|
||||||
|
cowboy_req:reply(400, Req);
|
||||||
do_maybe_reply([{cow_http_hd, _, _, _}|_], Req) ->
|
do_maybe_reply([{cow_http_hd, _, _, _}|_], Req) ->
|
||||||
cowboy_req:reply(400, Req);
|
cowboy_req:reply(400, Req);
|
||||||
do_maybe_reply(_, Req) ->
|
do_maybe_reply(_, Req) ->
|
||||||
|
|
|
@ -387,7 +387,7 @@ delete_child(Pid, State=#state{children=Children}) ->
|
||||||
-> ok.
|
-> ok.
|
||||||
request_init(FakeSocket, Peer, OnResponse,
|
request_init(FakeSocket, Peer, OnResponse,
|
||||||
Env, Middlewares, Method, Host, Path, Version, Headers) ->
|
Env, Middlewares, Method, Host, Path, Version, Headers) ->
|
||||||
{Host2, Port} = cow_http:parse_fullhost(Host),
|
{Host2, Port} = cow_http_hd:parse_host(Host),
|
||||||
{Path2, Qs} = cow_http:parse_fullpath(Path),
|
{Path2, Qs} = cow_http:parse_fullpath(Path),
|
||||||
Version2 = cow_http:parse_version(Version),
|
Version2 = cow_http:parse_version(Version),
|
||||||
Req = cowboy_req:new(FakeSocket, ?MODULE, Peer,
|
Req = cowboy_req:new(FakeSocket, ?MODULE, Peer,
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
-export([init/2]).
|
-export([init/2]).
|
||||||
|
|
||||||
init(Req, content_length) ->
|
init(Req, content_length) ->
|
||||||
cowboy_error_h:ignore(cow_http_hd, number, 2),
|
cowboy_error_h:ignore(erlang, binary_to_integer, 1),
|
||||||
cowboy_req:parse_header(<<"content-length">>, Req).
|
cowboy_req:parse_header(<<"content-length">>, Req).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue