mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Fix #944
This commit is contained in:
parent
2917b8a005
commit
ba34ea4ee8
1 changed files with 10 additions and 8 deletions
12
httplib.h
12
httplib.h
|
@ -804,8 +804,7 @@ enum class Error {
|
||||||
Compression,
|
Compression,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream& operator << (std::ostream& os, const Error& obj)
|
inline std::ostream &operator<<(std::ostream &os, const Error &obj) {
|
||||||
{
|
|
||||||
os << static_cast<std::underlying_type<Error>::type>(obj);
|
os << static_cast<std::underlying_type<Error>::type>(obj);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
@ -3123,9 +3122,7 @@ write_content_chunked(Stream &strm, const ContentProvider &content_provider,
|
||||||
// Emit chunked response header and footer for each chunk
|
// Emit chunked response header and footer for each chunk
|
||||||
auto chunk =
|
auto chunk =
|
||||||
from_i_to_hex(payload.size()) + "\r\n" + payload + "\r\n";
|
from_i_to_hex(payload.size()) + "\r\n" + payload + "\r\n";
|
||||||
if (!write_data(strm, chunk.data(), chunk.size())) {
|
if (!write_data(strm, chunk.data(), chunk.size())) { ok = false; }
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ok = false;
|
ok = false;
|
||||||
|
@ -6674,7 +6671,12 @@ inline ssize_t SSLSocketStream::read(char *ptr, size_t size) {
|
||||||
auto ret = SSL_read(ssl_, ptr, static_cast<int>(size));
|
auto ret = SSL_read(ssl_, ptr, static_cast<int>(size));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
auto err = SSL_get_error(ssl_, ret);
|
auto err = SSL_get_error(ssl_, ret);
|
||||||
|
#ifdef _WIN32
|
||||||
|
while (err == SSL_ERROR_WANT_READ ||
|
||||||
|
err == SSL_ERROR_SYSCALL && WSAGetLastError() == WSAETIMEDOUT) {
|
||||||
|
#else
|
||||||
while (err == SSL_ERROR_WANT_READ) {
|
while (err == SSL_ERROR_WANT_READ) {
|
||||||
|
#endif
|
||||||
if (SSL_pending(ssl_) > 0) {
|
if (SSL_pending(ssl_) > 0) {
|
||||||
return SSL_read(ssl_, ptr, static_cast<int>(size));
|
return SSL_read(ssl_, ptr, static_cast<int>(size));
|
||||||
} else if (is_readable()) {
|
} else if (is_readable()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue