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 29 matching lines...) Expand all Loading... |
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, |
48 const HttpServerRequestInfo& request); | 48 const HttpServerRequestInfo& request); |
49 void SendOverWebSocket(int connection_id, const std::string& data); | 49 void SendOverWebSocket(int connection_id, const std::string& data); |
| 50 // Sends the provided data directly to the given connection. No validation is |
| 51 // performed that data constitutes a valid HTTP response. A valid HTTP |
| 52 // response may be split across multiple calls to SendRaw. |
| 53 void SendRaw(int connection_id, const std::string& data); |
50 void SendResponse(int connection_id, const HttpServerResponseInfo& response); | 54 void SendResponse(int connection_id, const HttpServerResponseInfo& response); |
51 void Send(int connection_id, | 55 void Send(int connection_id, |
52 HttpStatusCode status_code, | 56 HttpStatusCode status_code, |
53 const std::string& data, | 57 const std::string& data, |
54 const std::string& mime_type); | 58 const std::string& mime_type); |
55 void Send200(int connection_id, | 59 void Send200(int connection_id, |
56 const std::string& data, | 60 const std::string& data, |
57 const std::string& mime_type); | 61 const std::string& mime_type); |
58 void Send404(int connection_id); | 62 void Send404(int connection_id); |
59 void Send500(int connection_id, const std::string& message); | 63 void Send500(int connection_id, const std::string& message); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 IdToConnectionMap id_to_connection_; | 98 IdToConnectionMap id_to_connection_; |
95 typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap; | 99 typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap; |
96 SocketToConnectionMap socket_to_connection_; | 100 SocketToConnectionMap socket_to_connection_; |
97 | 101 |
98 DISALLOW_COPY_AND_ASSIGN(HttpServer); | 102 DISALLOW_COPY_AND_ASSIGN(HttpServer); |
99 }; | 103 }; |
100 | 104 |
101 } // namespace net | 105 } // namespace net |
102 | 106 |
103 #endif // NET_SERVER_HTTP_SERVER_H_ | 107 #endif // NET_SERVER_HTTP_SERVER_H_ |
OLD | NEW |