diff options
Diffstat (limited to 'lib/inets')
-rw-r--r-- | lib/inets/doc/src/httpc.xml | 6 | ||||
-rw-r--r-- | lib/inets/doc/src/httpd.xml | 28 | ||||
-rw-r--r-- | lib/inets/doc/src/httpd_util.xml | 4 | ||||
-rw-r--r-- | lib/inets/doc/src/mod_alias.xml | 4 | ||||
-rw-r--r-- | lib/inets/doc/src/notes_history.xml | 2 | ||||
-rw-r--r-- | lib/inets/src/ftp/ftp.erl | 2 | ||||
-rw-r--r-- | lib/inets/src/http_client/httpc.erl | 2 | ||||
-rw-r--r-- | lib/inets/src/http_server/httpd_response.erl | 6 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_cgi.erl | 2 | ||||
-rw-r--r-- | lib/inets/src/http_server/mod_esi.erl | 2 | ||||
-rw-r--r-- | lib/inets/test/httpc_proxy_SUITE.erl | 17 | ||||
-rw-r--r-- | lib/inets/test/httpd_basic_SUITE.erl | 25 |
12 files changed, 70 insertions, 30 deletions
diff --git a/lib/inets/doc/src/httpc.xml b/lib/inets/doc/src/httpc.xml index 741f2abaef..d9a27e7d1e 100644 --- a/lib/inets/doc/src/httpc.xml +++ b/lib/inets/doc/src/httpc.xml @@ -300,11 +300,11 @@ filename() = string() process or to a file. When streaming to the calling process using the option <c>self</c> the following stream messages will be sent to that process: <c>{http, {RequestId, - stream_start, Headers}, {http, {RequestId, stream, - BinBodyPart}, {http, {RequestId, stream_end, Headers}</c>. When + stream_start, Headers}}, {http, {RequestId, stream, + BinBodyPart}}, {http, {RequestId, stream_end, Headers}}</c>. When streaming to to the calling processes using the option <c>{self, once}</c> the first message will have an additional - element e.i. <c>{http, {RequestId, stream_start, Headers, Pid}</c>, + element e.i. <c>{http, {RequestId, stream_start, Headers, Pid}}</c>, this is the process id that should be used as an argument to <c>http:stream_next/1</c> to trigger the next message to be sent to the calling process. </p> diff --git a/lib/inets/doc/src/httpd.xml b/lib/inets/doc/src/httpd.xml index 8438961511..4210aea3ec 100644 --- a/lib/inets/doc/src/httpd.xml +++ b/lib/inets/doc/src/httpd.xml @@ -251,14 +251,14 @@ </item> <marker id="prop_max_uri"></marker> - <tag>{max_uri, integer()}</tag> + <tag>{max_uri_size, integer()}</tag> <item> <p>Limits the size of the HTTP request URI. By default there is no limit. </p> </item> <marker id="prop_max_keep_alive_req"></marker> - <tag>{max_keep_alive_requests, integer()}</tag> + <tag>{max_keep_alive_request, integer()}</tag> <item> <p>The number of request that a client can do on one connection. When the server has responded to the number of @@ -406,7 +406,7 @@ bytes begins with url-path is mapped to local files that begins with directory-filename, for example: - <code>{alias, {"/image", "/ftp/pub/image"}</code> + <code>{alias, {"/image", "/ftp/pub/image"}}</code> and an access to http://your.server.org/image/foo.gif would refer to the file /ftp/pub/image/foo.gif. </p> @@ -421,7 +421,7 @@ bytes by re:replace/3 to produce a path in the local filesystem. For example: - <code>{re_write, {"^/[~]([^/]+)(.*)$", "/home/\\1/public\\2"}</code> + <code>{re_write, {"^/[~]([^/]+)(.*)$", "/home/\\1/public\\2"}}</code> and an access to http://your.server.org/~bob/foo.gif would refer to the file /home/bob/public/foo.gif. @@ -468,7 +468,7 @@ bytes scripts. URLs with a path beginning with url-path are mapped to scripts beginning with directory-filename, for example: - <code>{script_alias, {"/cgi-bin/", "/web/cgi-bin/"}</code> + <code>{script_alias, {"/cgi-bin/", "/web/cgi-bin/"}}</code> and an access to http://your.server.org/cgi-bin/foo would cause the server to run the script /web/cgi-bin/foo. </p> @@ -483,7 +483,7 @@ bytes scripts. URLs with a path beginning with url-path are mapped to scripts beginning with directory-filename, for example: - <code>{script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}</code> + <code>{script_re_write, {"^/cgi-bin/(\\d+)/", "/web/\\1/cgi-bin/"}}</code> and an access to http://your.server.org/cgi-bin/17/foo would cause the server to run the script /web/17/cgi-bin/foo. </p> @@ -517,7 +517,7 @@ bytes the standard CGI PATH_INFO and PATH_TRANSLATED environment variables. - <code>{action, {"text/plain", "/cgi-bin/log_and_deliver_text"}</code> + <code>{action, {"text/plain", "/cgi-bin/log_and_deliver_text"}}</code> </p> </item> @@ -532,7 +532,7 @@ bytes the standard CGI PATH_INFO and PATH_TRANSLATED environment variables. - <code>{script, {"PUT", "/cgi-bin/put"}</code> + <code>{script, {"PUT", "/cgi-bin/put"}}</code> </p> </item> @@ -549,7 +549,7 @@ bytes scheme scripts. A matching URL is mapped into a specific module and function. For example: - <code>{erl_script_alias, {"/cgi-bin/example", [httpd_example]} + <code>{erl_script_alias, {"/cgi-bin/example", [httpd_example]}} </code> and a request to @@ -632,7 +632,7 @@ bytes </item> <marker id="prop_edlog"></marker> - <tag>{error_disk_log, internal | external}</tag> + <tag>{error_disk_log, path()}</tag> <item> <p>Defines the filename of the (disk_log(3)) error log file to be used to log server errors. If the filename does not begin @@ -706,7 +706,7 @@ bytes For example: - <code>{allow_from, ["123.34.56.11", "150.100.23"] </code> + <code>{allow_from, ["123.34.56.11", "150.100.23"]}</code> The host 123.34.56.11 and all machines on the 150.100.23 subnet are allowed access. </p> @@ -719,7 +719,7 @@ bytes which should be denied access to a given directory. For example: - <code>{deny_from, ["123.34.56.11", "150.100.23"] </code> + <code>{deny_from, ["123.34.56.11", "150.100.23"]}</code> The host 123.34.56.11 and all machines on the 150.100.23 subnet are not allowed access. </p> @@ -835,7 +835,7 @@ bytes <p><em>Security properties - requires mod_security </em></p> <marker id="prop_sec_dir"></marker> - <p><em>{security_directory, {path(), [{property(), term()}]}</em></p> + <p><em>{security_directory, {path(), [{property(), term()}]}}</em></p> <marker id="props_sdir"></marker> <p>Here follows the valid properties for security directories</p> @@ -1067,7 +1067,7 @@ bytes <fsummary>Called for each request to the Web server.</fsummary> <type> <v>OldData = list()</v> - <v>NewData = [{response,{StatusCode,Body}}] | [{response,{response,Head,Body}}] | [{response,{already_sent,Statuscode,Size}] </v> + <v>NewData = [{response,{StatusCode,Body}}] | [{response,{response,Head,Body}}] | [{response,{already_sent,Statuscode,Size}}] </v> <v>StausCode = integer()</v> <v>Body = io_list() | nobody | {Fun, Arg}</v> <v>Head = [HeaderOption]</v> diff --git a/lib/inets/doc/src/httpd_util.xml b/lib/inets/doc/src/httpd_util.xml index 9f290084d2..9218ee91e2 100644 --- a/lib/inets/doc/src/httpd_util.xml +++ b/lib/inets/doc/src/httpd_util.xml @@ -337,10 +337,10 @@ <func> <name>rfc1123_date() -> RFC1123Date</name> - <name>rfc1123_date({{YYYY,MM,DD},{Hour,Min,Sec}}}) -> RFC1123Date</name> + <name>rfc1123_date({{YYYY,MM,DD},{Hour,Min,Sec}}) -> RFC1123Date</name> <fsummary>Return the current date in RFC 1123 format.</fsummary> <type> - <v>YYYY = MM = DD = Hour = Min =Sec = integer()</v> + <v>YYYY = MM = DD = Hour = Min = Sec = integer()</v> <v>RFC1123Date = string()</v> </type> <desc> diff --git a/lib/inets/doc/src/mod_alias.xml b/lib/inets/doc/src/mod_alias.xml index 265a1b8e76..b38be5db28 100644 --- a/lib/inets/doc/src/mod_alias.xml +++ b/lib/inets/doc/src/mod_alias.xml @@ -118,7 +118,7 @@ </func> <func> - <name>real_script_name(ConfigDB,RequestURI,ScriptAliases) -> Ret</name> + <name>real_script_name(ConfigDB, RequestURI, ScriptAliases) -> Ret</name> <fsummary>Expand a request uri using ScriptAlias config directives.</fsummary> <type> <v>ConfigDB = config_db()</v> @@ -129,7 +129,7 @@ </type> <desc> <marker id="real_script_name"></marker> - <p><c>real_name/3</c> traverses <c>ScriptAliases</c>, + <p><c>real_script_name/3</c> traverses <c>ScriptAliases</c>, typically extracted from <c>ConfigDB</c>, and matches each <c>FakeName</c> with <c>RequestURI</c>. If a match is found <c>FakeName</c> is replaced with <c>RealName</c> in the diff --git a/lib/inets/doc/src/notes_history.xml b/lib/inets/doc/src/notes_history.xml index bd59c1ba47..4162ab97bb 100644 --- a/lib/inets/doc/src/notes_history.xml +++ b/lib/inets/doc/src/notes_history.xml @@ -834,7 +834,7 @@ <list type="bulleted"> <item> <p>[ftp, client] - A new option {progress, {CBmodule, - CBFunction, InitProgressTerm} has been added to allow + CBFunction, InitProgressTerm}} has been added to allow users to create things such as progress bars in there GUI's. The option affects ftp:send/[3,4] and ftp:recv/[3,4].</p> diff --git a/lib/inets/src/ftp/ftp.erl b/lib/inets/src/ftp/ftp.erl index 132a384a49..5d9887a9a4 100644 --- a/lib/inets/src/ftp/ftp.erl +++ b/lib/inets/src/ftp/ftp.erl @@ -1417,7 +1417,7 @@ handle_info({'DOWN', _Ref, _Type, Process, Reason}, State) -> handle_info({'EXIT', Pid, Reason}, #state{progress = Pid} = State) -> Report = io_lib:format("Progress reporting stopped for reason ~p~n", - Reason), + [Reason]), error_logger:info_report(Report), {noreply, State#state{progress = ignore}}; diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl index 41bba7995e..4d7023a8e9 100644 --- a/lib/inets/src/http_client/httpc.erl +++ b/lib/inets/src/http_client/httpc.erl @@ -175,7 +175,7 @@ request(Method, request(Method, {Url, Headers, ContentType, Body}, HTTPOptions, Options, Profile) - when ((Method =:= post) orelse (Method =:= put)) andalso + when ((Method =:= post) orelse (Method =:= put) orelse (Method =:= delete)) andalso (is_atom(Profile) orelse is_pid(Profile)) -> ?hcrt("request", [{method, Method}, {url, Url}, 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/httpc_proxy_SUITE.erl b/lib/inets/test/httpc_proxy_SUITE.erl index 84db39e76b..ddd23d0c65 100644 --- a/lib/inets/test/httpc_proxy_SUITE.erl +++ b/lib/inets/test/httpc_proxy_SUITE.erl @@ -69,6 +69,7 @@ local_proxy_cases() -> http_post, http_put, http_delete, + http_delete_body, http_headers, http_proxy_auth, http_doesnotexist, @@ -262,6 +263,22 @@ http_delete(Config) when is_list(Config) -> %%-------------------------------------------------------------------- +http_delete_body(doc) -> + ["Perform a DELETE request with a content body. The server will not allow it " + "but we only test sending the request."]; +http_delete_body(Config) when is_list(Config) -> + Method = delete, + URL = url("/delete.html", Config), + Content = "foo=bar", + Request = {URL,[],"application/x-www-form-urlencoded",Content}, + HttpOpts = [], + Opts = [], + {ok,{{_,405,_},[_|_],[_|_]}} = + httpc:request(Method, Request, HttpOpts, Opts), + ok. + +%%-------------------------------------------------------------------- + http_headers(doc) -> ["Use as many request headers as possible"]; http_headers(Config) when is_list(Config) -> 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). %%------------------------------------------------------------------------- %%------------------------------------------------------------------------- |