@@ -274,7 +274,7 @@ namespace web { namespace http
274
274
}
275
275
276
276
std::unique_ptr<boost::asio::ssl::stream<tcp::socket &> > m_ssl_stream;
277
- uint64_t m_known_size ;
277
+ uint64_t m_content_length ;
278
278
bool m_needChunked;
279
279
bool m_timedout;
280
280
boost::asio::streambuf m_body_buf;
@@ -381,7 +381,7 @@ namespace web { namespace http
381
381
{
382
382
ctx->m_needChunked = true ;
383
383
}
384
- else if (!ctx->m_request .headers ().match (header_names::content_length, ctx->m_known_size ))
384
+ else if (!ctx->m_request .headers ().match (header_names::content_length, ctx->m_content_length ))
385
385
{
386
386
// Stream without content length is the signal of requiring transfer encoding chunked.
387
387
if (ctx->m_request .body ())
@@ -627,7 +627,7 @@ namespace web { namespace http
627
627
628
628
void handle_write_large_body (const boost::system::error_code& ec, const std::shared_ptr<linux_client_request_context> &ctx)
629
629
{
630
- if (ec || ctx->m_uploaded >= ctx->m_known_size )
630
+ if (ec || ctx->m_uploaded >= ctx->m_content_length )
631
631
{
632
632
// Reuse error handling.
633
633
return handle_write_body (ec, ctx);
@@ -664,7 +664,7 @@ namespace web { namespace http
664
664
}
665
665
};
666
666
667
- const auto readSize = static_cast <size_t >(std::min (static_cast <uint64_t >(client_config ().chunksize ()), ctx->m_known_size - ctx->m_uploaded ));
667
+ const auto readSize = static_cast <size_t >(std::min (static_cast <uint64_t >(client_config ().chunksize ()), ctx->m_content_length - ctx->m_uploaded ));
668
668
669
669
auto readbuf = ctx->_get_readbuffer ();
670
670
readbuf.getn (boost::asio::buffer_cast<uint8_t *>(ctx->m_body_buf .prepare (readSize)), readSize)
@@ -829,12 +829,12 @@ namespace web { namespace http
829
829
}
830
830
ctx->complete_headers ();
831
831
832
- ctx->m_known_size = std::numeric_limits<size_t >::max (); // Without Content-Length header, size should be same as TCP stream - set it size_t max.
833
- ctx->m_response .headers ().match (header_names::content_length, ctx->m_known_size );
832
+ ctx->m_content_length = std::numeric_limits<size_t >::max (); // Without Content-Length header, size should be same as TCP stream - set it size_t max.
833
+ ctx->m_response .headers ().match (header_names::content_length, ctx->m_content_length );
834
834
835
835
// note: need to check for 'chunked' here as well, azure storage sends both
836
836
// transfer-encoding:chunked and content-length:0 (although HTTP says not to)
837
- if (ctx->m_request .method () == U (" HEAD" ) || (!needChunked && ctx->m_known_size == 0 ))
837
+ if (ctx->m_request .method () == U (" HEAD" ) || (!needChunked && ctx->m_content_length == 0 ))
838
838
{
839
839
// we can stop early - no body
840
840
auto progress = ctx->m_request ._get_impl ()->_progress_handler ();
@@ -857,7 +857,7 @@ namespace web { namespace http
857
857
{
858
858
if (!needChunked)
859
859
{
860
- async_read_until_buffersize (static_cast <size_t >(std::min (ctx->m_known_size , static_cast <uint64_t >(client_config ().chunksize ()))),
860
+ async_read_until_buffersize (static_cast <size_t >(std::min (ctx->m_content_length , static_cast <uint64_t >(client_config ().chunksize ()))),
861
861
boost::bind (&linux_client::handle_read_content, shared_from_this (), boost::asio::placeholders::error, ctx), ctx);
862
862
}
863
863
else
@@ -1003,9 +1003,9 @@ namespace web { namespace http
1003
1003
1004
1004
if (ec)
1005
1005
{
1006
- if (ec == boost::asio::error::eof && ctx->m_known_size == std::numeric_limits<size_t >::max ())
1006
+ if (ec == boost::asio::error::eof && ctx->m_content_length == std::numeric_limits<size_t >::max ())
1007
1007
{
1008
- ctx->m_known_size = ctx->m_downloaded + ctx->m_body_buf .size ();
1008
+ ctx->m_content_length = ctx->m_downloaded + ctx->m_body_buf .size ();
1009
1009
}
1010
1010
else
1011
1011
{
@@ -1028,13 +1028,13 @@ namespace web { namespace http
1028
1028
}
1029
1029
}
1030
1030
1031
- if (ctx->m_downloaded < ctx->m_known_size )
1031
+ if (ctx->m_downloaded < ctx->m_content_length )
1032
1032
{
1033
1033
ctx->reset_timer (static_cast <int >(client_config ().timeout ().count ()));
1034
1034
1035
1035
// more data need to be read
1036
1036
writeBuffer.putn (boost::asio::buffer_cast<const uint8_t *>(ctx->m_body_buf .data ()),
1037
- static_cast <size_t >(std::min (static_cast <uint64_t >(ctx->m_body_buf .size ()), ctx->m_known_size - ctx->m_downloaded )))
1037
+ static_cast <size_t >(std::min (static_cast <uint64_t >(ctx->m_body_buf .size ()), ctx->m_content_length - ctx->m_downloaded )))
1038
1038
.then ([=](pplx::task<size_t > op)
1039
1039
{
1040
1040
size_t writtenSize = 0 ;
@@ -1044,7 +1044,7 @@ namespace web { namespace http
1044
1044
ctx->m_downloaded += static_cast <uint64_t >(writtenSize);
1045
1045
ctx->m_body_buf .consume (writtenSize);
1046
1046
1047
- async_read_until_buffersize (static_cast <size_t >(std::min (static_cast <uint64_t >(client_config ().chunksize ()), ctx->m_known_size - ctx->m_downloaded )),
1047
+ async_read_until_buffersize (static_cast <size_t >(std::min (static_cast <uint64_t >(client_config ().chunksize ()), ctx->m_content_length - ctx->m_downloaded )),
1048
1048
boost::bind (&linux_client::handle_read_content, shared_from_this (), boost::asio::placeholders::error, ctx), ctx);
1049
1049
}
1050
1050
catch (...)
@@ -1094,7 +1094,7 @@ namespace web { namespace http
1094
1094
http_request request,
1095
1095
const std::shared_ptr<linux_connection> &connection)
1096
1096
: request_context(client, request)
1097
- , m_known_size (0 )
1097
+ , m_content_length (0 )
1098
1098
, m_needChunked(false )
1099
1099
, m_timedout(false )
1100
1100
, m_timeout_timer(crossplat::threadpool::shared_instance().service())
0 commit comments