aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-02-27 11:41:05 +0100
committerLoïc Hoguin <[email protected]>2020-02-27 11:41:05 +0100
commitbbb6e57123ca12ad18e88f4a6e28b866afa3ed5a (patch)
tree475d192a0e32c7eba53300492f0a460cbe991cfe
parente7852121a01e511b002e3af2851b7b8780ca1902 (diff)
downloadcowlib-bbb6e57123ca12ad18e88f4a6e28b866afa3ed5a.tar.gz
cowlib-bbb6e57123ca12ad18e88f4a6e28b866afa3ed5a.tar.bz2
cowlib-bbb6e57123ca12ad18e88f4a6e28b866afa3ed5a.zip
Clarify error when expecting a SETTINGS frame in HTTP/2 preface
The error was appropriate for server mode, but not for client mode, because the server does not send the preface sequence.
-rw-r--r--src/cow_http2_machine.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cow_http2_machine.erl b/src/cow_http2_machine.erl
index 3b7cd10..a88d9f1 100644
--- a/src/cow_http2_machine.erl
+++ b/src/cow_http2_machine.erl
@@ -830,9 +830,13 @@ settings_frame({settings, Settings}, State0=#http2_machine{
_ -> {ok, State2}
end;
%% We expect to receive a SETTINGS frame as part of the preface.
-settings_frame(_F, State) ->
+settings_frame(_F, State=#http2_machine{mode=server}) ->
{error, {connection_error, protocol_error,
'The preface sequence must be followed by a SETTINGS frame. (RFC7540 3.5)'},
+ State};
+settings_frame(_F, State) ->
+ {error, {connection_error, protocol_error,
+ 'The preface must begin with a SETTINGS frame. (RFC7540 3.5)'},
State}.
%% When SETTINGS_INITIAL_WINDOW_SIZE changes we need to update