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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 virtual void OnClose(int connection_id) = 0; | 38 virtual void OnClose(int connection_id) = 0; |
39 | 39 |
40 protected: | 40 protected: |
41 virtual ~Delegate() {} | 41 virtual ~Delegate() {} |
42 }; | 42 }; |
43 | 43 |
44 HttpServer(const StreamListenSocketFactory& socket_factory, | 44 HttpServer(const StreamListenSocketFactory& socket_factory, |
45 HttpServer::Delegate* delegate); | 45 HttpServer::Delegate* delegate); |
46 | 46 |
47 void AcceptWebSocket(int connection_id, | 47 void AcceptWebSocket(int connection_id, const HttpServerRequestInfo& request); |
48 const HttpServerRequestInfo& request); | |
49 void SendOverWebSocket(int connection_id, const std::string& data); | 48 void SendOverWebSocket(int connection_id, const std::string& data); |
50 // Sends the provided data directly to the given connection. No validation is | 49 // Sends the provided data directly to the given connection. No validation is |
51 // performed that data constitutes a valid HTTP response. A valid HTTP | 50 // performed that data constitutes a valid HTTP response. A valid HTTP |
52 // response may be split across multiple calls to SendRaw. | 51 // response may be split across multiple calls to SendRaw. |
53 void SendRaw(int connection_id, const std::string& data); | 52 void SendRaw(int connection_id, const std::string& data); |
54 void SendResponse(int connection_id, const HttpServerResponseInfo& response); | 53 void SendResponse(int connection_id, const HttpServerResponseInfo& response); |
55 void Send(int connection_id, | 54 void Send(int connection_id, |
56 HttpStatusCode status_code, | 55 HttpStatusCode status_code, |
57 const std::string& data, | 56 const std::string& data, |
58 const std::string& mime_type); | 57 const std::string& mime_type); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 typedef std::map<int, HttpConnection*> IdToConnectionMap; | 96 typedef std::map<int, HttpConnection*> IdToConnectionMap; |
98 IdToConnectionMap id_to_connection_; | 97 IdToConnectionMap id_to_connection_; |
99 typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap; | 98 typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap; |
100 SocketToConnectionMap socket_to_connection_; | 99 SocketToConnectionMap socket_to_connection_; |
101 | 100 |
102 DISALLOW_COPY_AND_ASSIGN(HttpServer); | 101 DISALLOW_COPY_AND_ASSIGN(HttpServer); |
103 }; | 102 }; |
104 | 103 |
105 } // namespace net | 104 } // namespace net |
106 | 105 |
107 #endif // NET_SERVER_HTTP_SERVER_H_ | 106 #endif // NET_SERVER_HTTP_SERVER_H_ |
OLD | NEW |