From 9c585ce5a17c10baf1101580c115ef75199f2f5b Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 21 Nov 2020 22:16:58 +0800 Subject: [PATCH] =?UTF-8?q?http=E5=AE=A2=E6=88=B7=E7=AB=AF=EF=BC=8Chost?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=B7=BB=E5=8A=A0port=EF=BC=8C=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=BC=82=E5=B8=B8=EF=BC=9A#579?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpClient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Http/HttpClient.cpp b/src/Http/HttpClient.cpp index 706bd294..05baa5ab 100644 --- a/src/Http/HttpClient.cpp +++ b/src/Http/HttpClient.cpp @@ -46,6 +46,7 @@ void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) { if (_path.empty()) { _path = "/"; } + auto host_header = host; uint16_t port = atoi(FindField(host.data(), ":", NULL).data()); if (port <= 0) { //默认端口 @@ -54,7 +55,7 @@ void HttpClient::sendRequest(const string &strUrl, float fTimeOutSec) { //服务器域名 host = FindField(host.data(), NULL, ":"); } - _header.emplace("Host", host); + _header.emplace("Host", host_header); _header.emplace("Tools", SERVER_NAME); _header.emplace("Connection", "keep-alive"); _header.emplace("Accept", "*/*");