Просмотр исходного кода

Add the Server header in the HTTP replies.

Loïc Hoguin 14 лет назад
Родитель
Сommit
c7069e7fb9
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      src/cowboy_http_req.erl

+ 4 - 2
src/cowboy_http_req.erl

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