Browse Source

Remove more old_http_SUITE tests

Loïc Hoguin 7 years ago
parent
commit
5cb244eb7a
2 changed files with 24 additions and 30 deletions
  1. 1 28
      test/old_http_SUITE.erl
  2. 23 2
      test/rfc7230_SUITE.erl

+ 1 - 28
test/old_http_SUITE.erl

@@ -123,24 +123,6 @@ check_raw_status(Config) ->
 	Huge = [$0 || _ <- lists:seq(1, 5000)],
 	Huge = [$0 || _ <- lists:seq(1, 5000)],
 	HugeCookie = lists:flatten(["whatever_man_biiiiiiiiiiiig_cookie_me_want_77="
 	HugeCookie = lists:flatten(["whatever_man_biiiiiiiiiiiig_cookie_me_want_77="
 		"Wed Apr 06 2011 10:38:52 GMT-0500 (CDT)" || _ <- lists:seq(1, 40)]),
 		"Wed Apr 06 2011 10:38:52 GMT-0500 (CDT)" || _ <- lists:seq(1, 40)]),
-	ResponsePacket =
-"HTTP/1.0 302 Found\r
-Location: http://www.google.co.il/\r
-Cache-Control: private\r
-Content-Type: text/html; charset=UTF-8\r
-Set-Cookie: PREF=ID=568f67013d4a7afa:FF=0:TM=1323014101:LM=1323014101:S=XqctDWC65MzKT0zC; expires=Tue, 03-Dec-2013 15:55:01 GMT; path=/; domain=.google.com\r
-Date: Sun, 04 Dec 2011 15:55:01 GMT\r
-Server: gws\r
-Content-Length: 221\r
-X-XSS-Protection: 1; mode=block\r
-X-Frame-Options: SAMEORIGIN\r
-\r
-<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">
-<TITLE>302 Moved</TITLE></HEAD><BODY>
-<H1>302 Moved</H1>
-The document has moved
-<A HREF=\"http://www.google.co.il/\">here</A>.
-</BODY></HTML>",
 	Tests = [
 	Tests = [
 		{200, ["GET / HTTP/1.0\r\nHost: localhost\r\n"
 		{200, ["GET / HTTP/1.0\r\nHost: localhost\r\n"
 			"Set-Cookie: ", HugeCookie, "\r\n\r\n"]},
 			"Set-Cookie: ", HugeCookie, "\r\n\r\n"]},
@@ -153,15 +135,7 @@ The document has moved
 		{400, "GET / HTTP/1.1\r\nHost: ninenines.eu\r\n\r\n"},
 		{400, "GET / HTTP/1.1\r\nHost: ninenines.eu\r\n\r\n"},
 		{400, "GET http://proxy/ HTTP/1.1\r\n\r\n"},
 		{400, "GET http://proxy/ HTTP/1.1\r\n\r\n"},
 		{400, "GET / HTTP/1.1\r\nHost: localhost:bad_port\r\n\r\n"},
 		{400, "GET / HTTP/1.1\r\nHost: localhost:bad_port\r\n\r\n"},
-		{400, ResponsePacket},
-		{408, "GET / HTTP/1.1\r\nHost: localhost"},
-		{408, "GET / HTTP/1.1\r\nHost: localhost\r\n"},
-		{408, "GET / HTTP/1.1\r\nHost: localhost\r\n\r"},
-		{closed, Huge},
-		{closed, ""},
-		{closed, "\r\n"},
-		{closed, "\r\n\r\n"},
-		{closed, "GET / HTTP/1.1"}
+		{closed, Huge}
 	],
 	],
 	_ = [{Status, Packet} = begin
 	_ = [{Status, Packet} = begin
 		Ret = do_raw(Packet, Config),
 		Ret = do_raw(Packet, Config),
@@ -171,7 +145,6 @@ The document has moved
 
 
 check_status(Config) ->
 check_status(Config) ->
 	Tests = [
 	Tests = [
-		{200, "/"},
 		{200, "/simple"},
 		{200, "/simple"},
 		{404, "/not/found"},
 		{404, "/not/found"},
 		{500, "/handler_errors?case=init_before_reply"}
 		{500, "/handler_errors?case=init_before_reply"}

+ 23 - 2
test/rfc7230_SUITE.erl

@@ -148,8 +148,29 @@ timeout_after_request_line(Config) ->
 	doc("The time the request (request line and headers) takes to be "
 	doc("The time the request (request line and headers) takes to be "
 		"received by the server must be limited and subject to configuration. "
 		"received by the server must be limited and subject to configuration. "
 		"A 408 status code must be sent if the request line was received."),
 		"A 408 status code must be sent if the request line was received."),
-	#{code := 408, client := Client} = do_raw(Config, "GET / HTTP/1.1\r\n"),
-	{error, closed} = raw_recv(Client, 0, 6000).
+	#{code := 408, client := Client1} = do_raw(Config, "GET / HTTP/1.1\r\n"),
+	{error, closed} = raw_recv(Client1, 0, 6000).
+
+timeout_after_request_line_host(Config) ->
+	doc("The time the request (request line and headers) takes to be "
+		"received by the server must be limited and subject to configuration. "
+		"A 408 status code must be sent if the request line was received."),
+	#{code := 408, client := Client2} = do_raw(Config, "GET / HTTP/1.1\r\nHost: localhost"),
+	{error, closed} = raw_recv(Client2, 0, 6000).
+
+timeout_after_request_line_host_crlf(Config) ->
+	doc("The time the request (request line and headers) takes to be "
+		"received by the server must be limited and subject to configuration. "
+		"A 408 status code must be sent if the request line was received."),
+	#{code := 408, client := Client3} = do_raw(Config, "GET / HTTP/1.1\r\nHost: localhost\r\n"),
+	{error, closed} = raw_recv(Client3, 0, 6000).
+
+timeout_after_request_line_host_crlfcr(Config) ->
+	doc("The time the request (request line and headers) takes to be "
+		"received by the server must be limited and subject to configuration. "
+		"A 408 status code must be sent if the request line was received."),
+	#{code := 408, client := Client4} = do_raw(Config, "GET / HTTP/1.1\r\nHost: localhost\r\n\r"),
+	{error, closed} = raw_recv(Client4, 0, 6000).
 
 
 %% @todo Add an HTTP/1.0 test suite.
 %% @todo Add an HTTP/1.0 test suite.
 %An HTTP/1.1 server must understand any valid HTTP/1.0 request,
 %An HTTP/1.1 server must understand any valid HTTP/1.0 request,