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

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

Issue 2299703003: Re-land: Only allow HTTP/0.9 support on default ports. (Closed)
Patch Set: Fix test Created 4 years, 3 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
« no previous file with comments | « net/http/http_basic_stream.h ('k') | net/http/http_network_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <utility> 7 #include <utility>
8 8
9 #include "net/http/http_request_info.h" 9 #include "net/http/http_request_info.h"
10 #include "net/http/http_response_body_drainer.h" 10 #include "net/http/http_response_body_drainer.h"
11 #include "net/http/http_stream_parser.h" 11 #include "net/http/http_stream_parser.h"
12 #include "net/socket/client_socket_handle.h" 12 #include "net/socket/client_socket_handle.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 HttpBasicStream::HttpBasicStream(std::unique_ptr<ClientSocketHandle> connection, 16 HttpBasicStream::HttpBasicStream(std::unique_ptr<ClientSocketHandle> connection,
17 bool using_proxy) 17 bool using_proxy,
18 : state_(std::move(connection), using_proxy) {} 18 bool http_09_on_non_default_ports_enabled)
19 : state_(std::move(connection),
20 using_proxy,
21 http_09_on_non_default_ports_enabled) {}
19 22
20 HttpBasicStream::~HttpBasicStream() {} 23 HttpBasicStream::~HttpBasicStream() {}
21 24
22 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info, 25 int HttpBasicStream::InitializeStream(const HttpRequestInfo* request_info,
23 RequestPriority priority, 26 RequestPriority priority,
24 const BoundNetLog& net_log, 27 const BoundNetLog& net_log,
25 const CompletionCallback& callback) { 28 const CompletionCallback& callback) {
26 state_.Initialize(request_info, priority, net_log, callback); 29 state_.Initialize(request_info, priority, net_log, callback);
27 return OK; 30 return OK;
28 } 31 }
(...skipping 24 matching lines...) Expand all
53 parser()->Close(not_reusable); 56 parser()->Close(not_reusable);
54 } 57 }
55 58
56 HttpStream* HttpBasicStream::RenewStreamForAuth() { 59 HttpStream* HttpBasicStream::RenewStreamForAuth() {
57 DCHECK(IsResponseBodyComplete()); 60 DCHECK(IsResponseBodyComplete());
58 DCHECK(!parser()->IsMoreDataBuffered()); 61 DCHECK(!parser()->IsMoreDataBuffered());
59 // The HttpStreamParser object still has a pointer to the connection. Just to 62 // The HttpStreamParser object still has a pointer to the connection. Just to
60 // be extra-sure it doesn't touch the connection again, delete it here rather 63 // be extra-sure it doesn't touch the connection again, delete it here rather
61 // than leaving it until the destructor is called. 64 // than leaving it until the destructor is called.
62 state_.DeleteParser(); 65 state_.DeleteParser();
63 return new HttpBasicStream(state_.ReleaseConnection(), state_.using_proxy()); 66 return new HttpBasicStream(state_.ReleaseConnection(), state_.using_proxy(),
67 state_.http_09_on_non_default_ports_enabled());
64 } 68 }
65 69
66 bool HttpBasicStream::IsResponseBodyComplete() const { 70 bool HttpBasicStream::IsResponseBodyComplete() const {
67 return parser()->IsResponseBodyComplete(); 71 return parser()->IsResponseBodyComplete();
68 } 72 }
69 73
70 bool HttpBasicStream::IsConnectionReused() const { 74 bool HttpBasicStream::IsConnectionReused() const {
71 return parser()->IsConnectionReused(); 75 return parser()->IsConnectionReused();
72 } 76 }
73 77
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // like the right version should be reported, if headers were received. 131 // like the right version should be reported, if headers were received.
128 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1; 132 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP1_1;
129 return; 133 return;
130 } 134 }
131 135
132 void HttpBasicStream::SetPriority(RequestPriority priority) { 136 void HttpBasicStream::SetPriority(RequestPriority priority) {
133 // TODO(akalin): Plumb this through to |connection_|. 137 // TODO(akalin): Plumb this through to |connection_|.
134 } 138 }
135 139
136 } // namespace net 140 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_basic_stream.h ('k') | net/http/http_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698