mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-28 12:40:54 +00:00
Fix #2301
This commit is contained in:
1 parent
25688258ad
commit
cdf0d33258
2 files changed
+18
-3
No files matched your search
@@ -1751,7 +1751,7 @@ protected:
|
|||||||
// Socket endpoint information
|
// Socket endpoint information
|
||||||
const std::string host_;
|
const std::string host_;
|
||||||
const int port_;
|
const int port_;
|
||||||
const std::string host_and_port_;
|
std::string host_and_port_;
|
||||||
|
|
||||||
// Current open socket
|
// Current open socket
|
||||||
Socket socket_;
|
Socket socket_;
|
||||||
@@ -9874,8 +9874,7 @@ inline ClientImpl::ClientImpl(const std::string &host, int port,
|
|||||||
const std::string &client_cert_path,
|
const std::string &client_cert_path,
|
||||||
const std::string &client_key_path)
|
const std::string &client_key_path)
|
||||||
: host_(detail::escape_abstract_namespace_unix_domain(host)), port_(port),
|
: host_(detail::escape_abstract_namespace_unix_domain(host)), port_(port),
|
||||||
host_and_port_(
|
host_and_port_(detail::make_host_and_port_string(host_, port, false)),
|
||||||
detail::make_host_and_port_string(host_, port, ClientImpl::is_ssl())),
|
|
||||||
client_cert_path_(client_cert_path), client_key_path_(client_key_path) {}
|
client_cert_path_(client_cert_path), client_key_path_(client_key_path) {}
|
||||||
|
|
||||||
inline ClientImpl::~ClientImpl() {
|
inline ClientImpl::~ClientImpl() {
|
||||||
@@ -12696,6 +12695,8 @@ inline SSLClient::SSLClient(const std::string &host, int port,
|
|||||||
const std::string &client_key_path,
|
const std::string &client_key_path,
|
||||||
const std::string &private_key_password)
|
const std::string &private_key_password)
|
||||||
: ClientImpl(host, port, client_cert_path, client_key_path) {
|
: ClientImpl(host, port, client_cert_path, client_key_path) {
|
||||||
|
host_and_port_ = detail::make_host_and_port_string(host_, port_, true);
|
||||||
|
|
||||||
ctx_ = SSL_CTX_new(TLS_client_method());
|
ctx_ = SSL_CTX_new(TLS_client_method());
|
||||||
|
|
||||||
SSL_CTX_set_min_proto_version(ctx_, TLS1_2_VERSION);
|
SSL_CTX_set_min_proto_version(ctx_, TLS1_2_VERSION);
|
||||||
@@ -12727,6 +12728,8 @@ inline SSLClient::SSLClient(const std::string &host, int port,
|
|||||||
X509 *client_cert, EVP_PKEY *client_key,
|
X509 *client_cert, EVP_PKEY *client_key,
|
||||||
const std::string &private_key_password)
|
const std::string &private_key_password)
|
||||||
: ClientImpl(host, port) {
|
: ClientImpl(host, port) {
|
||||||
|
host_and_port_ = detail::make_host_and_port_string(host_, port_, true);
|
||||||
|
|
||||||
ctx_ = SSL_CTX_new(TLS_client_method());
|
ctx_ = SSL_CTX_new(TLS_client_method());
|
||||||
|
|
||||||
detail::split(&host_[0], &host_[host_.size()], '.',
|
detail::split(&host_[0], &host_[host_.size()], '.',
|
||||||
|
|||||||
@@ -10924,6 +10924,18 @@ TEST(MakeHostAndPortStringTest, VariousPatterns) {
|
|||||||
detail::make_host_and_port_string("example.com", 65536, false));
|
detail::make_host_and_port_string("example.com", 65536, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
|
TEST(SSLClientHostHeaderTest, Issue2301) {
|
||||||
|
httplib::SSLClient cli("roblox.com", 443);
|
||||||
|
cli.set_follow_location(true);
|
||||||
|
|
||||||
|
auto res = cli.Get("/");
|
||||||
|
|
||||||
|
ASSERT_TRUE(res);
|
||||||
|
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST(DirtyDataRequestTest, HeadFieldValueContains_CR_LF_NUL) {
|
TEST(DirtyDataRequestTest, HeadFieldValueContains_CR_LF_NUL) {
|
||||||
Server svr;
|
Server svr;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user