Commit 9c585ce5 by xiongziliang

http客户端,host字段添加port,防止异常:#579

parent f05422bb
......@@ -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", "*/*");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论