Index: net/server/http_listen_socket.h |
diff --git a/net/server/http_listen_socket.h b/net/server/http_listen_socket.h |
index 5517af004c5075863da0cc2f59fcb8a0eedd2fbd..536abb25246bb6a9c89abdb74906573b3b354760 100644 |
--- a/net/server/http_listen_socket.h |
+++ b/net/server/http_listen_socket.h |
@@ -16,10 +16,10 @@ class HttpListenSocket : public ListenSocket, |
class Delegate { |
public: |
virtual void OnHttpRequest(HttpListenSocket* socket, |
- HttpServerRequestInfo* info) = 0; |
+ const HttpServerRequestInfo& info) = 0; |
virtual void OnWebSocketRequest(HttpListenSocket* socket, |
- HttpServerRequestInfo* info) = 0; |
+ const HttpServerRequestInfo& info) = 0; |
virtual void OnWebSocketMessage(HttpListenSocket* socket, |
const std::string& data) = 0; |
@@ -29,16 +29,22 @@ class HttpListenSocket : public ListenSocket, |
virtual ~Delegate() {} |
}; |
+ virtual void Accept(); |
+ |
static HttpListenSocket* Listen(const std::string& ip, |
int port, |
HttpListenSocket::Delegate* delegate); |
- void AcceptWebSocket(HttpServerRequestInfo* request); |
+ void AcceptWebSocket(const HttpServerRequestInfo& request); |
void SendOverWebSocket(const std::string& data); |
+ void Send200(const std::string& data, const std::string& mime_type); |
+ void Send404(); |
+ void Send500(const std::string& message); |
+ |
+ void Close() { ListenSocket::Close(); } |
void Listen() { ListenSocket::Listen(); } |
- virtual void Accept(); |
// ListenSocketDelegate |
virtual void DidAccept(ListenSocket* server, ListenSocket* connection); |
@@ -53,7 +59,7 @@ class HttpListenSocket : public ListenSocket, |
// Expects the raw data to be stored in recv_data_. If parsing is successful, |
// will remove the data parsed from recv_data_, leaving only the unused |
// recv data. |
- HttpServerRequestInfo* ParseHeaders(); |
+ bool ParseHeaders(HttpServerRequestInfo* info); |
HttpListenSocket::Delegate* delegate_; |
bool is_web_socket_; |