Fixed #18
This commit is contained in:
parent
df9428631c
commit
bd089e9499
@ -177,6 +177,7 @@ protected:
|
|||||||
|
|
||||||
const std::string host_;
|
const std::string host_;
|
||||||
const int port_;
|
const int port_;
|
||||||
|
const std::string host_and_port_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool read_response_line(Stream& strm, Response& res);
|
bool read_response_line(Stream& strm, Response& res);
|
||||||
@ -1035,6 +1036,7 @@ inline bool Server::read_and_close_socket(socket_t sock)
|
|||||||
inline Client::Client(const char* host, int port)
|
inline Client::Client(const char* host, int port)
|
||||||
: host_(host)
|
: host_(host)
|
||||||
, port_(port)
|
, port_(port)
|
||||||
|
, host_and_port_(host_ + ":" + std::to_string(port_))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1098,7 +1100,7 @@ inline bool Client::read_and_close_socket(socket_t sock, const Request& req, Res
|
|||||||
|
|
||||||
inline void Client::add_default_headers(Request& req)
|
inline void Client::add_default_headers(Request& req)
|
||||||
{
|
{
|
||||||
req.set_header("Host", host_.c_str());
|
req.set_header("Host", host_and_port_.c_str());
|
||||||
req.set_header("Accept", "*/*");
|
req.set_header("Accept", "*/*");
|
||||||
req.set_header("User-Agent", "cpp-httplib/0.1");
|
req.set_header("User-Agent", "cpp-httplib/0.1");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user