mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07: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,
|
||||
};
|
||||
|
||||
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);
|
||||
return os;
|
||||
}
|
||||
|
@ -3123,9 +3122,7 @@ write_content_chunked(Stream &strm, const ContentProvider &content_provider,
|
|||
// Emit chunked response header and footer for each chunk
|
||||
auto chunk =
|
||||
from_i_to_hex(payload.size()) + "\r\n" + payload + "\r\n";
|
||||
if (!write_data(strm, chunk.data(), chunk.size())) {
|
||||
ok = false;
|
||||
}
|
||||
if (!write_data(strm, chunk.data(), chunk.size())) { ok = false; }
|
||||
}
|
||||
} else {
|
||||
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));
|
||||
if (ret < 0) {
|
||||
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) {
|
||||
#endif
|
||||
if (SSL_pending(ssl_) > 0) {
|
||||
return SSL_read(ssl_, ptr, static_cast<int>(size));
|
||||
} else if (is_readable()) {
|
||||
|
|
Loading…
Reference in a new issue