@@ -974,7 +974,7 @@ class ClientImpl {
974
974
975
975
void stop ();
976
976
977
- void set_hostname_addr_map (const std::map<std::string, std::string> addr_map);
977
+ void set_hostname_addr_map (std::map<std::string, std::string> addr_map);
978
978
979
979
void set_default_headers (Headers headers);
980
980
@@ -1309,7 +1309,7 @@ class Client {
1309
1309
1310
1310
void stop ();
1311
1311
1312
- void set_hostname_addr_map (const std::map<std::string, std::string> addr_map);
1312
+ void set_hostname_addr_map (std::map<std::string, std::string> addr_map);
1313
1313
1314
1314
void set_default_headers (Headers headers);
1315
1315
@@ -4231,10 +4231,12 @@ class WSInit {
4231
4231
public:
4232
4232
WSInit () {
4233
4233
WSADATA wsaData;
4234
- WSAStartup (0x0002 , &wsaData);
4234
+ if ( WSAStartup (0x0002 , &wsaData) == 0 ) is_valid_ = true ;
4235
4235
}
4236
4236
4237
- ~WSInit () { WSACleanup (); }
4237
+ ~WSInit () { if (is_valid_) WSACleanup (); }
4238
+
4239
+ bool is_valid_ = false ;
4238
4240
};
4239
4241
4240
4242
static WSInit wsinit_;
@@ -6969,7 +6971,7 @@ inline void ClientImpl::set_follow_location(bool on) { follow_location_ = on; }
6969
6971
inline void ClientImpl::set_url_encode (bool on) { url_encode_ = on; }
6970
6972
6971
6973
inline void ClientImpl::set_hostname_addr_map (
6972
- const std::map<std::string, std::string> addr_map) {
6974
+ std::map<std::string, std::string> addr_map) {
6973
6975
addr_map_ = std::move (addr_map);
6974
6976
}
6975
6977
@@ -8095,7 +8097,7 @@ inline size_t Client::is_socket_open() const { return cli_->is_socket_open(); }
8095
8097
inline void Client::stop () { cli_->stop (); }
8096
8098
8097
8099
inline void Client::set_hostname_addr_map (
8098
- const std::map<std::string, std::string> addr_map) {
8100
+ std::map<std::string, std::string> addr_map) {
8099
8101
cli_->set_hostname_addr_map (std::move (addr_map));
8100
8102
}
8101
8103
0 commit comments