mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Handle expect: 100-continue request headers
The 100 continue response will only be sent if the client has not sent the body yet (at all), if the connection is HTTP/1.1 or above and if the user has not sent it yet. The 100 continue response is sent when the user calls read_body and it is cowboy_stream_h's responsibility to send it. This means projects that don't use the cowboy_stream_h stream handler will need to handle the expect header themselves (but that's okay because they might have different considerations than normal Cowboy).
This commit is contained in:
parent
f3d6b05b86
commit
217fac7f44
3 changed files with 77 additions and 7 deletions
|
@ -18,6 +18,9 @@ echo(<<"read_body">>, Req0, Opts) ->
|
|||
_ -> ok
|
||||
end,
|
||||
{_, Body, Req} = case cowboy_req:path(Req0) of
|
||||
<<"/100-continue", _/bits>> ->
|
||||
cowboy_req:inform(100, Req0),
|
||||
cowboy_req:read_body(Req0);
|
||||
<<"/full", _/bits>> -> read_body(Req0, <<>>);
|
||||
<<"/opts", _/bits>> -> cowboy_req:read_body(Req0, Opts);
|
||||
_ -> cowboy_req:read_body(Req0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue