From dc52ebe4407ac917bbac127a9feae756b44ef940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 21 Nov 2018 13:28:20 +0100 Subject: Move some more tests out of the old HTTP test suite --- test/rfc7230_SUITE.erl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/rfc7230_SUITE.erl') diff --git a/test/rfc7230_SUITE.erl b/test/rfc7230_SUITE.erl index 0ef1690..fbf4da9 100644 --- a/test/rfc7230_SUITE.erl +++ b/test/rfc7230_SUITE.erl @@ -640,6 +640,15 @@ invalid_request_target(Config) -> "\r\n"), {error, closed} = raw_recv(Client, 0, 1000). +missing_request_target(Config) -> + doc("The lack of request target must be rejected with a 400 status code " + "and the closing of the connection."), + #{code := 400, client := Client} = do_raw(Config, + "GET HTTP/1.1\r\n" + "Host: localhost\r\n" + "\r\n"), + {error, closed} = raw_recv(Client, 0, 1000). + %% Between request-target and version. reject_tab_between_request_target_and_version(Config) -> @@ -1641,6 +1650,16 @@ empty_host(Config0) -> %% %% This is covered in req_SUITE in the tests for cowboy_req:uri/1,2. +reject_non_authoritative_host(Config) -> + doc("A request with a host header for which the origin server is " + "not authoritative must be rejected with a 400 status code. " + "(RFC7230 5.5, RFC7230 9.1)"), + #{code := 400} = do_raw(Config, [ + "GET / HTTP/1.1\r\n" + "Host: ninenines.eu\r\n" + "\r\n"]), + ok. + %@todo %Resources with identical URI except for the scheme component %must be treated as different. (RFC7230 2.7.2) -- cgit v1.2.3