OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "net/http/http_basic_state.h" | 5 #include "net/http/http_basic_state.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
11 #include "net/http/http_request_info.h" | 11 #include "net/http/http_request_info.h" |
12 #include "net/http/http_response_body_drainer.h" | 12 #include "net/http/http_response_body_drainer.h" |
13 #include "net/http/http_stream_parser.h" | 13 #include "net/http/http_stream_parser.h" |
14 #include "net/http/http_util.h" | 14 #include "net/http/http_util.h" |
15 #include "net/socket/client_socket_handle.h" | 15 #include "net/socket/client_socket_handle.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 HttpBasicState::HttpBasicState(std::unique_ptr<ClientSocketHandle> connection, | 20 HttpBasicState::HttpBasicState(std::unique_ptr<ClientSocketHandle> connection, |
21 bool using_proxy) | 21 bool using_proxy, |
| 22 bool http_09_on_non_default_ports_enabled) |
22 : read_buf_(new GrowableIOBuffer()), | 23 : read_buf_(new GrowableIOBuffer()), |
23 connection_(std::move(connection)), | 24 connection_(std::move(connection)), |
24 using_proxy_(using_proxy), | 25 using_proxy_(using_proxy), |
25 request_info_(NULL) {} | 26 http_09_on_non_default_ports_enabled_( |
| 27 http_09_on_non_default_ports_enabled), |
| 28 request_info_(nullptr) {} |
26 | 29 |
27 HttpBasicState::~HttpBasicState() {} | 30 HttpBasicState::~HttpBasicState() {} |
28 | 31 |
29 int HttpBasicState::Initialize(const HttpRequestInfo* request_info, | 32 int HttpBasicState::Initialize(const HttpRequestInfo* request_info, |
30 RequestPriority priority, | 33 RequestPriority priority, |
31 const BoundNetLog& net_log, | 34 const BoundNetLog& net_log, |
32 const CompletionCallback& callback) { | 35 const CompletionCallback& callback) { |
33 DCHECK(!parser_.get()); | 36 DCHECK(!parser_.get()); |
34 request_info_ = request_info; | 37 request_info_ = request_info; |
35 parser_.reset(new HttpStreamParser( | 38 parser_.reset(new HttpStreamParser( |
36 connection_.get(), request_info, read_buf_.get(), net_log)); | 39 connection_.get(), request_info, read_buf_.get(), net_log)); |
| 40 parser_->set_http_09_on_non_default_ports_enabled( |
| 41 http_09_on_non_default_ports_enabled_); |
37 return OK; | 42 return OK; |
38 } | 43 } |
39 | 44 |
40 std::unique_ptr<ClientSocketHandle> HttpBasicState::ReleaseConnection() { | 45 std::unique_ptr<ClientSocketHandle> HttpBasicState::ReleaseConnection() { |
41 return std::move(connection_); | 46 return std::move(connection_); |
42 } | 47 } |
43 | 48 |
44 scoped_refptr<GrowableIOBuffer> HttpBasicState::read_buf() const { | 49 scoped_refptr<GrowableIOBuffer> HttpBasicState::read_buf() const { |
45 return read_buf_; | 50 return read_buf_; |
46 } | 51 } |
(...skipping 14 matching lines...) Expand all Loading... |
61 request_line.reserve(expected_size); | 66 request_line.reserve(expected_size); |
62 request_line.append(request_info_->method); | 67 request_line.append(request_info_->method); |
63 request_line.append(1, ' '); | 68 request_line.append(1, ' '); |
64 request_line.append(path); | 69 request_line.append(path); |
65 request_line.append(kSuffix, kSuffixLen); | 70 request_line.append(kSuffix, kSuffixLen); |
66 DCHECK_EQ(expected_size, request_line.size()); | 71 DCHECK_EQ(expected_size, request_line.size()); |
67 return request_line; | 72 return request_line; |
68 } | 73 } |
69 | 74 |
70 } // namespace net | 75 } // namespace net |
OLD | NEW |