forked from premiere/premiere-libtorrent
http_connection gzip fix
This commit is contained in:
parent
9571fd566f
commit
0f0fb82407
|
@ -65,7 +65,7 @@ namespace libtorrent
|
|||
const int total_size = size;
|
||||
|
||||
// The zip header cannot be shorter than 10 bytes
|
||||
if (size < 10) return -1;
|
||||
if (size < 10 || buf == 0) return -1;
|
||||
|
||||
// check the magic header of gzip
|
||||
if ((buffer[0] != GZIP_MAGIC0) || (buffer[1] != GZIP_MAGIC1)) return -1;
|
||||
|
|
|
@ -484,7 +484,7 @@ void http_connection::callback(error_code const& e, char const* data, int size)
|
|||
if (m_bottled && m_parser.header_finished())
|
||||
{
|
||||
std::string const& encoding = m_parser.header("content-encoding");
|
||||
if (encoding == "gzip" || encoding == "x-gzip")
|
||||
if ((encoding == "gzip" || encoding == "x-gzip") && size > 0 && data)
|
||||
{
|
||||
std::string error;
|
||||
if (inflate_gzip(data, size, buf, max_bottled_buffer, error))
|
||||
|
|
Loading…
Reference in New Issue