Fix Wget redirects.

GitOrigin-RevId: da827d06832793592f2c8c47e7510922da776333
This commit is contained in:
levlam 2018-05-18 02:03:21 +03:00
parent d9a89abd23
commit 0c1d797753

View File

@ -95,7 +95,9 @@ void Wget::on_connection_error(Status error) {
void Wget::on_ok(HttpQueryPtr http_query_ptr) {
CHECK(promise_);
if (http_query_ptr->code_ == 302 && ttl_ > 0) {
if ((http_query_ptr->code_ == 301 || http_query_ptr->code_ == 302 || http_query_ptr->code_ == 307 ||
http_query_ptr->code_ == 308) &&
ttl_ > 0) {
LOG(DEBUG) << *http_query_ptr;
input_url_ = http_query_ptr->get_header("location").str();
LOG(DEBUG) << input_url_;