aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2013-01-05 22:04:52 +0100
committerLoïc Hoguin <[email protected]>2013-01-05 22:04:52 +0100
commitc930327fbff6bedb3607185b971b9a1fbed9af8c (patch)
tree00f28a9ca6e4c176e0acab864a02c6830b16ea23 /src
parent58e89e218991a8d04108616620de9bb99dbeb7c0 (diff)
downloadcowboy-c930327fbff6bedb3607185b971b9a1fbed9af8c.tar.gz
cowboy-c930327fbff6bedb3607185b971b9a1fbed9af8c.tar.bz2
cowboy-c930327fbff6bedb3607185b971b9a1fbed9af8c.zip
Remove cowboy_req:transport/1
It was added to help with response body streaming functions. But it was a clumsy solution that we discarded in favor of passing socket and transport to said function. It was also very odd compared to the rest of the cowboy_req interface. If you used this function before, worry not, here's its proper equivalent. [Socket, Transport] = cowboy_req:get([socket, transport], Req)
Diffstat (limited to 'src')
-rw-r--r--src/cowboy_req.erl13
-rw-r--r--src/cowboy_websocket.erl2
2 files changed, 1 insertions, 14 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl
index adfb13a..5af1bf5 100644
--- a/src/cowboy_req.erl
+++ b/src/cowboy_req.erl
@@ -111,7 +111,6 @@
-export([compact/1]).
-export([lock/1]).
-export([to_list/1]).
--export([transport/1]).
-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").
@@ -1079,18 +1078,6 @@ lock(Req) ->
to_list(Req) ->
lists:zip(record_info(fields, http_req), tl(tuple_to_list(Req))).
-%% @doc Return the transport module and socket associated with a request.
-%%
-%% This exposes the same socket interface used internally by the HTTP protocol
-%% implementation to developers that needs low level access to the socket.
-%%
-%% It is preferred to use this in conjuction with the stream function support
-%% in `set_resp_body_fun/3' if this is used to write a response body directly
-%% to the socket. This ensures that the response headers are set correctly.
--spec transport(req()) -> {ok, module(), inet:socket()}.
-transport(#http_req{transport=Transport, socket=Socket}) ->
- {ok, Transport, Socket}.
-
%% Internal.
-spec response(cowboy_http:status(), cowboy_http:headers(),
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl
index abcc015..51fed54 100644
--- a/src/cowboy_websocket.erl
+++ b/src/cowboy_websocket.erl
@@ -66,7 +66,7 @@
upgrade(Req, Env, Handler, HandlerOpts) ->
{_, ListenerPid} = lists:keyfind(listener, 1, Env),
ranch_listener:remove_connection(ListenerPid),
- {ok, Transport, Socket} = cowboy_req:transport(Req),
+ [Socket, Transport] = cowboy_req:get([socket, transport], Req),
State = #state{env=Env, socket=Socket, transport=Transport,
handler=Handler, handler_opts=HandlerOpts},
case catch websocket_upgrade(State, Req) of