mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
fix #500. check result of readline
This commit is contained in:
parent
f10064ce39
commit
f01f6e94d1
@ -716,12 +716,14 @@ namespace client
|
|||||||
if (status == 200) // OK
|
if (status == 200) // OK
|
||||||
{
|
{
|
||||||
bool isChunked = false, isGzip = false;
|
bool isChunked = false, isGzip = false;
|
||||||
|
m_Etag = ""; m_LastModified = "";
|
||||||
std::string header, statusMessage;
|
std::string header, statusMessage;
|
||||||
std::getline (response, statusMessage);
|
std::getline (response, statusMessage);
|
||||||
// read until new line meaning end of header
|
// read until new line meaning end of header
|
||||||
while (!response.eof () && header != "\r")
|
while (!response.eof () && header != "\r")
|
||||||
{
|
{
|
||||||
std::getline (response, header);
|
std::getline (response, header);
|
||||||
|
if (response.fail ()) break;
|
||||||
auto colon = header.find (':');
|
auto colon = header.find (':');
|
||||||
if (colon != std::string::npos)
|
if (colon != std::string::npos)
|
||||||
{
|
{
|
||||||
@ -741,7 +743,7 @@ namespace client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogPrint (eLogInfo, "Addressbook: received ", m_Link, " ETag: ", m_Etag, " Last-Modified: ", m_LastModified);
|
LogPrint (eLogInfo, "Addressbook: received ", m_Link, " ETag: ", m_Etag, " Last-Modified: ", m_LastModified);
|
||||||
if (!response.eof ())
|
if (!response.eof () && !response.fail ())
|
||||||
{
|
{
|
||||||
success = true;
|
success = true;
|
||||||
if (!isChunked)
|
if (!isChunked)
|
||||||
|
Loading…
Reference in New Issue
Block a user