diff options
author | Boris Pozdnyakov <[email protected]> | 2023-02-17 16:34:54 +0400 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2023-12-15 17:12:37 +0100 |
commit | e2002721784a8c4fa0cb1486eb88438c92d8a251 (patch) | |
tree | 19b43d2c906a97bbadbeec6b543db1b64a2073cb /test | |
parent | 1547e9b93e9a2b40e03edc6e84015dcbf9dccadb (diff) | |
download | cowboy-e2002721784a8c4fa0cb1486eb88438c92d8a251.tar.gz cowboy-e2002721784a8c4fa0cb1486eb88438c92d8a251.tar.bz2 cowboy-e2002721784a8c4fa0cb1486eb88438c92d8a251.zip |
Reject invalid Connection header
LH: Small tweaks and added an HTTP/1.0 test.
Diffstat (limited to 'test')
-rw-r--r-- | test/rfc7230_SUITE.erl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/rfc7230_SUITE.erl b/test/rfc7230_SUITE.erl index 9846a0f..ed3fff3 100644 --- a/test/rfc7230_SUITE.erl +++ b/test/rfc7230_SUITE.erl @@ -1512,6 +1512,28 @@ http10_no_connection_header_close(Config) -> {_, <<"close">>} = lists:keyfind(<<"connection">>, 1, RespHeaders), {error, closed} = raw_recv(Client, 0, 1000). +connection_invalid(Config) -> + doc("HTTP/1.1 requests with an invalid Connection header " + "must be rejected with a 400 status code and the closing " + "of the connection. (RFC7230 6.1)"), + #{code := 400, client := Client} = do_raw(Config, [ + "GET / HTTP/1.1\r\n" + "Host: localhost\r\n" + "Connection: jndi{ldap127\r\n" + "\r\n"]), + {error, closed} = raw_recv(Client, 0, 1000). + +http10_connection_invalid(Config) -> + doc("HTTP/1.0 requests with an invalid Connection header " + "must be rejected with a 400 status code and the closing " + "of the connection. (RFC7230 6.1)"), + #{code := 400, client := Client} = do_raw(Config, [ + "GET / HTTP/1.0\r\n" + "Host: localhost\r\n" + "Connection: jndi{ldap127\r\n" + "\r\n"]), + {error, closed} = raw_recv(Client, 0, 1000). + limit_requests_keepalive(Config) -> doc("The maximum number of requests sent using a persistent connection " "must be subject to configuration. The connection must be closed " |