Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 | 63 |
| 64 void DetachSocket(); | 64 void DetachSocket(); |
| 65 | 65 |
| 66 void Shift(int num_bytes); | 66 void Shift(int num_bytes); |
| 67 | 67 |
| 68 HttpServer* server_; | 68 HttpServer* server_; |
| 69 scoped_refptr<ListenSocket> socket_; | 69 scoped_refptr<ListenSocket> socket_; |
| 70 bool is_web_socket_; | 70 bool is_web_socket_; |
| 71 std::string recv_data_; | 71 std::string recv_data_; |
| 72 int id_; | 72 int id_; |
| 73 bool use_hybi10_web_socket_; | |
|
pfeldman
2011/07/28 09:32:47
We should flag legacy protocol use instead (use_hi
| |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(Connection); | 75 DISALLOW_COPY_AND_ASSIGN(Connection); |
| 75 }; | 76 }; |
| 76 friend class Connection; | 77 friend class Connection; |
| 77 | 78 |
| 79 bool WebSocketHandshakeHyBi10(Connection* connection, | |
|
pfeldman
2011/07/28 09:32:47
Lets keep current version methods with no suffix (
| |
| 80 const HttpServerRequestInfo& request); | |
| 81 void AcceptWebSocketHyBi10(Connection* connection, | |
| 82 const HttpServerRequestInfo& request); | |
| 83 void SendOverWebSocketHyBi10(Connection* connection, const std::string& data); | |
| 84 | |
| 85 bool DidReadWebSocketHyBi10(Connection* connection, | |
| 86 char* data, | |
| 87 size_t length, | |
| 88 std::string* message); | |
| 89 | |
| 90 void AcceptWebSocketHixie76(Connection* connection, | |
| 91 const HttpServerRequestInfo& request); | |
| 92 void SendOverWebSocketHixie76(Connection* connection, | |
| 93 const std::string& data); | |
| 78 | 94 |
| 79 // ListenSocketDelegate | 95 // ListenSocketDelegate |
| 80 virtual void DidAccept(ListenSocket* server, ListenSocket* socket); | 96 virtual void DidAccept(ListenSocket* server, ListenSocket* socket); |
| 81 virtual void DidRead(ListenSocket* socket, const char* data, int len); | 97 virtual void DidRead(ListenSocket* socket, const char* data, int len); |
| 82 virtual void DidClose(ListenSocket* socket); | 98 virtual void DidClose(ListenSocket* socket); |
| 83 | 99 |
| 84 // Expects the raw data to be stored in recv_data_. If parsing is successful, | 100 // Expects the raw data to be stored in recv_data_. If parsing is successful, |
| 85 // will remove the data parsed from recv_data_, leaving only the unused | 101 // will remove the data parsed from recv_data_, leaving only the unused |
| 86 // recv data. | 102 // recv data. |
| 87 bool ParseHeaders(Connection* connection, | 103 bool ParseHeaders(Connection* connection, |
| 88 HttpServerRequestInfo* info, | 104 HttpServerRequestInfo* info, |
| 89 int* ppos); | 105 int* ppos); |
| 90 | 106 |
| 91 Connection* FindConnection(int connection_id); | 107 Connection* FindConnection(int connection_id); |
| 92 Connection* FindConnection(ListenSocket* socket); | 108 Connection* FindConnection(ListenSocket* socket); |
| 93 | 109 |
| 94 HttpServer::Delegate* delegate_; | 110 HttpServer::Delegate* delegate_; |
| 95 scoped_refptr<ListenSocket> server_; | 111 scoped_refptr<ListenSocket> server_; |
| 96 typedef std::map<int, Connection*> IdToConnectionMap; | 112 typedef std::map<int, Connection*> IdToConnectionMap; |
| 97 IdToConnectionMap id_to_connection_; | 113 IdToConnectionMap id_to_connection_; |
| 98 typedef std::map<ListenSocket*, Connection*> SocketToConnectionMap; | 114 typedef std::map<ListenSocket*, Connection*> SocketToConnectionMap; |
| 99 SocketToConnectionMap socket_to_connection_; | 115 SocketToConnectionMap socket_to_connection_; |
| 100 | 116 |
| 101 DISALLOW_COPY_AND_ASSIGN(HttpServer); | 117 DISALLOW_COPY_AND_ASSIGN(HttpServer); |
| 102 }; | 118 }; |
| 103 | 119 |
| 104 } // namespace net | 120 } // namespace net |
| 105 | 121 |
| 106 #endif // NET_SERVER_HTTP_SERVER_H_ | 122 #endif // NET_SERVER_HTTP_SERVER_H_ |
| OLD | NEW |