OLD | NEW |
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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | |
18 #include "base/sys_byteorder.h" | 17 #include "base/sys_byteorder.h" |
19 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
20 #include "build/build_config.h" | 19 #include "build/build_config.h" |
21 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
22 #include "net/server/http_connection.h" | 21 #include "net/server/http_connection.h" |
23 #include "net/server/http_server_request_info.h" | 22 #include "net/server/http_server_request_info.h" |
24 #include "net/server/http_server_response_info.h" | 23 #include "net/server/http_server_response_info.h" |
25 #include "net/server/web_socket.h" | 24 #include "net/server/web_socket.h" |
26 #include "net/socket/server_socket.h" | 25 #include "net/socket/server_socket.h" |
27 #include "net/socket/stream_socket.h" | 26 #include "net/socket/stream_socket.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 /* PROTOCOL */ {ST_ERR, ST_HEADER, ST_NAME, ST_ERR, ST_PROTO}, | 360 /* PROTOCOL */ {ST_ERR, ST_HEADER, ST_NAME, ST_ERR, ST_PROTO}, |
362 /* HEADER */ {ST_ERR, ST_ERR, ST_NAME, ST_ERR, ST_ERR}, | 361 /* HEADER */ {ST_ERR, ST_ERR, ST_NAME, ST_ERR, ST_ERR}, |
363 /* NAME */ {ST_SEPARATOR, ST_DONE, ST_ERR, ST_VALUE, ST_NAME}, | 362 /* NAME */ {ST_SEPARATOR, ST_DONE, ST_ERR, ST_VALUE, ST_NAME}, |
364 /* SEPARATOR */ {ST_SEPARATOR, ST_ERR, ST_ERR, ST_VALUE, ST_ERR}, | 363 /* SEPARATOR */ {ST_SEPARATOR, ST_ERR, ST_ERR, ST_VALUE, ST_ERR}, |
365 /* VALUE */ {ST_VALUE, ST_HEADER, ST_NAME, ST_VALUE, ST_VALUE}, | 364 /* VALUE */ {ST_VALUE, ST_HEADER, ST_NAME, ST_VALUE, ST_VALUE}, |
366 /* DONE */ {ST_DONE, ST_DONE, ST_DONE, ST_DONE, ST_DONE}, | 365 /* DONE */ {ST_DONE, ST_DONE, ST_DONE, ST_DONE, ST_DONE}, |
367 /* ERR */ {ST_ERR, ST_ERR, ST_ERR, ST_ERR, ST_ERR}}; | 366 /* ERR */ {ST_ERR, ST_ERR, ST_ERR, ST_ERR, ST_ERR}}; |
368 | 367 |
369 // Convert an input character to the parser's input token. | 368 // Convert an input character to the parser's input token. |
370 int charToInput(char ch) { | 369 int charToInput(char ch) { |
371 switch(ch) { | 370 switch (ch) { |
372 case ' ': | 371 case ' ': |
373 case '\t': | 372 case '\t': |
374 return INPUT_LWS; | 373 return INPUT_LWS; |
375 case '\r': | 374 case '\r': |
376 return INPUT_CR; | 375 return INPUT_CR; |
377 case '\n': | 376 case '\n': |
378 return INPUT_LF; | 377 return INPUT_LF; |
379 case ':': | 378 case ':': |
380 return INPUT_COLON; | 379 return INPUT_COLON; |
381 } | 380 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 471 |
473 // This is called after any delegate callbacks are called to check if Close() | 472 // This is called after any delegate callbacks are called to check if Close() |
474 // has been called during callback processing. Using the pointer of connection, | 473 // has been called during callback processing. Using the pointer of connection, |
475 // |connection| is safe here because Close() deletes the connection in next run | 474 // |connection| is safe here because Close() deletes the connection in next run |
476 // loop. | 475 // loop. |
477 bool HttpServer::HasClosedConnection(HttpConnection* connection) { | 476 bool HttpServer::HasClosedConnection(HttpConnection* connection) { |
478 return FindConnection(connection->id()) != connection; | 477 return FindConnection(connection->id()) != connection; |
479 } | 478 } |
480 | 479 |
481 } // namespace net | 480 } // namespace net |
OLD | NEW |