| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_SERVER_HTTP_CONNECTION_H_ |
| 6 #define NET_SERVER_HTTP_CONNECTION_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 |
| 15 namespace net { |
| 16 |
| 17 class HttpServer; |
| 18 class HttpServerRequestInfo; |
| 19 class ListenSocket; |
| 20 class WebSocket; |
| 21 |
| 22 class HttpConnection { |
| 23 public: |
| 24 void Send(const std::string& data); |
| 25 void Send(const char* bytes, int len); |
| 26 void Send200(const std::string& data, const std::string& content_type); |
| 27 void Send404(); |
| 28 void Send500(const std::string& message); |
| 29 |
| 30 void Shift(int num_bytes); |
| 31 |
| 32 const std::string& recv_data() const { return recv_data_; } |
| 33 const int id() const { return id_; } |
| 34 |
| 35 private: |
| 36 friend class HttpServer; |
| 37 static int lastId_; |
| 38 |
| 39 HttpConnection(HttpServer* server, ListenSocket* sock); |
| 40 ~HttpConnection(); |
| 41 |
| 42 void DetachSocket(); |
| 43 |
| 44 HttpServer* server_; |
| 45 scoped_refptr<ListenSocket> socket_; |
| 46 scoped_ptr<WebSocket> web_socket_; |
| 47 std::string recv_data_; |
| 48 int id_; |
| 49 DISALLOW_COPY_AND_ASSIGN(HttpConnection); |
| 50 }; |
| 51 |
| 52 } // namespace net |
| 53 |
| 54 #endif // NET_SERVER_HTTP_CONNECTION_H_ |
| OLD | NEW |