diff options
author | henrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 09:00:06 +0000 |
---|---|---|
committer | henrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 09:00:06 +0000 |
commit | a9c6da42b9b686a8d545a381a7c2894225c66bae (patch) | |
tree | 3f565d5dcf3f280018e8361f4a7ffc8e46ce1802 /net/server | |
parent | bfd16cc91da9ff181a41fa6a601c6969f5366c29 (diff) | |
download | chromium_src-a9c6da42b9b686a8d545a381a7c2894225c66bae.zip chromium_src-a9c6da42b9b686a8d545a381a7c2894225c66bae.tar.gz chromium_src-a9c6da42b9b686a8d545a381a7c2894225c66bae.tar.bz2 |
Revert of HttpServer: avoid DCHECK'ing on non-HTTP/1.1 requests. (https://codereview.chromium.org/251213004/)
Reason for revert:
Speculative revert since it might cause http://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%282%29/builds/20802.
Original issue's description:
> HttpServer: avoid DCHECK'ing on non-HTTP/1.1 requests.
>
> BUG=b/14249697
> R=mef@chromium.org,byungchul@chromium.org
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=267066
TBR=byungchul@chromium.org,mef@chromium.org,gunsch@google.com,gunsch@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=b/14249697
Review URL: https://codereview.chromium.org/265603002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/server')
-rw-r--r-- | net/server/http_server.cc | 7 | ||||
-rw-r--r-- | net/server/http_server_request_info.h | 4 | ||||
-rw-r--r-- | net/server/http_server_unittest.cc | 12 |
3 files changed, 2 insertions, 21 deletions
diff --git a/net/server/http_server.cc b/net/server/http_server.cc index 20926e7..df77c36 100644 --- a/net/server/http_server.cc +++ b/net/server/http_server.cc @@ -13,7 +13,6 @@ #include "base/sys_byteorder.h" #include "build/build_config.h" #include "net/base/net_errors.h" -#include "net/http/http_util.h" #include "net/server/http_connection.h" #include "net/server/http_server_request_info.h" #include "net/server/http_server_response_info.h" @@ -283,10 +282,8 @@ bool HttpServer::ParseHeaders(HttpConnection* connection, buffer.clear(); break; case ST_PROTO: - if (!HttpUtil::ParseVersion(buffer, &info->http_version)) { - // Treat everything else like HTTP 1.0 - info->http_version = HttpVersion(1, 0); - } + // TODO(mbelshe): Deal better with parsing protocol. + DCHECK(buffer == "HTTP/1.1"); buffer.clear(); break; case ST_NAME: diff --git a/net/server/http_server_request_info.h b/net/server/http_server_request_info.h index 0376b3a..183da1c 100644 --- a/net/server/http_server_request_info.h +++ b/net/server/http_server_request_info.h @@ -9,7 +9,6 @@ #include <string> #include "net/base/ip_endpoint.h" -#include "net/http/http_version.h" namespace net { @@ -29,9 +28,6 @@ class HttpServerRequestInfo { // Request peer address. IPEndPoint peer; - // Request protocol/version - HttpVersion http_version; - // Request method. std::string method; diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc index 25a9cbc..de8690f 100644 --- a/net/server/http_server_unittest.cc +++ b/net/server/http_server_unittest.cc @@ -218,23 +218,11 @@ TEST_F(HttpServerTest, Request) { ASSERT_EQ("/test", GetRequest(0).path); ASSERT_EQ("", GetRequest(0).data); ASSERT_EQ(0u, GetRequest(0).headers.size()); - ASSERT_EQ(HttpVersion(1, 1), GetRequest(0).http_version); ASSERT_TRUE(StartsWithASCII(GetRequest(0).peer.ToString(), "127.0.0.1", true)); } -TEST_F(HttpServerTest, InvalidHttpVersion) { - TestHttpClient client; - ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); - client.Send("GET /test HTTP//1\r\n\r\n"); - ASSERT_TRUE(RunUntilRequestsReceived(1)); - ASSERT_EQ("GET", GetRequest(0).method); - ASSERT_EQ("/test", GetRequest(0).path); - ASSERT_EQ("", GetRequest(0).data); - ASSERT_EQ(HttpVersion(1, 0), GetRequest(0).http_version); -} - TEST_F(HttpServerTest, RequestWithHeaders) { TestHttpClient client; ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); |