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

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 1888963004: Add HttpProtocolHandler and convert everything to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-supports-scheme
Patch Set: more addressing comments Created 4 years, 7 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
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/url_request/url_request_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats( 237 void URLRequestHttpJob::HttpFilterContext::RecordPacketStats(
238 StatisticSelector statistic) const { 238 StatisticSelector statistic) const {
239 job_->RecordPacketStats(statistic); 239 job_->RecordPacketStats(statistic);
240 } 240 }
241 241
242 const BoundNetLog& URLRequestHttpJob::HttpFilterContext::GetNetLog() const { 242 const BoundNetLog& URLRequestHttpJob::HttpFilterContext::GetNetLog() const {
243 return job_->request() ? job_->request()->net_log() : dummy_log_; 243 return job_->request() ? job_->request()->net_log() : dummy_log_;
244 } 244 }
245 245
246 // TODO(darin): make sure the port blocking code is not lost
247 // static
248 URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request,
249 NetworkDelegate* network_delegate,
250 const std::string& scheme) {
251 DCHECK(scheme == "http" || scheme == "https" || scheme == "ws" ||
252 scheme == "wss");
253
254 if (!request->context()->http_transaction_factory()) {
255 NOTREACHED() << "requires a valid context";
256 return new URLRequestErrorJob(
257 request, network_delegate, ERR_INVALID_ARGUMENT);
258 }
259
260 GURL redirect_url;
261 if (request->GetHSTSRedirect(&redirect_url)) {
262 return new URLRequestRedirectJob(
263 request, network_delegate, redirect_url,
264 // Use status code 307 to preserve the method, so POST requests work.
265 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "HSTS");
266 }
267 return new URLRequestHttpJob(request,
268 network_delegate,
269 request->context()->http_user_agent_settings());
270 }
271
272 URLRequestHttpJob::URLRequestHttpJob( 246 URLRequestHttpJob::URLRequestHttpJob(
273 URLRequest* request, 247 URLRequest* request,
274 NetworkDelegate* network_delegate, 248 NetworkDelegate* network_delegate,
275 const HttpUserAgentSettings* http_user_agent_settings) 249 const HttpUserAgentSettings* http_user_agent_settings)
276 : URLRequestJob(request, network_delegate), 250 : URLRequestJob(request, network_delegate),
277 priority_(DEFAULT_PRIORITY), 251 priority_(DEFAULT_PRIORITY),
278 response_info_(nullptr), 252 response_info_(nullptr),
279 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH), 253 proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH),
280 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH), 254 server_auth_state_(AUTH_STATE_DONT_NEED_AUTH),
281 start_callback_(base::Bind(&URLRequestHttpJob::OnStartCompleted, 255 start_callback_(base::Bind(&URLRequestHttpJob::OnStartCompleted,
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 return override_response_headers_.get() ? 1639 return override_response_headers_.get() ?
1666 override_response_headers_.get() : 1640 override_response_headers_.get() :
1667 transaction_->GetResponseInfo()->headers.get(); 1641 transaction_->GetResponseInfo()->headers.get();
1668 } 1642 }
1669 1643
1670 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1644 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1671 awaiting_callback_ = false; 1645 awaiting_callback_ = false;
1672 } 1646 }
1673 1647
1674 } // namespace net 1648 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698