Wget: don't add second Host header
GitOrigin-RevId: 8a1a3fc4a880e6df435331ec60a0efd2e5c698a0
This commit is contained in:
parent
7504f81b72
commit
a96fc3d77f
@ -51,10 +51,16 @@ Status Wget::try_init() {
|
||||
|
||||
HttpHeaderCreator hc;
|
||||
hc.init_get(url.query_);
|
||||
bool was_host = false;
|
||||
for (auto &header : headers_) {
|
||||
if (header.first == "Host") { // TODO: lowercase
|
||||
was_host = true;
|
||||
}
|
||||
hc.add_header(header.first, header.second);
|
||||
}
|
||||
hc.add_header("Host", url.host_);
|
||||
if (!was_host) {
|
||||
hc.add_header("Host", url.host_);
|
||||
}
|
||||
hc.add_header("Accept-Encoding", "gzip, deflate");
|
||||
|
||||
send_closure(connection_, &HttpOutboundConnection::write_next, BufferSlice(hc.finish().ok()));
|
||||
@ -92,7 +98,7 @@ void Wget::on_ok(HttpQueryPtr http_query_ptr) {
|
||||
promise_.set_value(std::move(http_query_ptr));
|
||||
stop();
|
||||
} else {
|
||||
on_error(Status::Error("http error"));
|
||||
on_error(Status::Error(PSLICE() << "http error: " << http_query_ptr->code_));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user