aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFredrik Gustafsson <[email protected]>2013-08-22 15:36:13 +0200
committerFredrik Gustafsson <[email protected]>2013-08-22 15:36:13 +0200
commit5e2f9c13426ad4048d563c730bf29f8b677e6fb5 (patch)
treed58ba7a398a9252af26a6379b8f8e709e41772fd /lib
parent4f61d1501e47d824a5c761300e8a21d9c5f1c5b7 (diff)
parent424021bb4253cbf0f864b97666497b82b5da66c1 (diff)
downloadotp-5e2f9c13426ad4048d563c730bf29f8b677e6fb5.tar.gz
otp-5e2f9c13426ad4048d563c730bf29f8b677e6fb5.tar.bz2
otp-5e2f9c13426ad4048d563c730bf29f8b677e6fb5.zip
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r--lib/inets/src/http_server/httpd_response.erl6
-rw-r--r--lib/inets/src/http_server/mod_cgi.erl2
-rw-r--r--lib/inets/src/http_server/mod_esi.erl2
-rw-r--r--lib/inets/test/httpd_basic_SUITE.erl25
4 files changed, 29 insertions, 6 deletions
diff --git a/lib/inets/src/http_server/httpd_response.erl b/lib/inets/src/http_server/httpd_response.erl
index 6b6532266b..a45b04f275 100644
--- a/lib/inets/src/http_server/httpd_response.erl
+++ b/lib/inets/src/http_server/httpd_response.erl
@@ -20,7 +20,7 @@
-module(httpd_response).
-export([generate_and_send_response/1, send_status/3, send_header/3,
send_body/3, send_chunk/3, send_final_chunk/2, split_header/2,
- is_disable_chunked_send/1, cache_headers/1]).
+ is_disable_chunked_send/1, cache_headers/2]).
-export([map_status_code/2]).
-include("httpd.hrl").
@@ -266,8 +266,8 @@ get_connection(false,"HTTP/1.1") ->
get_connection(_,_) ->
"".
-cache_headers(#mod{config_db = Db}) ->
- case httpd_util:lookup(Db, script_nocache, false) of
+cache_headers(#mod{config_db = Db}, NoCacheType) ->
+ case httpd_util:lookup(Db, NoCacheType, false) of
true ->
Date = httpd_util:rfc1123_date(),
[{"cache-control", "no-cache"},
diff --git a/lib/inets/src/http_server/mod_cgi.erl b/lib/inets/src/http_server/mod_cgi.erl
index c854166c29..f1b73810e6 100644
--- a/lib/inets/src/http_server/mod_cgi.erl
+++ b/lib/inets/src/http_server/mod_cgi.erl
@@ -295,7 +295,7 @@ receive_headers(Port, Module, Function, Args, Timeout) ->
end.
send_headers(ModData, {StatusCode, _}, HTTPHeaders) ->
- ExtraHeaders = httpd_response:cache_headers(ModData),
+ ExtraHeaders = httpd_response:cache_headers(ModData, script_nocache),
httpd_response:send_header(ModData, StatusCode,
ExtraHeaders ++ HTTPHeaders).
diff --git a/lib/inets/src/http_server/mod_esi.erl b/lib/inets/src/http_server/mod_esi.erl
index e36c33b282..b11df34f9e 100644
--- a/lib/inets/src/http_server/mod_esi.erl
+++ b/lib/inets/src/http_server/mod_esi.erl
@@ -440,7 +440,7 @@ receive_headers(Timeout) ->
end.
send_headers(ModData, StatusCode, HTTPHeaders) ->
- ExtraHeaders = httpd_response:cache_headers(ModData),
+ ExtraHeaders = httpd_response:cache_headers(ModData, erl_script_nocache),
httpd_response:send_header(ModData, StatusCode,
ExtraHeaders ++ HTTPHeaders).
diff --git a/lib/inets/test/httpd_basic_SUITE.erl b/lib/inets/test/httpd_basic_SUITE.erl
index 523cf9d38c..fef0a1f0f4 100644
--- a/lib/inets/test/httpd_basic_SUITE.erl
+++ b/lib/inets/test/httpd_basic_SUITE.erl
@@ -33,7 +33,8 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
[
uri_too_long_414,
- header_too_long_413,
+ header_too_long_413,
+ erl_script_nocache_opt,
escaped_url_in_error_body,
slowdose
].
@@ -178,6 +179,28 @@ header_too_long_413(Config) when is_list(Config) ->
{version, "HTTP/1.1"}]),
inets:stop(httpd, Pid).
+%%-------------------------------------------------------------------------
+%%-------------------------------------------------------------------------
+
+erl_script_nocache_opt(doc) ->
+ ["Test that too long headers's get 413 HTTP code"];
+erl_script_nocache_opt(suite) ->
+ [];
+erl_script_nocache_opt(Config) when is_list(Config) ->
+ HttpdConf = ?config(httpd_conf, Config),
+ {ok, Pid} = inets:start(httpd, [{port, 0}, {erl_script_nocache, true} | HttpdConf]),
+ Info = httpd:info(Pid),
+ Port = proplists:get_value(port, Info),
+ _Address = proplists:get_value(bind_address, Info),
+ URL1 = ?URL_START ++ integer_to_list(Port),
+ case httpc:request(get, {URL1 ++ "/dummy.html", []},
+ [{url_encode, false},
+ {version, "HTTP/1.0"}],
+ [{full_result, false}]) of
+ {ok, {200, _}} ->
+ ok
+ end,
+ inets:stop(httpd, Pid).
%%-------------------------------------------------------------------------
%%-------------------------------------------------------------------------