diff options
author | Ingela Anderton Andin <ingela@erlang.org> | 2019-09-10 09:17:03 +0200 |
---|---|---|
committer | Ingela Anderton Andin <ingela@erlang.org> | 2019-09-10 09:17:03 +0200 |
commit | cad66215d2189eb7382850670de3c3d4a4444c7e (patch) | |
tree | abe24a3f4790026b11e784a5924e63dd90a23fc6 | |
parent | 4632d42c74e23aa6aa5873141a3138ac086cf124 (diff) | |
parent | 9e8bfabbb77ab182fb48abd284b9a8794b787011 (diff) | |
download | erlang-cad66215d2189eb7382850670de3c3d4a4444c7e.tar.gz |
Merge branch 'maint'
-rw-r--r-- | lib/inets/src/http_server/mod_esi.erl | 22 | ||||
-rw-r--r-- | lib/inets/test/httpd_SUITE.erl | 28 | ||||
-rw-r--r-- | lib/ssl/src/ssl_handshake.erl | 2 |
3 files changed, 37 insertions, 15 deletions
diff --git a/lib/inets/src/http_server/mod_esi.erl b/lib/inets/src/http_server/mod_esi.erl index 8cbd9798e6..bcf392d55c 100644 --- a/lib/inets/src/http_server/mod_esi.erl +++ b/lib/inets/src/http_server/mod_esi.erl @@ -345,12 +345,12 @@ erl_scheme_webpage_whole(Mod, Func, Env, Input, ModData) -> integer_to_list(Length)}| NewHeaders]), case ModData#mod.method of "HEAD" -> - {proceed, [{response, {already_sent, 200, 0}} | + {proceed, [{response, {already_sent, StatusCode, 0}} | ModData#mod.data]}; _ -> httpd_response:send_body(ModData, StatusCode, Body), - {proceed, [{response, {already_sent, 200, + {proceed, [{response, {already_sent, StatusCode, Length}} | ModData#mod.data]} end @@ -415,12 +415,12 @@ deliver_webpage_chunk(#mod{config_db = Db} = ModData, Pid, Timeout) -> [{"transfer-encoding", "chunked"} | NewHeaders]) end, - handle_body(Pid, ModData, Body, Timeout, length(Body), + handle_body(Pid, ModData, Body, Timeout, length(Body), StatusCode, IsDisableChunkedSend); timeout -> send_headers(ModData, 504, [{"connection", "close"}]), httpd_socket:close(ModData#mod.socket_type, ModData#mod.socket), - {proceed,[{response, {already_sent, 200, 0}} | ModData#mod.data]} + {proceed,[{response, {already_sent, 504, 0}} | ModData#mod.data]} end. receive_headers(Timeout) -> @@ -444,24 +444,24 @@ send_headers(ModData, StatusCode, HTTPHeaders) -> httpd_response:send_header(ModData, StatusCode, ExtraHeaders ++ HTTPHeaders). -handle_body(_, #mod{method = "HEAD"} = ModData, _, _, Size, _) -> - {proceed, [{response, {already_sent, 200, Size}} | ModData#mod.data]}; +handle_body(_, #mod{method = "HEAD"} = ModData, _, _, Size, StatusCode, _) -> + {proceed, [{response, {already_sent, StatusCode, Size}} | ModData#mod.data]}; -handle_body(Pid, ModData, Body, Timeout, Size, IsDisableChunkedSend) -> +handle_body(Pid, ModData, Body, Timeout, Size, StatusCode, IsDisableChunkedSend) -> httpd_response:send_chunk(ModData, Body, IsDisableChunkedSend), receive {esi_data, Data} when is_binary(Data) -> - handle_body(Pid, ModData, Data, Timeout, Size + byte_size(Data), + handle_body(Pid, ModData, Data, Timeout, Size + byte_size(Data), StatusCode, IsDisableChunkedSend); {esi_data, Data} -> - handle_body(Pid, ModData, Data, Timeout, Size + length(Data), + handle_body(Pid, ModData, Data, Timeout, Size + length(Data), StatusCode, IsDisableChunkedSend); {ok, Data} -> - handle_body(Pid, ModData, Data, Timeout, Size + length(Data), + handle_body(Pid, ModData, Data, Timeout, Size + length(Data), StatusCode, IsDisableChunkedSend); {'EXIT', Pid, normal} when is_pid(Pid) -> httpd_response:send_final_chunk(ModData, IsDisableChunkedSend), - {proceed, [{response, {already_sent, 200, Size}} | + {proceed, [{response, {already_sent, StatusCode, Size}} | ModData#mod.data]}; {'EXIT', Pid, Reason} when is_pid(Pid) -> Error = lists:flatten(io_lib:format("mod_esi process failed with reason ~p", [Reason])), diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl index fc5ca14dcd..bf926ec9c1 100644 --- a/lib/inets/test/httpd_SUITE.erl +++ b/lib/inets/test/httpd_SUITE.erl @@ -28,6 +28,7 @@ -include_lib("kernel/include/file.hrl"). -include_lib("common_test/include/ct.hrl"). -include_lib("public_key/include/public_key.hrl"). +-include_lib("inets/include/httpd.hrl"). -include("inets_test_lib.hrl"). %% Note: This directive should only be used in test suites. @@ -58,6 +59,7 @@ all() -> {group, https_limit}, {group, http_custom}, {group, https_custom}, + {group, https_custom}, {group, http_basic_auth}, {group, https_basic_auth}, {group, http_auth_api}, @@ -139,7 +141,7 @@ groups() -> {http_1_1, [], [host, chunked, expect, cgi, cgi_chunked_encoding_test, trace, range, if_modified_since, mod_esi_chunk_timeout, - esi_put, esi_post] ++ http_head() ++ http_get() ++ load()}, + esi_put, esi_post, esi_proagate] ++ http_head() ++ http_get() ++ load()}, {http_1_0, [], [host, cgi, trace] ++ http_head() ++ http_get() ++ load()}, {http_0_9, [], http_head() ++ http_get() ++ load()}, {http_rel_path_script_alias, [], [cgi]}, @@ -1053,6 +1055,17 @@ mod_esi_chunk_timeout(Config) when is_list(Config) -> proplists:get_value(port, Config), proplists:get_value(host, Config), proplists:get_value(node, Config)). +%%------------------------------------------------------------------------- +esi_proagate(Config) when is_list(Config) -> + register(propagate_test, self()), + ok = http_status("GET /cgi-bin/erl/httpd_example:new_status_and_location ", + Config, [{statuscode, 201}]), + receive + {status, 201} -> + ok; + Err -> + ct:fail(Err) + end. %%------------------------------------------------------------------------- cgi() -> @@ -2246,8 +2259,17 @@ head_status(_) -> basic_conf() -> [{modules, [mod_alias, mod_range, mod_responsecontrol, - mod_trace, mod_esi, mod_cgi, mod_get, mod_head]}]. - + mod_trace, mod_esi, ?MODULE, mod_cgi, mod_get, mod_head]}]. +do(ModData) -> + case whereis(propagate_test) of + undefined -> + ok; + _ -> + {already_sent, Status, _Size} = proplists:get_value(response, ModData#mod.data), + propagate_test ! {status, Status} + end, + {proceed, ModData#mod.data}. + not_sup_conf() -> [{modules, [mod_get]}]. diff --git a/lib/ssl/src/ssl_handshake.erl b/lib/ssl/src/ssl_handshake.erl index 1c8a2ca452..a407694617 100644 --- a/lib/ssl/src/ssl_handshake.erl +++ b/lib/ssl/src/ssl_handshake.erl @@ -724,7 +724,7 @@ encode_extensions([#psk_key_exchange_modes{ke_modes = KEModes0} | Rest], Acc) -> encode_extensions([#pre_shared_key_client_hello{ offered_psks = #offered_psks{ identities = Identities0, - binders = Binders0} = PSKs} | Rest], Acc) -> + binders = Binders0}} | Rest], Acc) -> Identities = encode_psk_identities(Identities0), Binders = encode_psk_binders(Binders0), Len = byte_size(Identities) + byte_size(Binders), |