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

Side by Side Diff: net/proxy/proxy_script_fetcher_impl.cc

Issue 23064011: Consolidate scheme checks into an easy GURL method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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_util_icu.cc ('k') | url/gurl.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/proxy/proxy_script_fetcher_impl.h" 5 #include "net/proxy/proxy_script_fetcher_impl.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/i18n/icu_string_conversions.h" 8 #include "base/i18n/icu_string_conversions.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) { 205 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) {
206 DCHECK_EQ(request, cur_request_.get()); 206 DCHECK_EQ(request, cur_request_.get());
207 207
208 if (!request->status().is_success()) { 208 if (!request->status().is_success()) {
209 OnResponseCompleted(request); 209 OnResponseCompleted(request);
210 return; 210 return;
211 } 211 }
212 212
213 // Require HTTP responses to have a success status code. 213 // Require HTTP responses to have a success status code.
214 if (request->url().SchemeIs("http") || request->url().SchemeIs("https")) { 214 if (request->url().SchemeIsHTTPOrHTTPS()) {
215 // NOTE about status codes: We are like Firefox 3 in this respect. 215 // NOTE about status codes: We are like Firefox 3 in this respect.
216 // {IE 7, Safari 3, Opera 9.5} do not care about the status code. 216 // {IE 7, Safari 3, Opera 9.5} do not care about the status code.
217 if (request->GetResponseCode() != 200) { 217 if (request->GetResponseCode() != 200) {
218 VLOG(1) << "Fetched PAC script had (bad) status line: " 218 VLOG(1) << "Fetched PAC script had (bad) status line: "
219 << request->response_headers()->GetStatusLine(); 219 << request->response_headers()->GetStatusLine();
220 result_code_ = ERR_PAC_STATUS_NOT_OK; 220 result_code_ = ERR_PAC_STATUS_NOT_OK;
221 request->Cancel(); 221 request->Cancel();
222 return; 222 return;
223 } 223 }
224 224
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // is still applicable. 312 // is still applicable.
313 if (cur_request_id_ != id) 313 if (cur_request_id_ != id)
314 return; 314 return;
315 315
316 DCHECK(cur_request_.get()); 316 DCHECK(cur_request_.get());
317 result_code_ = ERR_TIMED_OUT; 317 result_code_ = ERR_TIMED_OUT;
318 cur_request_->Cancel(); 318 cur_request_->Cancel();
319 } 319 }
320 320
321 } // namespace net 321 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_util_icu.cc ('k') | url/gurl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698