Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: net/server/http_server.cc

Issue 265603002: Revert of HttpServer: avoid DCHECK'ing on non-HTTP/1.1 requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_util.cc ('k') | net/server/http_server_request_info.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/server/http_server.h" 5 #include "net/server/http_server.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/sys_byteorder.h" 13 #include "base/sys_byteorder.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/http/http_util.h"
17 #include "net/server/http_connection.h" 16 #include "net/server/http_connection.h"
18 #include "net/server/http_server_request_info.h" 17 #include "net/server/http_server_request_info.h"
19 #include "net/server/http_server_response_info.h" 18 #include "net/server/http_server_response_info.h"
20 #include "net/server/web_socket.h" 19 #include "net/server/web_socket.h"
21 #include "net/socket/tcp_listen_socket.h" 20 #include "net/socket/tcp_listen_socket.h"
22 21
23 namespace net { 22 namespace net {
24 23
25 HttpServer::HttpServer(const StreamListenSocketFactory& factory, 24 HttpServer::HttpServer(const StreamListenSocketFactory& factory,
26 HttpServer::Delegate* delegate) 25 HttpServer::Delegate* delegate)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 switch (state) { 275 switch (state) {
277 case ST_METHOD: 276 case ST_METHOD:
278 info->method = buffer; 277 info->method = buffer;
279 buffer.clear(); 278 buffer.clear();
280 break; 279 break;
281 case ST_URL: 280 case ST_URL:
282 info->path = buffer; 281 info->path = buffer;
283 buffer.clear(); 282 buffer.clear();
284 break; 283 break;
285 case ST_PROTO: 284 case ST_PROTO:
286 if (!HttpUtil::ParseVersion(buffer, &info->http_version)) { 285 // TODO(mbelshe): Deal better with parsing protocol.
287 // Treat everything else like HTTP 1.0 286 DCHECK(buffer == "HTTP/1.1");
288 info->http_version = HttpVersion(1, 0);
289 }
290 buffer.clear(); 287 buffer.clear();
291 break; 288 break;
292 case ST_NAME: 289 case ST_NAME:
293 header_name = StringToLowerASCII(buffer); 290 header_name = StringToLowerASCII(buffer);
294 buffer.clear(); 291 buffer.clear();
295 break; 292 break;
296 case ST_VALUE: 293 case ST_VALUE:
297 base::TrimWhitespaceASCII(buffer, base::TRIM_LEADING, &header_value); 294 base::TrimWhitespaceASCII(buffer, base::TRIM_LEADING, &header_value);
298 // TODO(mbelshe): Deal better with duplicate headers 295 // TODO(mbelshe): Deal better with duplicate headers
299 DCHECK(info->headers.find(header_name) == info->headers.end()); 296 DCHECK(info->headers.find(header_name) == info->headers.end());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 331 }
335 332
336 HttpConnection* HttpServer::FindConnection(StreamListenSocket* socket) { 333 HttpConnection* HttpServer::FindConnection(StreamListenSocket* socket) {
337 SocketToConnectionMap::iterator it = socket_to_connection_.find(socket); 334 SocketToConnectionMap::iterator it = socket_to_connection_.find(socket);
338 if (it == socket_to_connection_.end()) 335 if (it == socket_to_connection_.end())
339 return NULL; 336 return NULL;
340 return it->second; 337 return it->second;
341 } 338 }
342 339
343 } // namespace net 340 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_util.cc ('k') | net/server/http_server_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698