0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Switch to Ranch for connection handling

This is the first of many API incompatible changes.

You have been warned.
This commit is contained in:
Loïc Hoguin 2012-08-27 11:50:35 +02:00
parent 50e5a616dc
commit e4124de2c7
35 changed files with 133 additions and 1066 deletions

View file

@ -8,5 +8,6 @@
%% API.
start() ->
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(chunked_hello_world).

View file

@ -16,10 +16,9 @@ start(_Type, _Args) ->
{[], toppage_handler, []}
]}
],
{ok, _} = cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
{dispatch, Dispatch}
]),
chunked_hello_world_sup:start_link().
stop(_State) ->

View file

@ -8,5 +8,6 @@
%% API.
start() ->
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(echo_get).

View file

@ -16,10 +16,9 @@ start(_Type, _Args) ->
{[], toppage_handler, []}
]}
],
{ok, _} = cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
{dispatch, Dispatch}
]),
echo_get_sup:start_link().
stop(_State) ->

View file

@ -8,5 +8,6 @@
%% API.
start() ->
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(echo_post).

View file

@ -16,10 +16,9 @@ start(_Type, _Args) ->
{[], toppage_handler, []}
]}
],
{ok, _} = cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
{dispatch, Dispatch}
]),
echo_post_sup:start_link().
stop(_State) ->

View file

@ -1,3 +1,3 @@
#!/bin/sh
erl -pa ebin deps/*/ebin -s echo_post \
-eval "io:format(\"Run ./curl_post.sh STRING_TO_ECHO\")."
-eval "io:format(\"Run ./curl_post.sh STRING_TO_ECHO~n\")."

View file

@ -8,5 +8,6 @@
%% API.
start() ->
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(hello_world).

View file

@ -16,10 +16,9 @@ start(_Type, _Args) ->
{[], toppage_handler, []}
]}
],
{ok, _} = cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
{dispatch, Dispatch}
]),
hello_world_sup:start_link().
stop(_State) ->

View file

@ -8,5 +8,6 @@
%% API.
start() ->
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(rest_hello_world).

View file

@ -16,10 +16,9 @@ start(_Type, _Args) ->
{[], toppage_handler, []}
]}
],
{ok, _} = cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
{dispatch, Dispatch}
]),
rest_hello_world_sup:start_link().
stop(_State) ->

View file

@ -8,5 +8,6 @@
%% API.
start() ->
ok = application:start(ranch),
ok = application:start(cowboy),
ok = application:start(static).

View file

@ -18,10 +18,9 @@ start(_Type, _Args) ->
]}
]}
],
{ok, _} = cowboy:start_listener(http, 100,
cowboy_tcp_transport, [{port, 8080}],
cowboy_http_protocol, [{dispatch, Dispatch}]
),
{ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [
{dispatch, Dispatch}
]),
static_sup:start_link().
stop(_State) ->