diff options
author | Micael Karlberg <[email protected]> | 2012-02-06 14:49:42 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2012-02-06 14:49:42 +0100 |
commit | dcf35c1ef914f7473bb64fa9175af2cf42744885 (patch) | |
tree | 04183491c784b1d9ff0e2fcdbf06f6bd2d22755e /lib/inets/src/http_server/httpd_response.erl | |
parent | 2d97f0e5f13bf22d92dbc6df18787581eb462c41 (diff) | |
parent | f555a1b1ed4461c33a99737136daf2793479425e (diff) | |
download | otp-dcf35c1ef914f7473bb64fa9175af2cf42744885.tar.gz otp-dcf35c1ef914f7473bb64fa9175af2cf42744885.tar.bz2 otp-dcf35c1ef914f7473bb64fa9175af2cf42744885.zip |
Merge branch 'bmk/inets/httpd/configurable_server_tokens/OTP-9805' into bmk/inets/inets59_integration
Diffstat (limited to 'lib/inets/src/http_server/httpd_response.erl')
-rw-r--r-- | lib/inets/src/http_server/httpd_response.erl | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/inets/src/http_server/httpd_response.erl b/lib/inets/src/http_server/httpd_response.erl index dd7223876e..2dedb088e4 100644 --- a/lib/inets/src/http_server/httpd_response.erl +++ b/lib/inets/src/http_server/httpd_response.erl @@ -144,10 +144,14 @@ send_response(ModData, Header, Body) -> end end. -send_header(#mod{socket_type = Type, socket = Sock, - http_version = Ver, connection = Conn} = _ModData, +send_header(#mod{socket_type = Type, + socket = Sock, + http_version = Ver, + connection = Conn, + config_db = ConfigDb} = _ModData, StatusCode, KeyValueTupleHeaders) -> - Headers = create_header(lists:map(fun transform/1, KeyValueTupleHeaders)), + Headers = create_header(ConfigDb, + lists:map(fun transform/1, KeyValueTupleHeaders)), NewVer = case {Ver, StatusCode} of {[], _} -> %% May be implicit! @@ -275,13 +279,20 @@ cache_headers(#mod{config_db = Db}) -> [] end. -create_header(KeyValueTupleHeaders) -> - NewHeaders = add_default_headers([{"date", httpd_util:rfc1123_date()}, - {"content-type", "text/html"}, - {"server", ?SERVER_SOFTWARE}], - KeyValueTupleHeaders), +create_header(ConfigDb, KeyValueTupleHeaders) -> + Date = httpd_util:rfc1123_date(), + ContentType = "text/html", + Server = server(ConfigDb), + NewHeaders = add_default_headers([{"date", Date}, + {"content-type", ContentType}, + {"server", Server}], + KeyValueTupleHeaders), lists:map(fun fix_header/1, NewHeaders). + +server(ConfigDb) -> + httpd_util:lookup(ConfigDb, server, ?SERVER_SOFTWARE). + fix_header({Key0, Value}) -> %% make sure first letter is capital Words1 = string:tokens(Key0, "-"), |