Chromium Code Reviews| Index: net/server/http_server.h |
| diff --git a/net/server/http_server.h b/net/server/http_server.h |
| index 78f6e42d8edaaee577143abd4e6c5946ed2b377a..04c56cc8ad03cad55b75858b92c2b9c02ec23ee7 100644 |
| --- a/net/server/http_server.h |
| +++ b/net/server/http_server.h |
| @@ -15,7 +15,40 @@ |
| namespace net { |
| +class HttpServer; |
| class HttpServerRequestInfo; |
| +class WebSocket; |
| + |
| +class Connection { |
| + public: |
| + void Send(const std::string& data); |
| + void Send(const char* bytes, int len); |
| + void Send200(const std::string& data, const std::string& content_type); |
| + void Send404(); |
| + void Send500(const std::string& message); |
| + |
| + const std::string& RecvData() const { return recv_data_; } |
|
eroman
2011/08/02 18:46:41
nit: recv_data() for accessor.
|
| + const int Id() const { return id_; } |
|
eroman
2011/08/02 18:46:41
id()
|
| + void Shift(int num_bytes); |
| + |
| + private: |
| + static int lastId_; |
|
eroman
2011/08/02 18:46:41
last_id_
Also please explain what this is.
|
| + friend class HttpServer; |
| + |
| + Connection(HttpServer* server, ListenSocket* sock); |
| + ~Connection(); |
| + |
| + void DetachSocket(); |
| + |
| + |
|
eroman
2011/08/02 18:46:41
extra space
|
| + HttpServer* server_; |
| + scoped_refptr<ListenSocket> socket_; |
| + scoped_ptr<WebSocket> web_socket_; |
| + std::string recv_data_; |
| + int id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Connection); |
| +}; |
| class HttpServer : public ListenSocket::ListenSocketDelegate, |
| public base::RefCountedThreadSafe<HttpServer> { |
| @@ -53,28 +86,21 @@ class HttpServer : public ListenSocket::ListenSocketDelegate, |
| private: |
| friend class base::RefCountedThreadSafe<HttpServer>; |
| - class Connection { |
| - private: |
| - static int lastId_; |
| - friend class HttpServer; |
| - |
| - Connection(HttpServer* server, ListenSocket* sock); |
| - ~Connection(); |
| - |
| - void DetachSocket(); |
| - |
| - void Shift(int num_bytes); |
| + friend class Connection; |
| - HttpServer* server_; |
| - scoped_refptr<ListenSocket> socket_; |
| - bool is_web_socket_; |
| - std::string recv_data_; |
| - int id_; |
| + void AcceptWebSocketHyBi10(Connection* connection, |
| + const HttpServerRequestInfo& request); |
| + void SendOverWebSocketHyBi10(Connection* connection, const std::string& data); |
| - DISALLOW_COPY_AND_ASSIGN(Connection); |
| - }; |
| - friend class Connection; |
| + bool DidReadWebSocketHyBi10(Connection* connection, |
| + char* data, |
| + size_t length, |
| + std::string* message); |
| + void AcceptWebSocketHixie76(Connection* connection, |
| + const HttpServerRequestInfo& request); |
| + void SendOverWebSocketHixie76(Connection* connection, |
| + const std::string& data); |
| // ListenSocketDelegate |
| virtual void DidAccept(ListenSocket* server, ListenSocket* socket); |
| @@ -86,7 +112,7 @@ private: |
| // recv data. |
| bool ParseHeaders(Connection* connection, |
| HttpServerRequestInfo* info, |
| - int* ppos); |
| + size_t* pos); |
| Connection* FindConnection(int connection_id); |
| Connection* FindConnection(ListenSocket* socket); |