| 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 #ifndef NET_SERVER_HTTP_SERVER_H_ | 5 #ifndef NET_SERVER_HTTP_SERVER_H_ |
| 6 #define NET_SERVER_HTTP_SERVER_H_ | 6 #define NET_SERVER_HTTP_SERVER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void DoReadLoop(HttpConnection* connection); | 91 void DoReadLoop(HttpConnection* connection); |
| 92 void OnReadCompleted(int connection_id, int rv); | 92 void OnReadCompleted(int connection_id, int rv); |
| 93 int HandleReadResult(HttpConnection* connection, int rv); | 93 int HandleReadResult(HttpConnection* connection, int rv); |
| 94 | 94 |
| 95 void DoWriteLoop(HttpConnection* connection); | 95 void DoWriteLoop(HttpConnection* connection); |
| 96 void OnWriteCompleted(int connection_id, int rv); | 96 void OnWriteCompleted(int connection_id, int rv); |
| 97 int HandleWriteResult(HttpConnection* connection, int rv); | 97 int HandleWriteResult(HttpConnection* connection, int rv); |
| 98 | 98 |
| 99 // Expects the raw data to be stored in recv_data_. If parsing is successful, | 99 // Expects the raw data to be stored in recv_data_. If parsing is successful, |
| 100 // will remove the data parsed from recv_data_, leaving only the unused | 100 // will remove the data parsed from recv_data_, leaving only the unused |
| 101 // recv data. | 101 // recv data. If all data has been consumed successfully, but the headers are |
| 102 // not fully parsed, *pos will be set to zero. Returns false if an error is |
| 103 // encountered while parsing, true otherwise. |
| 102 bool ParseHeaders(const char* data, | 104 bool ParseHeaders(const char* data, |
| 103 size_t data_len, | 105 size_t data_len, |
| 104 HttpServerRequestInfo* info, | 106 HttpServerRequestInfo* info, |
| 105 size_t* pos); | 107 size_t* pos); |
| 106 | 108 |
| 107 HttpConnection* FindConnection(int connection_id); | 109 HttpConnection* FindConnection(int connection_id); |
| 108 | 110 |
| 109 // Whether or not Close() has been called during delegate callback processing. | 111 // Whether or not Close() has been called during delegate callback processing. |
| 110 bool HasClosedConnection(HttpConnection* connection); | 112 bool HasClosedConnection(HttpConnection* connection); |
| 111 | 113 |
| 112 const std::unique_ptr<ServerSocket> server_socket_; | 114 const std::unique_ptr<ServerSocket> server_socket_; |
| 113 std::unique_ptr<StreamSocket> accepted_socket_; | 115 std::unique_ptr<StreamSocket> accepted_socket_; |
| 114 HttpServer::Delegate* const delegate_; | 116 HttpServer::Delegate* const delegate_; |
| 115 | 117 |
| 116 int last_id_; | 118 int last_id_; |
| 117 IdToConnectionMap id_to_connection_; | 119 IdToConnectionMap id_to_connection_; |
| 118 | 120 |
| 119 base::WeakPtrFactory<HttpServer> weak_ptr_factory_; | 121 base::WeakPtrFactory<HttpServer> weak_ptr_factory_; |
| 120 | 122 |
| 121 DISALLOW_COPY_AND_ASSIGN(HttpServer); | 123 DISALLOW_COPY_AND_ASSIGN(HttpServer); |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace net | 126 } // namespace net |
| 125 | 127 |
| 126 #endif // NET_SERVER_HTTP_SERVER_H_ | 128 #endif // NET_SERVER_HTTP_SERVER_H_ |
| OLD | NEW |