| 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" |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 // Do any actions based on current state | 442 // Do any actions based on current state |
| 443 switch (state) { | 443 switch (state) { |
| 444 case ST_METHOD: | 444 case ST_METHOD: |
| 445 case ST_URL: | 445 case ST_URL: |
| 446 case ST_PROTO: | 446 case ST_PROTO: |
| 447 case ST_VALUE: | 447 case ST_VALUE: |
| 448 case ST_NAME: | 448 case ST_NAME: |
| 449 buffer.append(&ch, 1); | 449 buffer.append(&ch, 1); |
| 450 break; | 450 break; |
| 451 case ST_DONE: | 451 case ST_DONE: |
| 452 DCHECK(input == INPUT_LF); | 452 // We got CR to get this far, also need the LF |
| 453 return true; | 453 return (input == INPUT_LF); |
| 454 case ST_ERR: | 454 case ST_ERR: |
| 455 return false; | 455 return false; |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 // No more characters, but we haven't finished parsing yet. Signal this to | 459 // No more characters, but we haven't finished parsing yet. Signal this to |
| 460 // the caller by setting |pos| to zero. | 460 // the caller by setting |pos| to zero. |
| 461 pos = 0; | 461 pos = 0; |
| 462 return true; | 462 return true; |
| 463 } | 463 } |
| 464 | 464 |
| 465 HttpConnection* HttpServer::FindConnection(int connection_id) { | 465 HttpConnection* HttpServer::FindConnection(int connection_id) { |
| 466 auto it = id_to_connection_.find(connection_id); | 466 auto it = id_to_connection_.find(connection_id); |
| 467 if (it == id_to_connection_.end()) | 467 if (it == id_to_connection_.end()) |
| 468 return nullptr; | 468 return nullptr; |
| 469 return it->second.get(); | 469 return it->second.get(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 // 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() |
| 473 // has been called during callback processing. Using the pointer of connection, | 473 // has been called during callback processing. Using the pointer of connection, |
| 474 // |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 |
| 475 // loop. | 475 // loop. |
| 476 bool HttpServer::HasClosedConnection(HttpConnection* connection) { | 476 bool HttpServer::HasClosedConnection(HttpConnection* connection) { |
| 477 return FindConnection(connection->id()) != connection; | 477 return FindConnection(connection->id()) != connection; |
| 478 } | 478 } |
| 479 | 479 |
| 480 } // namespace net | 480 } // namespace net |
| OLD | NEW |