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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_detector.cc

Issue 211983002: Add logging for distinguishing between captive portals with HTTP and HTTPS login pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: isherman comments Created 6 years, 9 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
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 "chrome/browser/captive_portal/captive_portal_detector.h" 5 #include "chrome/browser/captive_portal/captive_portal_detector.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // URL, and returns a CaptivePortalService::Result based on its result. 96 // URL, and returns a CaptivePortalService::Result based on its result.
97 void CaptivePortalDetector::GetCaptivePortalResultFromResponse( 97 void CaptivePortalDetector::GetCaptivePortalResultFromResponse(
98 const net::URLFetcher* url_fetcher, 98 const net::URLFetcher* url_fetcher,
99 Results* results) const { 99 Results* results) const {
100 DCHECK(results); 100 DCHECK(results);
101 DCHECK(!url_fetcher->GetStatus().is_io_pending()); 101 DCHECK(!url_fetcher->GetStatus().is_io_pending());
102 102
103 results->result = RESULT_NO_RESPONSE; 103 results->result = RESULT_NO_RESPONSE;
104 results->response_code = url_fetcher->GetResponseCode(); 104 results->response_code = url_fetcher->GetResponseCode();
105 results->retry_after_delta = base::TimeDelta(); 105 results->retry_after_delta = base::TimeDelta();
106 results->landing_url = url_fetcher->GetURL();
106 107
107 // If there's a network error of some sort when fetching a file via HTTP, 108 // If there's a network error of some sort when fetching a file via HTTP,
108 // there may be a networking problem, rather than a captive portal. 109 // there may be a networking problem, rather than a captive portal.
109 // TODO(mmenke): Consider special handling for redirects that end up at 110 // TODO(mmenke): Consider special handling for redirects that end up at
110 // errors, especially SSL certificate errors. 111 // errors, especially SSL certificate errors.
111 if (url_fetcher->GetStatus().status() != net::URLRequestStatus::SUCCESS) 112 if (url_fetcher->GetStatus().status() != net::URLRequestStatus::SUCCESS)
112 return; 113 return;
113 114
114 // In the case of 503 errors, look for the Retry-After header. 115 // In the case of 503 errors, look for the Retry-After header.
115 if (results->response_code == 503) { 116 if (results->response_code == 503) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return base::Time::Now(); 161 return base::Time::Now();
161 else 162 else
162 return time_for_testing_; 163 return time_for_testing_;
163 } 164 }
164 165
165 bool CaptivePortalDetector::FetchingURL() const { 166 bool CaptivePortalDetector::FetchingURL() const {
166 return url_fetcher_.get() != NULL; 167 return url_fetcher_.get() != NULL;
167 } 168 }
168 169
169 } // namespace captive_portal 170 } // namespace captive_portal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698