Skip to content

Commit

Permalink
Fix Windows build problem
Browse files Browse the repository at this point in the history
  • Loading branch information
yhirose committed Jan 17, 2025
1 parent ba68459 commit 8311e11
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions httplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -2054,13 +2054,18 @@ inline uint64_t Response::get_header_value_u64(const std::string &key,

inline void default_socket_options(socket_t sock) {
int opt = 1;
#ifdef _WIN32
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
reinterpret_cast<const char *>(&opt), sizeof(opt));
#else
#ifdef SO_REUSEPORT
setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
reinterpret_cast<const void *>(&opt), sizeof(opt));
#else
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
reinterpret_cast<const void *>(&opt), sizeof(opt));
#endif
#endif
}

inline const char *status_message(int status) {
Expand Down

0 comments on commit 8311e11

Please sign in to comment.