Fix Wget for Internationalized Domain Names.

GitOrigin-RevId: 8be2d49b41bc3e6d2d3351833ab35bcf43c9b5f7
This commit is contained in:
levlam 2018-05-18 16:15:01 +03:00
parent 7e0e2d2b6a
commit 536508193a

View File

@ -21,6 +21,7 @@
#include <limits>
namespace td {
Wget::Wget(Promise<HttpQueryPtr> promise, string url, std::vector<std::pair<string, string>> headers, int32 timeout_in,
int32 ttl, SslFd::VerifyPeer verify_peer)
: promise_(std::move(promise))
@ -34,6 +35,8 @@ Wget::Wget(Promise<HttpQueryPtr> promise, string url, std::vector<std::pair<stri
Status Wget::try_init() {
string input_url = input_url_;
TRY_RESULT(url, parse_url(MutableSlice(input_url)));
TRY_RESULT(ascii_host, idn_to_ascii(url.host_));
url.host_ = std::move(ascii_host);
IPAddress addr;
TRY_STATUS(addr.init_host_port(url.host_, url.port_));
@ -133,4 +136,5 @@ void Wget::tear_down() {
on_error(Status::Error("Cancelled"));
}
}
} // namespace td