mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-21 11:39:48 +00:00
Fix 'no TLS' problem with RequestWithoutContentLengthOrTransferEncoding
This commit is contained in:
1 parent
1f1a799d13
commit
02e4c53685
2 files changed
+9
-1
No files matched your search
@@ -9869,7 +9869,11 @@ inline bool Server::read_content_core(
|
|||||||
payload_max_length_ < (std::numeric_limits<size_t>::max)()) {
|
payload_max_length_ < (std::numeric_limits<size_t>::max)()) {
|
||||||
socket_t s = strm.socket();
|
socket_t s = strm.socket();
|
||||||
if (s != INVALID_SOCKET) {
|
if (s != INVALID_SOCKET) {
|
||||||
// Peek to check if there is any pending data
|
// Use a non-blocking check to see if there is any pending data.
|
||||||
|
// A blocking recv(MSG_PEEK) would deadlock when the client is
|
||||||
|
// waiting for the response (e.g. POST with Connection: close and
|
||||||
|
// no body).
|
||||||
|
if (detail::select_read(s, 0, 0) > 0) {
|
||||||
char peekbuf[1];
|
char peekbuf[1];
|
||||||
ssize_t n = ::recv(s, peekbuf, 1, MSG_PEEK);
|
ssize_t n = ::recv(s, peekbuf, 1, MSG_PEEK);
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
@@ -9886,6 +9890,7 @@ inline bool Server::read_content_core(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ mbedtls:
|
|||||||
@(cd test && make test_mbedtls && LSAN_OPTIONS=suppressions=lsan_suppressions.txt ./test_mbedtls)
|
@(cd test && make test_mbedtls && LSAN_OPTIONS=suppressions=lsan_suppressions.txt ./test_mbedtls)
|
||||||
@(cd test && make proxy_mbedtls)
|
@(cd test && make proxy_mbedtls)
|
||||||
|
|
||||||
|
no_tls:
|
||||||
|
@(cd test && make test_no_tls && ./test_no_tls)
|
||||||
|
|
||||||
fuzz:
|
fuzz:
|
||||||
@(cd test && make fuzz_test)
|
@(cd test && make fuzz_test)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user