mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-27 08:37:58 +03:00
Minor optimization in HTTP requests.
--HG-- branch : dev
This commit is contained in:
@@ -730,6 +730,14 @@ Http::Response Http::downloadRequest(const Http::Request& request, IOStream& wri
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the response is compressed and the stream ended means that we received
|
||||
// the message. So we can skip the socket receive call.
|
||||
if ( ( compressed && NULL != inflateStream && !inflateStream->isOpen() ) ||
|
||||
( contentLength > 0 && contentLength == currentTotalBytes )
|
||||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,10 +106,9 @@ ios_size IOStreamInflate::write(const char * buffer, ios_size length) {
|
||||
int rc = inflate(&zstr, Z_NO_FLUSH);
|
||||
|
||||
if (rc == Z_STREAM_END) {
|
||||
ios_size ret = mStream.write( (const char*)mBuffer.data, mBuffer.size - zstr.avail_out);
|
||||
length = mStream.write( (const char*)mBuffer.data, mBuffer.size - zstr.avail_out);
|
||||
|
||||
if (ret == 0)
|
||||
return 0;
|
||||
mLocalStream->state = rc;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -156,7 +155,7 @@ ios_size IOStreamInflate::getSize() {
|
||||
}
|
||||
|
||||
bool IOStreamInflate::isOpen() {
|
||||
return mStream.isOpen();
|
||||
return mStream.isOpen() && mLocalStream->state != Z_STREAM_END;
|
||||
}
|
||||
|
||||
const Compression::Mode& IOStreamInflate::getMode() const {
|
||||
|
||||
Reference in New Issue
Block a user