Correct implementation of the ability to observe and modify resource redirects (issue #346).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@419 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-12-15 14:47:23 +00:00
parent bd84c988cf
commit 2bbd89f97d
8 changed files with 321 additions and 75 deletions

View File

@ -220,6 +220,23 @@ public:
location->Swap(&redirect_url_);
return true;
}
if (response_.get()) {
// Check for HTTP 302 or HTTP 303 redirect.
int status = response_->GetStatus();
if (status == 302 || status == 303) {
CefResponse::HeaderMap headerMap;
response_->GetHeaderMap(headerMap);
CefRequest::HeaderMap::iterator iter = headerMap.find("Location");
if(iter != headerMap.end()) {
GURL new_url = GURL(std::string(iter->second));
*http_status_code = status;
location->Swap(&new_url);
return true;
}
}
}
return false;
}