Commit db8a7c2c authored by Zhongyi Shi's avatar Zhongyi Shi Committed by Commit Bot

Save response headers and return to the caller when receive a redirect but URL...

Save response headers and return to the caller when receive a redirect but URL fetcher stops on redirects.

Bug: 936350
Change-Id: I933f362c966676d4a6dbbc0704afd69851edc248
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2143652Reviewed-by: default avatarEric Roman <eroman@chromium.org>
Commit-Queue: Zhongyi Shi <zhongyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758047}
parent f6af2461
......@@ -406,6 +406,7 @@ void URLFetcherCore::OnReceivedRedirect(URLRequest* request,
stopped_on_redirect_ = true;
url_ = redirect_info.new_url;
response_code_ = request_->GetResponseCode();
response_headers_ = request_->response_headers();
proxy_server_ = request_->proxy_server();
was_cached_ = request_->was_cached();
total_received_bytes_ += request_->GetTotalReceivedBytes();
......
......@@ -1185,6 +1185,9 @@ TEST_F(URLFetcherTest, StopOnRedirect) {
delegate.fetcher()->GetStatus().status());
EXPECT_THAT(delegate.fetcher()->GetStatus().error(), IsError(ERR_ABORTED));
EXPECT_EQ(301, delegate.fetcher()->GetResponseCode());
ASSERT_TRUE(delegate.fetcher()->GetResponseHeaders());
EXPECT_TRUE(delegate.fetcher()->GetResponseHeaders()->HasHeaderValue(
"Location", std::string(kRedirectTarget)));
}
TEST_F(URLFetcherTest, ThrottleOnRepeatedFetches) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment