OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SERVICES_HTTP_SERVER_CONNECTION_H_ | 5 #ifndef SERVICES_HTTP_SERVER_CONNECTION_H_ |
6 #define SERVICES_HTTP_SERVER_CONNECTION_H_ | 6 #define SERVICES_HTTP_SERVER_CONNECTION_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "mojo/public/cpp/environment/async_waiter.h" | 10 #include "mojo/public/cpp/environment/async_waiter.h" |
11 #include "mojo/public/cpp/system/data_pipe.h" | 11 #include "mojo/public/cpp/system/data_pipe.h" |
12 #include "mojo/services/http_server/public/interfaces/http_request.mojom.h" | 12 #include "mojo/services/http_server/interfaces/http_request.mojom.h" |
13 #include "mojo/services/http_server/public/interfaces/http_response.mojom.h" | 13 #include "mojo/services/http_server/interfaces/http_response.mojom.h" |
14 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | 14 #include "mojo/services/network/public/interfaces/network_service.mojom.h" |
15 #include "services/http_server/http_request_parser.h" | 15 #include "services/http_server/http_request_parser.h" |
16 | 16 |
17 namespace http_server { | 17 namespace http_server { |
18 | 18 |
19 // Represents one connection to a client. This connection will manage its own | 19 // Represents one connection to a client. This connection will manage its own |
20 // lifetime and will delete itself when the connection is closed. | 20 // lifetime and will delete itself when the connection is closed. |
21 class Connection { | 21 class Connection { |
22 public: | 22 public: |
23 // Callback called when a request is parsed. Response should be sent | 23 // Callback called when a request is parsed. Response should be sent |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // Contains response data to write to the pipe. Initially it is the headers, | 67 // Contains response data to write to the pipe. Initially it is the headers, |
68 // and then when they're written it contains chunks of the body. | 68 // and then when they're written it contains chunks of the body. |
69 std::string response_; | 69 std::string response_; |
70 size_t response_offset_; | 70 size_t response_offset_; |
71 }; | 71 }; |
72 | 72 |
73 } // namespace http_server | 73 } // namespace http_server |
74 | 74 |
75 #endif // SERVICES_HTTP_SERVER_CONNECTION_H_ | 75 #endif // SERVICES_HTTP_SERVER_CONNECTION_H_ |
OLD | NEW |