OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_CONNECTION_H_ | 5 #ifndef NET_SERVER_HTTP_CONNECTION_H_ |
6 #define NET_SERVER_HTTP_CONNECTION_H_ | 6 #define NET_SERVER_HTTP_CONNECTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 class HttpServer; | 17 class HttpServer; |
18 class StreamListenSocket; | 18 class StreamListenSocket; |
19 class WebSocket; | 19 class WebSocket; |
20 | 20 |
21 class HttpConnection { | 21 class HttpConnection { |
22 public: | 22 public: |
23 ~HttpConnection(); | |
mmenke
2012/05/14 20:45:19
Why this change?
Philippe
2012/05/15 14:39:09
It is needed by the change in HttpServer's destruc
| |
24 | |
23 void Send(const std::string& data); | 25 void Send(const std::string& data); |
24 void Send(const char* bytes, int len); | 26 void Send(const char* bytes, int len); |
25 void Send200(const std::string& data, const std::string& content_type); | 27 void Send200(const std::string& data, const std::string& content_type); |
26 void Send404(); | 28 void Send404(); |
27 void Send500(const std::string& message); | 29 void Send500(const std::string& message); |
28 | 30 |
29 void Shift(int num_bytes); | 31 void Shift(int num_bytes); |
30 | 32 |
31 const std::string& recv_data() const { return recv_data_; } | 33 const std::string& recv_data() const { return recv_data_; } |
32 int id() const { return id_; } | 34 int id() const { return id_; } |
33 | 35 |
34 private: | 36 private: |
35 friend class HttpServer; | 37 friend class HttpServer; |
36 static int last_id_; | 38 static int last_id_; |
37 | 39 |
38 HttpConnection(HttpServer* server, StreamListenSocket* sock); | 40 HttpConnection(HttpServer* server, StreamListenSocket* sock); |
39 ~HttpConnection(); | |
40 | 41 |
41 void DetachSocket(); | 42 void DetachSocket(); |
42 | 43 |
43 HttpServer* server_; | 44 HttpServer* server_; |
44 scoped_refptr<StreamListenSocket> socket_; | 45 scoped_refptr<StreamListenSocket> socket_; |
45 scoped_ptr<WebSocket> web_socket_; | 46 scoped_ptr<WebSocket> web_socket_; |
46 std::string recv_data_; | 47 std::string recv_data_; |
47 int id_; | 48 int id_; |
48 DISALLOW_COPY_AND_ASSIGN(HttpConnection); | 49 DISALLOW_COPY_AND_ASSIGN(HttpConnection); |
49 }; | 50 }; |
50 | 51 |
51 } // namespace net | 52 } // namespace net |
52 | 53 |
53 #endif // NET_SERVER_HTTP_CONNECTION_H_ | 54 #endif // NET_SERVER_HTTP_CONNECTION_H_ |
OLD | NEW |