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

Add the Server header in the HTTP replies.

This commit is contained in:
Loïc Hoguin 2011-05-14 18:46:50 +02:00
parent 95006c3291
commit c7069e7fb9

View file

@ -188,7 +188,8 @@ reply(Code, Headers, Body, Req=#http_req{socket=Socket,
{<<"Connection">>, atom_to_connection(Connection)}, {<<"Connection">>, atom_to_connection(Connection)},
{<<"Content-Length">>, {<<"Content-Length">>,
list_to_binary(integer_to_list(iolist_size(Body)))}, list_to_binary(integer_to_list(iolist_size(Body)))},
{<<"Date">>, cowboy_clock:rfc1123()} {<<"Date">>, cowboy_clock:rfc1123()},
{<<"Server">>, <<"Cowboy">>}
]), ]),
Transport:send(Socket, [Head, Body]), Transport:send(Socket, [Head, Body]),
{ok, Req#http_req{resp_state=done}}. {ok, Req#http_req{resp_state=done}}.
@ -200,7 +201,8 @@ chunked_reply(Code, Headers, Req=#http_req{socket=Socket, transport=Transport,
Head = response_head(Code, Headers, [ Head = response_head(Code, Headers, [
{<<"Connection">>, <<"close">>}, {<<"Connection">>, <<"close">>},
{<<"Transfer-Encoding">>, <<"chunked">>}, {<<"Transfer-Encoding">>, <<"chunked">>},
{<<"Date">>, cowboy_clock:rfc1123()} {<<"Date">>, cowboy_clock:rfc1123()},
{<<"Server">>, <<"Cowboy">>}
]), ]),
Transport:send(Socket, Head), Transport:send(Socket, Head),
{ok, Req#http_req{resp_state=chunks}}. {ok, Req#http_req{resp_state=chunks}}.