anchor.diff:  
   -spec init(cowboy_stream:streamid(), cowboy_req:req(), cowboy:opts())
   	-> {[{spawn, pid(), timeout()}], #state{}}.
  -init(_StreamID, Req=#{ref := Ref}, Opts) ->
  +init(StreamID, Req=#{ref := Ref}, Opts) ->
   	Env = maps:get(env, Opts, #{}),
   	Middlewares = maps:get(middlewares, Opts, [cowboy_router, cowboy_handler]),
   	Shutdown = maps:get(shutdown_timeout, Opts, 5000),
   	Pid = proc_lib:spawn_link(?MODULE, request_process, [Req, Env, Middlewares]),
   	Expect = expect(Req),
  -	{[{spawn, Pid, Shutdown}], #state{ref=Ref, pid=Pid, expect=Expect}}.
  +	{Commands, Next} = cowboy_stream:init(StreamID, Req, Opts),
  +	{[{spawn, Pid, Shutdown}|Commands],
  +		#state{next=Next, ref=Ref, pid=Pid, expect=Expect}}.
   
   %% Ignore the expect header in HTTP/1.0.
   expect(#{version := 'HTTP/1.0'}) ->
  
positive.code: -export([execute/3]).
  -export([resume/5]).
  
  %% @todo Need to call subsequent handlers.
  
  -record(state, {
  	ref = undefined :: ranch:ref(),
  	pid = undefined :: pid(),
  	expect = undefined :: undefined | continue,
  
negative.code: 		_ -> 400
  	end,
  	%% @todo Headers? Details in body? More stuff in debug only?
  	do_info(StreamID, Info, [
  		{error_response, Status, #{<<"content-length">> => <<"0">>}, <<>>},
  		stop
  	], State);
  info(StreamID, Exit={'EXIT', Pid, {Reason, Stacktrace}}, State=#state{ref=Ref, pid=Pid}) ->
  	report_crash(Ref, StreamID, Pid, Reason, Stacktrace),
  	do_info(StreamID, Exit, [
  		{error_response, 500, #{<<"content-length">> => <<"0">>}, <<>>},
  		{internal_error, Exit, 'Stream process crashed.'}
  	], State);
  %% Request body, auto mode, no body buffered.
  info(StreamID, Info={read_body, Ref, auto, infinity}, State=#state{read_body_buffer= <<>>}) ->
  	do_info(StreamID, Info, [], State#state{
  		read_body_ref=Ref,
  		read_body_length=auto
  	});
  %% Request body, auto mode, body buffered or complete.
  info(StreamID, Info={read_body, Ref, auto, infinity}, State=#state{pid=Pid,
  		read_body_is_fin=IsFin, read_body_buffer=Buffer, body_length=BodyLen}) ->
  	send_request_body(Pid, Ref, IsFin, BodyLen, Buffer),
  	do_info(StreamID, Info, [{flow, byte_size(Buffer)}],
  		State#state{read_body_buffer= <<>>});
  %% Request body, body buffered large enough or complete.
  %%
  %% We do not send a 100 continue response if the client
  %% already started sending the body.
  info(StreamID, Info={read_body, Ref, Length, _}, State=#state{pid=Pid,
  		read_body_is_fin=IsFin, read_body_buffer=Buffer, body_length=BodyLen})
  		when IsFin =:= fin; byte_size(Buffer) >= Length ->
  	send_request_body(Pid, Ref, IsFin, BodyLen, Buffer),
  	do_info(StreamID, Info, [], State#state{read_body_buffer= <<>>});
  %% Request body, not enough to send yet.
  info(StreamID, Info={read_body, Ref, Length, Period}, State=#state{expect=Expect}) ->
  	Commands = case Expect of
  		continue -> [{inform, 100, #{}}, {flow, Length}];
  		undefined -> [{flow, Length}]
  	end,
  	%% @todo Handle the case where Period =:= infinity.
  	TRef = erlang:send_after(Period, self(), {{self(), StreamID}, {read_body_timeout, Ref}}),
  	do_info(StreamID, Info, Commands, State#state{
  		read_body_ref=Ref,
  		read_body_timer_ref=TRef,
  		read_body_length=Length
  	});
  %% Request body reading timeout; send what we got.
  info(StreamID, Info={read_body_timeout, Ref}, State=#state{pid=Pid, read_body_ref=Ref,
  		read_body_is_fin=IsFin, read_body_buffer=Buffer, body_length=BodyLen}) ->
  	send_request_body(Pid, Ref, IsFin, BodyLen, Buffer),
  	do_info(StreamID, Info, [], State#state{
  		read_body_ref=undefined,
  		read_body_timer_ref=undefined,
  		read_body_buffer= <<>>
  	});
  info(StreamID, Info={read_body_timeout, _}, State) ->
  	do_info(StreamID, Info, [], State);
  %% Response.
  %%
  %% We reset the expect field when a 100 continue response
  %% is sent or when any final response is sent.
  info(StreamID, Inform={inform, Status, _}, State0) ->
  	State = case cow_http:status_to_integer(Status) of
  		100 -> State0#state{expect=undefined};
  		_ -> State0
  	end,
  	do_info(StreamID, Inform, [Inform], State);
  info(StreamID, Response={response, _, _, _}, State) ->
  	do_info(StreamID, Response, [Response], State#state{expect=undefined});
  info(StreamID, Headers={headers, _, _}, State) ->
  	do_info(StreamID, Headers, [Headers], State#state{expect=undefined});
  info(StreamID, Data={data, _, _}, State) ->
  	do_info(StreamID, Data, [Data], State);
  info(StreamID, Trailers={trailers, _}, State) ->
  	do_info(StreamID, Trailers, [Trailers], State);
  info(StreamID, Push={push, _, _, _, _, _, _, _}, State) ->
  	do_info(StreamID, Push, [Push], State);
  info(StreamID, SwitchProtocol={switch_protocol, _, _, _}, State) ->
  	do_info(StreamID, SwitchProtocol, [SwitchProtocol], State#state{expect=undefined});
  %% Unknown message, either stray or meant for a handler down the line.
  info(StreamID, Info, State) ->
  	do_info(StreamID, Info, [], State).
  
  do_info(StreamID, Info, Commands1, State0=#state{next=Next0}) ->
  	{Commands2, Next} = cowboy_stream:info(StreamID, Info, Next0),
  	{Commands1 ++ Commands2, State0#state{next=Next}}.
  
  -spec terminate(cowboy_stream:streamid(), cowboy_stream:reason(), #state{}) -> ok.
  terminate(StreamID, Reason, #state{next=Next}) ->
  	cowboy_stream:terminate(StreamID, Reason, Next).
  
  -spec early_error(cowboy_stream:streamid(), cowboy_stream:reason(),
  	cowboy_stream:partial_req(), Resp, cowboy:opts()) -> Resp
  