mirror of
https://github.com/sogou/workflow.git
synced 2026-10-22 15:16:20 +08:00
Merge pull request #227 from Barenboim/master
Http redirect supports relative URI. (RFC 7231)
This commit is contained in:
@@ -277,6 +277,19 @@ bool ComplexHttpTask::redirect_url(HttpResponse *client_resp)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (url[0] == '/')
|
||||
{
|
||||
if (url[1] != '/')
|
||||
{
|
||||
if (uri_.port)
|
||||
url = ':' + (uri_.port + url);
|
||||
|
||||
url = "//" + (uri_.host + url);
|
||||
}
|
||||
|
||||
url = uri_.scheme + (':' + url);
|
||||
}
|
||||
|
||||
URIParser::parse(url, uri_);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user