OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 bool URLRequestHttpJob::IsRedirectResponse(GURL* location, | 206 bool URLRequestHttpJob::IsRedirectResponse(GURL* location, |
207 int* http_status_code) { | 207 int* http_status_code) { |
208 if (!response_info_) | 208 if (!response_info_) |
209 return false; | 209 return false; |
210 | 210 |
211 std::string value; | 211 std::string value; |
212 if (!response_info_->headers->IsRedirect(&value)) | 212 if (!response_info_->headers->IsRedirect(&value)) |
213 return false; | 213 return false; |
214 | 214 |
215 // For HTTPS, if we didn't receive a server certificate, the response was | |
216 // from the proxy server (a response to the CONNECT request) rather than | |
217 // the server. | |
218 if (request_->url().SchemeIsSecure() && !response_info_->ssl_info.cert) | |
219 return false; | |
220 | |
221 *location = request_->url().Resolve(value); | 215 *location = request_->url().Resolve(value); |
222 *http_status_code = response_info_->headers->response_code(); | 216 *http_status_code = response_info_->headers->response_code(); |
223 return true; | 217 return true; |
224 } | 218 } |
225 | 219 |
226 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { | 220 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { |
227 // We only allow redirects to certain "safe" protocols. This does not | 221 // We only allow redirects to certain "safe" protocols. This does not |
228 // restrict redirects to externally handled protocols. Our consumer would | 222 // restrict redirects to externally handled protocols. Our consumer would |
229 // need to take care of those. | 223 // need to take care of those. |
230 | 224 |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 DCHECK(response_cookies_.empty()); | 556 DCHECK(response_cookies_.empty()); |
563 | 557 |
564 std::string name = "Set-Cookie"; | 558 std::string name = "Set-Cookie"; |
565 std::string value; | 559 std::string value; |
566 | 560 |
567 void* iter = NULL; | 561 void* iter = NULL; |
568 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) | 562 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) |
569 response_cookies_.push_back(value); | 563 response_cookies_.push_back(value); |
570 } | 564 } |
571 | 565 |
OLD | NEW |