| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 request_.reportRawHeaders()); | 591 request_.reportRawHeaders()); |
| 592 | 592 |
| 593 WebURLRequest new_request; | 593 WebURLRequest new_request; |
| 594 PopulateURLRequestForRedirect( | 594 PopulateURLRequestForRedirect( |
| 595 request_, redirect_info, referrer_policy_, | 595 request_, redirect_info, referrer_policy_, |
| 596 info.was_fetched_via_service_worker | 596 info.was_fetched_via_service_worker |
| 597 ? blink::WebURLRequest::SkipServiceWorker::None | 597 ? blink::WebURLRequest::SkipServiceWorker::None |
| 598 : blink::WebURLRequest::SkipServiceWorker::All, | 598 : blink::WebURLRequest::SkipServiceWorker::All, |
| 599 &new_request); | 599 &new_request); |
| 600 | 600 |
| 601 client_->willFollowRedirect(loader_, new_request, response, | 601 client_->willFollowRedirect(loader_, new_request, response); |
| 602 info.encoded_data_length); | |
| 603 request_ = new_request; | 602 request_ = new_request; |
| 604 | 603 |
| 605 // Only follow the redirect if WebKit left the URL unmodified. | 604 // Only follow the redirect if WebKit left the URL unmodified. |
| 606 if (redirect_info.new_url == GURL(new_request.url())) { | 605 if (redirect_info.new_url == GURL(new_request.url())) { |
| 607 // First-party cookie logic moved from DocumentLoader in Blink to | 606 // First-party cookie logic moved from DocumentLoader in Blink to |
| 608 // net::URLRequest in the browser. Assert that Blink didn't try to change it | 607 // net::URLRequest in the browser. Assert that Blink didn't try to change it |
| 609 // to something else. | 608 // to something else. |
| 610 DCHECK_EQ(redirect_info.new_first_party_for_cookies.spec(), | 609 DCHECK_EQ(redirect_info.new_first_party_for_cookies.spec(), |
| 611 request_.firstPartyForCookies().string().utf8()); | 610 request_.firstPartyForCookies().string().utf8()); |
| 612 return true; | 611 return true; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 info.devtools_info->response_headers; | 1029 info.devtools_info->response_headers; |
| 1031 for (HeadersVector::const_iterator it = response_headers.begin(); | 1030 for (HeadersVector::const_iterator it = response_headers.begin(); |
| 1032 it != response_headers.end(); ++it) { | 1031 it != response_headers.end(); ++it) { |
| 1033 load_info.addResponseHeader(WebString::fromLatin1(it->first), | 1032 load_info.addResponseHeader(WebString::fromLatin1(it->first), |
| 1034 WebString::fromLatin1(it->second)); | 1033 WebString::fromLatin1(it->second)); |
| 1035 } | 1034 } |
| 1036 load_info.setNPNNegotiatedProtocol(WebString::fromLatin1( | 1035 load_info.setNPNNegotiatedProtocol(WebString::fromLatin1( |
| 1037 info.npn_negotiated_protocol)); | 1036 info.npn_negotiated_protocol)); |
| 1038 response->setHTTPLoadInfo(load_info); | 1037 response->setHTTPLoadInfo(load_info); |
| 1039 } | 1038 } |
| 1039 response->addToEncodedDataLength(info.encoded_data_length); |
| 1040 | 1040 |
| 1041 const net::HttpResponseHeaders* headers = info.headers.get(); | 1041 const net::HttpResponseHeaders* headers = info.headers.get(); |
| 1042 if (!headers) | 1042 if (!headers) |
| 1043 return; | 1043 return; |
| 1044 | 1044 |
| 1045 WebURLResponse::HTTPVersion version = WebURLResponse::HTTPVersionUnknown; | 1045 WebURLResponse::HTTPVersion version = WebURLResponse::HTTPVersionUnknown; |
| 1046 if (headers->GetHttpVersion() == net::HttpVersion(0, 9)) | 1046 if (headers->GetHttpVersion() == net::HttpVersion(0, 9)) |
| 1047 version = WebURLResponse::HTTPVersion_0_9; | 1047 version = WebURLResponse::HTTPVersion_0_9; |
| 1048 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0)) | 1048 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0)) |
| 1049 version = WebURLResponse::HTTPVersion_1_0; | 1049 version = WebURLResponse::HTTPVersion_1_0; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 response->clearHTTPHeaderField(webStringName); | 1213 response->clearHTTPHeaderField(webStringName); |
| 1214 while (response_headers->EnumerateHeader(&iterator, name, &value)) { | 1214 while (response_headers->EnumerateHeader(&iterator, name, &value)) { |
| 1215 response->addHTTPHeaderField(webStringName, | 1215 response->addHTTPHeaderField(webStringName, |
| 1216 WebString::fromLatin1(value)); | 1216 WebString::fromLatin1(value)); |
| 1217 } | 1217 } |
| 1218 } | 1218 } |
| 1219 return true; | 1219 return true; |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 } // namespace content | 1222 } // namespace content |
| OLD | NEW |