Skip to content

Commit 6adf130

Browse files
committed
Fix #739
1 parent b6b2eaf commit 6adf130

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

httplib.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@
8787
: 0))
8888
#endif
8989

90+
#ifndef CPPHTTPLIB_RECV_FLAGS
91+
#define CPPHTTPLIB_RECV_FLAGS 0
92+
#endif
93+
94+
#ifndef CPPHTTPLIB_SEND_FLAGS
95+
#define CPPHTTPLIB_SEND_FLAGS 0
96+
#endif
97+
9098
/*
9199
* Headers
92100
*/
@@ -3759,9 +3767,9 @@ inline ssize_t SocketStream::read(char *ptr, size_t size) {
37593767
if (size > static_cast<size_t>((std::numeric_limits<int>::max)())) {
37603768
return -1;
37613769
}
3762-
return recv(sock_, ptr, static_cast<int>(size), 0);
3770+
return recv(sock_, ptr, static_cast<int>(size), CPPHTTPLIB_RECV_FLAGS);
37633771
#else
3764-
return handle_EINTR([&]() { return recv(sock_, ptr, size, 0); });
3772+
return handle_EINTR([&]() { return recv(sock_, ptr, size, CPPHTTPLIB_RECV_FLAGS); });
37653773
#endif
37663774
}
37673775

@@ -3772,9 +3780,9 @@ inline ssize_t SocketStream::write(const char *ptr, size_t size) {
37723780
if (size > static_cast<size_t>((std::numeric_limits<int>::max)())) {
37733781
return -1;
37743782
}
3775-
return send(sock_, ptr, static_cast<int>(size), 0);
3783+
return send(sock_, ptr, static_cast<int>(size), CPPHTTPLIB_SEND_FLAGS);
37763784
#else
3777-
return handle_EINTR([&]() { return send(sock_, ptr, size, 0); });
3785+
return handle_EINTR([&]() { return send(sock_, ptr, size, CPPHTTPLIB_SEND_FLAGS); });
37783786
#endif
37793787
}
37803788

0 commit comments

Comments
 (0)