diff --git a/httplib.h b/httplib.h index fcce072469..d5f9e6c6de 100644 --- a/httplib.h +++ b/httplib.h @@ -3371,8 +3371,6 @@ socket_t create_socket(const std::string &host, const std::string &ip, int port, #endif } - if (socket_options) { socket_options(sock); } - if (rp->ai_family == AF_INET6) { auto opt = ipv6_v6only ? 1 : 0; #ifdef _WIN32 @@ -3384,6 +3382,8 @@ socket_t create_socket(const std::string &host, const std::string &ip, int port, #endif } + if (socket_options) { socket_options(sock); } + // bind or connect auto quit = false; if (bind_or_connect(sock, *rp, quit)) {