| OLD | NEW | 
|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_LISTEN_SOCKET_H_ | 5 #ifndef NET_SERVER_HTTP_LISTEN_SOCKET_H_ | 
| 6 #define NET_SERVER_HTTP_LISTEN_SOCKET_H_ | 6 #define NET_SERVER_HTTP_LISTEN_SOCKET_H_ | 
| 7 #pragma once | 7 #pragma once | 
| 8 | 8 | 
| 9 #include "net/base/listen_socket.h" | 9 #include "net/base/listen_socket.h" | 
| 10 | 10 | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 37                                   HttpListenSocket::Delegate* delegate); | 37                                   HttpListenSocket::Delegate* delegate); | 
| 38 | 38 | 
| 39   void AcceptWebSocket(const HttpServerRequestInfo& request); | 39   void AcceptWebSocket(const HttpServerRequestInfo& request); | 
| 40 | 40 | 
| 41   void SendOverWebSocket(const std::string& data); | 41   void SendOverWebSocket(const std::string& data); | 
| 42 | 42 | 
| 43   void Send200(const std::string& data, const std::string& mime_type); | 43   void Send200(const std::string& data, const std::string& mime_type); | 
| 44   void Send404(); | 44   void Send404(); | 
| 45   void Send500(const std::string& message); | 45   void Send500(const std::string& message); | 
| 46 | 46 | 
| 47   virtual void Close() { ListenSocket::Close(); } | 47   virtual void Close(); | 
| 48   virtual void Listen() { ListenSocket::Listen(); } | 48   virtual void Listen(); | 
| 49 | 49 | 
| 50   // ListenSocketDelegate | 50   // ListenSocketDelegate | 
| 51   virtual void DidAccept(ListenSocket* server, ListenSocket* connection); | 51   virtual void DidAccept(ListenSocket* server, ListenSocket* connection); | 
| 52   virtual void DidRead(ListenSocket* connection, const char* data, int len); | 52   virtual void DidRead(ListenSocket* connection, const char* data, int len); | 
| 53   virtual void DidClose(ListenSocket* sock); | 53   virtual void DidClose(ListenSocket* sock); | 
| 54 | 54 | 
| 55  private: | 55  private: | 
| 56   static const int kReadBufSize = 16 * 1024; | 56   static const int kReadBufSize = 16 * 1024; | 
| 57   HttpListenSocket(SOCKET s, HttpListenSocket::Delegate* del); | 57   HttpListenSocket(SOCKET s, HttpListenSocket::Delegate* del); | 
| 58   virtual ~HttpListenSocket(); | 58   virtual ~HttpListenSocket(); | 
| 59 | 59 | 
| 60   // Expects the raw data to be stored in recv_data_. If parsing is successful, | 60   // Expects the raw data to be stored in recv_data_. If parsing is successful, | 
| 61   // will remove the data parsed from recv_data_, leaving only the unused | 61   // will remove the data parsed from recv_data_, leaving only the unused | 
| 62   // recv data. | 62   // recv data. | 
| 63   bool ParseHeaders(HttpServerRequestInfo* info); | 63   bool ParseHeaders(HttpServerRequestInfo* info); | 
| 64 | 64 | 
| 65   HttpListenSocket::Delegate* delegate_; | 65   HttpListenSocket::Delegate* delegate_; | 
| 66   bool is_web_socket_; | 66   bool is_web_socket_; | 
| 67   std::string recv_data_; | 67   std::string recv_data_; | 
| 68 | 68 | 
| 69   DISALLOW_COPY_AND_ASSIGN(HttpListenSocket); | 69   DISALLOW_COPY_AND_ASSIGN(HttpListenSocket); | 
| 70 }; | 70 }; | 
| 71 | 71 | 
| 72 #endif // NET_SERVER_HTTP_LISTEN_SOCKET_H_ | 72 #endif // NET_SERVER_HTTP_LISTEN_SOCKET_H_ | 
| OLD | NEW | 
|---|