aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_tcp_transport.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-04-29 01:20:24 +0200
committerLoïc Hoguin <[email protected]>2012-04-29 15:22:20 +0200
commitee8c50c5ab97dcaebc8932d093741fdb496e00f7 (patch)
tree8e2b4e48361681cad25042ba85a22187ec452154 /src/cowboy_tcp_transport.erl
parent845d306df68f37bb5246b0ce21b2a70456f042c4 (diff)
downloadcowboy-ee8c50c5ab97dcaebc8932d093741fdb496e00f7.tar.gz
cowboy-ee8c50c5ab97dcaebc8932d093741fdb496e00f7.tar.bz2
cowboy-ee8c50c5ab97dcaebc8932d093741fdb496e00f7.zip
Fix and rework the HTTP test suite
Use a proper HTTP client to run all tests. This client is currently undocumented and should not be used. Includes a few fixes: * Fix a bug in the max_keepalive test * Fix a bug with max_keepalive handling * Fix a bug in stream_body/1 where data was lost under some conditions The tests now run quite faster than before. All the tests now run twice: once for TCP, once for SSL.
Diffstat (limited to 'src/cowboy_tcp_transport.erl')
-rw-r--r--src/cowboy_tcp_transport.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cowboy_tcp_transport.erl b/src/cowboy_tcp_transport.erl
index f197dd1..079494d 100644
--- a/src/cowboy_tcp_transport.erl
+++ b/src/cowboy_tcp_transport.erl
@@ -21,6 +21,7 @@
-export([name/0, messages/0, listen/1, accept/2, recv/3, send/2, setopts/2,
controlling_process/2, peername/1, close/1, sockname/1]).
+-export([connect/3]).
%% @doc Name of this transport API, <em>tcp</em>.
-spec name() -> tcp.
@@ -33,6 +34,11 @@ name() -> tcp.
-spec messages() -> {tcp, tcp_closed, tcp_error}.
messages() -> {tcp, tcp_closed, tcp_error}.
+%% @private
+connect(Host, Port, Opts) when is_list(Host), is_integer(Port) ->
+ gen_tcp:connect(Host, Port,
+ Opts ++ [binary, {active, false}, {packet, raw}]).
+
%% @doc Setup a socket to listen on the given port on the local host.
%%
%% The available options are: