From 3de0604eec218996dad4db59c0cc96092cd7e0e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 26 Aug 2020 13:45:34 +0200 Subject: Refactor protocol handling via gun_protocols --- src/gun_http.erl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/gun_http.erl') diff --git a/src/gun_http.erl b/src/gun_http.erl index 950bda1..2536369 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -347,11 +347,8 @@ handle_connect(Rest, State=#http_state{ ], State), EvHandlerState1}; _ -> [NewProtocol0] = maps:get(protocols, Destination, [http]), - NewProtocol = {Protocol0, _} = case NewProtocol0 of - {P, POpts} -> {P, POpts#{stream_ref => RealStreamRef}}; - P -> {P, #{stream_ref => RealStreamRef}} - end, - Protocol = gun:protocol_handler(Protocol0), + NewProtocol = gun_protocols:add_stream_ref(NewProtocol0, RealStreamRef), + Protocol = gun_protocols:handler(NewProtocol), ReplyTo ! {gun_tunnel_up, self(), RealStreamRef, Protocol:name()}, {handle_ret([ {origin, <<"http">>, NewHost, NewPort, connect}, -- cgit v1.2.3