Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: net/http/http_pipelined_stream.cc

Issue 7289006: Basic HTTP pipelining support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_pipelined_stream.h ('k') | net/http/http_response_body_drainer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/http/http_pipelined_stream.h"
6
7 #include "base/logging.h"
8 #include "base/stringprintf.h"
9 #include "net/base/net_errors.h"
10 #include "net/http/http_pipelined_connection_impl.h"
11 #include "net/http/http_request_headers.h"
12 #include "net/http/http_request_info.h"
13 #include "net/http/http_util.h"
14
15 namespace net {
16
17 HttpPipelinedStream::HttpPipelinedStream(HttpPipelinedConnectionImpl* pipeline,
18 int pipeline_id)
19 : pipeline_(pipeline),
20 pipeline_id_(pipeline_id),
21 request_info_(NULL) {
22 }
23
24 HttpPipelinedStream::~HttpPipelinedStream() {
25 pipeline_->OnStreamDeleted(pipeline_id_);
26 }
27
28 int HttpPipelinedStream::InitializeStream(const HttpRequestInfo* request_info,
29 const BoundNetLog& net_log,
30 OldCompletionCallback* callback) {
31 request_info_ = request_info;
32 pipeline_->InitializeParser(pipeline_id_, request_info, net_log);
33 return OK;
34 }
35
36
37 int HttpPipelinedStream::SendRequest(const HttpRequestHeaders& headers,
38 UploadDataStream* request_body,
39 HttpResponseInfo* response,
40 OldCompletionCallback* callback) {
41 CHECK(pipeline_id_);
42 CHECK(request_info_);
43 // TODO(simonjam): Proxy support will be needed here.
44 const std::string path = HttpUtil::PathForRequest(request_info_->url);
45 std::string request_line_ = base::StringPrintf("%s %s HTTP/1.1\r\n",
46 request_info_->method.c_str(),
47 path.c_str());
48 return pipeline_->SendRequest(pipeline_id_, request_line_, headers,
49 request_body, response, callback);
50 }
51
52 uint64 HttpPipelinedStream::GetUploadProgress() const {
53 return pipeline_->GetUploadProgress(pipeline_id_);
54 }
55
56 int HttpPipelinedStream::ReadResponseHeaders(OldCompletionCallback* callback) {
57 return pipeline_->ReadResponseHeaders(pipeline_id_, callback);
58 }
59
60 const HttpResponseInfo* HttpPipelinedStream::GetResponseInfo() const {
61 return pipeline_->GetResponseInfo(pipeline_id_);
62 }
63
64 int HttpPipelinedStream::ReadResponseBody(IOBuffer* buf, int buf_len,
65 OldCompletionCallback* callback) {
66 return pipeline_->ReadResponseBody(pipeline_id_, buf, buf_len, callback);
67 }
68
69 void HttpPipelinedStream::Close(bool not_reusable) {
70 pipeline_->Close(pipeline_id_, not_reusable);
71 }
72
73 HttpStream* HttpPipelinedStream::RenewStreamForAuth() {
74 // FIXME: What does this mean on a pipeline? Is it for proxies?
75 return new HttpPipelinedStream(pipeline_, pipeline_id_);
76 }
77
78 bool HttpPipelinedStream::IsResponseBodyComplete() const {
79 return pipeline_->IsResponseBodyComplete(pipeline_id_);
80 }
81
82 bool HttpPipelinedStream::CanFindEndOfResponse() const {
83 return pipeline_->CanFindEndOfResponse(pipeline_id_);
84 }
85
86 bool HttpPipelinedStream::IsMoreDataBuffered() const {
87 return pipeline_->IsMoreDataBuffered(pipeline_id_);
88 }
89
90 bool HttpPipelinedStream::IsConnectionReused() const {
91 return pipeline_->IsConnectionReused(pipeline_id_);
92 }
93
94 void HttpPipelinedStream::SetConnectionReused() {
95 pipeline_->SetConnectionReused(pipeline_id_);
96 }
97
98 bool HttpPipelinedStream::IsConnectionReusable() const {
99 return pipeline_->usable();
100 }
101
102 void HttpPipelinedStream::GetSSLInfo(SSLInfo* ssl_info) {
103 pipeline_->GetSSLInfo(pipeline_id_, ssl_info);
104 }
105
106 void HttpPipelinedStream::GetSSLCertRequestInfo(
107 SSLCertRequestInfo* cert_request_info) {
108 pipeline_->GetSSLCertRequestInfo(pipeline_id_, cert_request_info);
109 }
110
111 bool HttpPipelinedStream::IsSpdyHttpStream() const {
112 return false;
113 }
114
115 void HttpPipelinedStream::LogNumRttVsBytesMetrics() const {
116 // TODO(simonjam): I don't want to copy & paste this from http_basic_stream.
117 }
118
119 void HttpPipelinedStream::Drain(HttpNetworkSession*) {
120 // On errors, we already evict everything from the pipeline and close it.
121 // TODO(simonjam): Consider trying to drain the pipeline in the same way that
122 // HttpBasicStream does.
123 delete this;
124 }
125
126 const SSLConfig& HttpPipelinedStream::used_ssl_config() const {
127 return pipeline_->used_ssl_config();
128 }
129
130 const ProxyInfo& HttpPipelinedStream::used_proxy_info() const {
131 return pipeline_->used_proxy_info();
132 }
133
134 const NetLog::Source& HttpPipelinedStream::source() const {
135 return pipeline_->source();
136 }
137
138 bool HttpPipelinedStream::was_npn_negotiated() const {
139 return pipeline_->was_npn_negotiated();
140 }
141
142 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_pipelined_stream.h ('k') | net/http/http_response_body_drainer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698