| 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) |  | 
| 23     : read_buf_(new GrowableIOBuffer()), | 22     : read_buf_(new GrowableIOBuffer()), | 
| 24       connection_(std::move(connection)), | 23       connection_(std::move(connection)), | 
| 25       using_proxy_(using_proxy), | 24       using_proxy_(using_proxy), | 
| 26       http_09_on_non_default_ports_enabled_( | 25       request_info_(NULL) {} | 
| 27           http_09_on_non_default_ports_enabled), |  | 
| 28       request_info_(nullptr) {} |  | 
| 29 | 26 | 
| 30 HttpBasicState::~HttpBasicState() {} | 27 HttpBasicState::~HttpBasicState() {} | 
| 31 | 28 | 
| 32 int HttpBasicState::Initialize(const HttpRequestInfo* request_info, | 29 int HttpBasicState::Initialize(const HttpRequestInfo* request_info, | 
| 33                                RequestPriority priority, | 30                                RequestPriority priority, | 
| 34                                const BoundNetLog& net_log, | 31                                const BoundNetLog& net_log, | 
| 35                                const CompletionCallback& callback) { | 32                                const CompletionCallback& callback) { | 
| 36   DCHECK(!parser_.get()); | 33   DCHECK(!parser_.get()); | 
| 37   request_info_ = request_info; | 34   request_info_ = request_info; | 
| 38   parser_.reset(new HttpStreamParser( | 35   parser_.reset(new HttpStreamParser( | 
| 39       connection_.get(), request_info, read_buf_.get(), net_log)); | 36       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_); |  | 
| 42   return OK; | 37   return OK; | 
| 43 } | 38 } | 
| 44 | 39 | 
| 45 std::unique_ptr<ClientSocketHandle> HttpBasicState::ReleaseConnection() { | 40 std::unique_ptr<ClientSocketHandle> HttpBasicState::ReleaseConnection() { | 
| 46   return std::move(connection_); | 41   return std::move(connection_); | 
| 47 } | 42 } | 
| 48 | 43 | 
| 49 scoped_refptr<GrowableIOBuffer> HttpBasicState::read_buf() const { | 44 scoped_refptr<GrowableIOBuffer> HttpBasicState::read_buf() const { | 
| 50   return read_buf_; | 45   return read_buf_; | 
| 51 } | 46 } | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 66   request_line.reserve(expected_size); | 61   request_line.reserve(expected_size); | 
| 67   request_line.append(request_info_->method); | 62   request_line.append(request_info_->method); | 
| 68   request_line.append(1, ' '); | 63   request_line.append(1, ' '); | 
| 69   request_line.append(path); | 64   request_line.append(path); | 
| 70   request_line.append(kSuffix, kSuffixLen); | 65   request_line.append(kSuffix, kSuffixLen); | 
| 71   DCHECK_EQ(expected_size, request_line.size()); | 66   DCHECK_EQ(expected_size, request_line.size()); | 
| 72   return request_line; | 67   return request_line; | 
| 73 } | 68 } | 
| 74 | 69 | 
| 75 }  // namespace net | 70 }  // namespace net | 
| OLD | NEW | 
|---|