diff options
author | Loïc Hoguin <[email protected]> | 2018-11-21 13:28:20 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-21 13:28:20 +0100 |
commit | dc52ebe4407ac917bbac127a9feae756b44ef940 (patch) | |
tree | 94e75887252eb214708a69533d09dbba4413f2ee /test/rfc7230_SUITE.erl | |
parent | 112ff607a10519004cbad5ffa0db6450a406b202 (diff) | |
download | cowboy-dc52ebe4407ac917bbac127a9feae756b44ef940.tar.gz cowboy-dc52ebe4407ac917bbac127a9feae756b44ef940.tar.bz2 cowboy-dc52ebe4407ac917bbac127a9feae756b44ef940.zip |
Move some more tests out of the old HTTP test suite
Diffstat (limited to 'test/rfc7230_SUITE.erl')
-rw-r--r-- | test/rfc7230_SUITE.erl | 19 |
1 files changed, 19 insertions, 0 deletions
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) |