anchor.diff:  	Authority = case {Scheme, Port} of
   		{<<"http">>, 80} -> Host;
   		{<<"https">>, 443} -> Host;
  -		_ -> [Host, $:, integer_to_binary(Port)]
  +		_ -> iolist_to_binary([Host, $:, integer_to_binary(Port)])
   	end,
   	PathWithQs = case Qs of
   		<<>> -> Path;
   		_ -> [Path, $?, Qs]
   	end,
  -	Headers = Headers0#{<<":method">> => Method,
  -			<<":scheme">> => Scheme,
  -			<<":authority">> => Authority,
  -			<<":path">> => PathWithQs},
  +	%% We need to make sure the header value is binary before we can
  +	%% pass it to stream_req_init, as it expects them to be flat.
  +	Headers1 = maps:map(fun(_, V) -> iolist_to_binary(V) end, Headers0),
  +	Headers = Headers1#{
  +		<<":method">> => Method,
  +		<<":scheme">> => Scheme,
  +		<<":authority">> => Authority,
  +		<<":path">> => iolist_to_binary(PathWithQs)},
   	{HeaderBlock, EncodeState} = headers_encode(Headers, EncodeState0),
   	Transport:send(Socket, cow_http2:push_promise(StreamID, PromisedStreamID, HeaderBlock)),
  -	%% @todo iolist_to_binary(HeaderBlock) isn't optimal. Need a shortcut.
  -	State = stream_init(State0#state{server_streamid=PromisedStreamID + 2, encode_state=EncodeState},
  -		PromisedStreamID, fin, iolist_to_binary(HeaderBlock)),
  +	State = stream_req_init(State0#state{server_streamid=PromisedStreamID + 2,
  +		encode_state=EncodeState}, PromisedStreamID, fin, Headers),
   	commands(State, Stream, Tail);
   commands(State=#state{socket=Socket, transport=Transport, remote_window=ConnWindow},
   		Stream=#stream{id=StreamID, remote_window=StreamWindow},
  
positive.code: 
  continuation_frame(State=#state{parse_state={continuation, StreamID, IsFin, HeaderBlockFragment0}},
  		{continuation, StreamID, head_fin, HeaderBlockFragment1}) ->
  	stream_init(State#state{parse_state=normal}, StreamID, IsFin,
  		<< HeaderBlockFragment0/binary, HeaderBlockFragment1/binary >>);
  continuation_frame(State=#state{parse_state={continuation, StreamID, IsFin, HeaderBlockFragment0}},
  		{continuation, StreamID, head_nofin, HeaderBlockFragment1}) ->
  
negative.code: 
  %% Stream functions.
  
  stream_decode_init(State=#state{socket=Socket, transport=Transport,
  		decode_state=DecodeState0}, StreamID, IsFin, HeaderBlock) ->
  	%% @todo Add clause for CONNECT requests (no scheme/path).
  	try headers_decode(HeaderBlock, DecodeState0) of
  		{Headers=#{<<":method">> := _, <<":scheme">> := _,
  				<<":authority">> := _, <<":path">> := _}, DecodeState} ->
  			stream_req_init(State#state{decode_state=DecodeState}, StreamID, IsFin, Headers);
  		{_, DecodeState} ->
  			Transport:send(Socket, cow_http2:rst_stream(StreamID, protocol_error)),
  			State#state{decode_state=DecodeState}
  	catch _:_ ->
  		terminate(State, {connection_error, compression_error,
  			'Error while trying to decode HPACK-encoded header block. (RFC7540 4.3)'})
  	end.
  
  stream_req_init(State=#state{ref=Ref, peer=Peer}, StreamID, IsFin, Headers0=#{
  		<<":method">> := Method, <<":scheme">> := Scheme,
  		<<":authority">> := Authority, <<":path">> := PathWithQs}) ->
  	Headers = maps:without([<<":method">>, <<":scheme">>, <<":authority">>, <<":path">>], Headers0),
  	BodyLength = case Headers of
  		_ when IsFin =:= fin ->
  			0;
  		#{<<"content-length">> := <<"0">>} ->
  			0;
  		#{<<"content-length">> := BinLength} ->
  			try
  				cow_http_hd:parse_content_length(BinLength)
  			catch _:_ ->
  				terminate(State, {stream_error, StreamID, protocol_error,
  					'The content-length header is invalid. (RFC7230 3.3.2)'})
  			end;
  		_ ->
  			undefined
  	end,
  	{Host, Port} = cow_http_hd:parse_host(Authority),
  	{Path, Qs} = cow_http:parse_fullpath(PathWithQs),
  	Req = #{
  		ref => Ref,
  		pid => self(),
  		streamid => StreamID,
  		peer => Peer,
  		method => Method,
  		scheme => Scheme,
  		host => Host,
  		port => Port,
  		path => Path,
  		qs => Qs,
  		version => 'HTTP/2',
  		headers => Headers,
  		has_body => IsFin =:= nofin,
  		body_length => BodyLength
  	},
  	stream_handler_init(State, StreamID, IsFin, idle, Req).
  
  stream_handler_init(State=#state{opts=Opts,
  		local_settings=#{initial_window_size := RemoteWindow},
  