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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 bool URLRequestHttpJob::IsRedirectResponse(GURL* location, | 203 bool URLRequestHttpJob::IsRedirectResponse(GURL* location, |
204 int* http_status_code) { | 204 int* http_status_code) { |
205 if (!response_info_) | 205 if (!response_info_) |
206 return false; | 206 return false; |
207 | 207 |
208 std::string value; | 208 std::string value; |
209 if (!response_info_->headers->IsRedirect(&value)) | 209 if (!response_info_->headers->IsRedirect(&value)) |
210 return false; | 210 return false; |
211 | 211 |
| 212 // For HTTPS, if we didn't receive a server certificate, the response was |
| 213 // from the proxy server (a response to the CONNECT request) rather than |
| 214 // the server. |
| 215 if (request_->url().SchemeIsSecure() && !response_info_->ssl_info.cert) |
| 216 return false; |
| 217 |
212 *location = request_->url().Resolve(value); | 218 *location = request_->url().Resolve(value); |
213 *http_status_code = response_info_->headers->response_code(); | 219 *http_status_code = response_info_->headers->response_code(); |
214 return true; | 220 return true; |
215 } | 221 } |
216 | 222 |
217 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { | 223 bool URLRequestHttpJob::IsSafeRedirect(const GURL& location) { |
218 // We only allow redirects to certain "safe" protocols. This does not | 224 // We only allow redirects to certain "safe" protocols. This does not |
219 // restrict redirects to externally handled protocols. Our consumer would | 225 // restrict redirects to externally handled protocols. Our consumer would |
220 // need to take care of those. | 226 // need to take care of those. |
221 | 227 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 DCHECK(response_cookies_.empty()); | 558 DCHECK(response_cookies_.empty()); |
553 | 559 |
554 std::string name = "Set-Cookie"; | 560 std::string name = "Set-Cookie"; |
555 std::string value; | 561 std::string value; |
556 | 562 |
557 void* iter = NULL; | 563 void* iter = NULL; |
558 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) | 564 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) |
559 response_cookies_.push_back(value); | 565 response_cookies_.push_back(value); |
560 } | 566 } |
561 | 567 |
OLD | NEW |