| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_stream.h" | 5 #include "net/http/http_basic_stream.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 HttpBasicStream::HttpBasicStream(ClientSocketHandle* handle, | 9 HttpBasicStream::HttpBasicStream(ClientSocketHandle* connection) |
| 10 const BoundNetLog& net_log) | |
| 11 : read_buf_(new GrowableIOBuffer()), | 10 : read_buf_(new GrowableIOBuffer()), |
| 12 parser_(new HttpStreamParser(handle, read_buf_, net_log)) { | 11 connection_(connection) { |
| 13 } | 12 } |
| 14 | 13 |
| 15 int HttpBasicStream::SendRequest(const HttpRequestInfo* request, | 14 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info, |
| 16 const std::string& headers, | 15 const BoundNetLog& net_log, |
| 16 CompletionCallback* callback) { |
| 17 parser_.reset(new HttpStreamParser(connection_, request_info, |
| 18 read_buf_, net_log)); |
| 19 connection_ = NULL; |
| 20 return OK; |
| 21 } |
| 22 |
| 23 |
| 24 int HttpBasicStream::SendRequest(const std::string& headers, |
| 17 UploadDataStream* request_body, | 25 UploadDataStream* request_body, |
| 18 HttpResponseInfo* response, | 26 HttpResponseInfo* response, |
| 19 CompletionCallback* callback) { | 27 CompletionCallback* callback) { |
| 20 return parser_->SendRequest( | 28 DCHECK(parser_.get()); |
| 21 request, headers, request_body, response, callback); | 29 return parser_->SendRequest(headers, request_body, response, callback); |
| 22 } | 30 } |
| 23 | 31 |
| 24 HttpBasicStream::~HttpBasicStream() {} | 32 HttpBasicStream::~HttpBasicStream() {} |
| 25 | 33 |
| 26 uint64 HttpBasicStream::GetUploadProgress() const { | 34 uint64 HttpBasicStream::GetUploadProgress() const { |
| 27 return parser_->GetUploadProgress(); | 35 return parser_->GetUploadProgress(); |
| 28 } | 36 } |
| 29 | 37 |
| 30 int HttpBasicStream::ReadResponseHeaders(CompletionCallback* callback) { | 38 int HttpBasicStream::ReadResponseHeaders(CompletionCallback* callback) { |
| 31 return parser_->ReadResponseHeaders(callback); | 39 return parser_->ReadResponseHeaders(callback); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 46 | 54 |
| 47 bool HttpBasicStream::CanFindEndOfResponse() const { | 55 bool HttpBasicStream::CanFindEndOfResponse() const { |
| 48 return parser_->CanFindEndOfResponse(); | 56 return parser_->CanFindEndOfResponse(); |
| 49 } | 57 } |
| 50 | 58 |
| 51 bool HttpBasicStream::IsMoreDataBuffered() const { | 59 bool HttpBasicStream::IsMoreDataBuffered() const { |
| 52 return parser_->IsMoreDataBuffered(); | 60 return parser_->IsMoreDataBuffered(); |
| 53 } | 61 } |
| 54 | 62 |
| 55 } // namespace net | 63 } // namespace net |
| OLD | NEW |