From 0c1d797753bec6afbaf99cc4fd0718500cc61cd5 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 18 May 2018 02:03:21 +0300 Subject: [PATCH] Fix Wget redirects. GitOrigin-RevId: da827d06832793592f2c8c47e7510922da776333 --- tdnet/td/net/Wget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tdnet/td/net/Wget.cpp b/tdnet/td/net/Wget.cpp index dde4fefa7..3220b2685 100644 --- a/tdnet/td/net/Wget.cpp +++ b/tdnet/td/net/Wget.cpp @@ -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_;