File tree Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Expand file tree Collapse file tree 2 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -835,20 +835,16 @@ class winhttp_client : public _http_client_communicator
835
835
}
836
836
_ASSERTE (read != static_cast <size_t >(-1 ));
837
837
838
- if ( read == 0 )
838
+ if (read == 0 )
839
839
{
840
- // Unexpected end-of-stream.
841
- if (!(rbuf.exception () == nullptr ))
842
- p_request_context->report_exception (rbuf.exception ());
843
- else
844
- p_request_context->report_error (GetLastError (), _XPLATSTR (" Error reading outgoing HTTP body from its stream." ));
840
+ p_request_context->report_exception (http_exception (U (" Unexpected end of request body stream encountered before Content-Length met." )));
845
841
return ;
846
842
}
847
843
848
844
p_request_context->m_remaining_to_write -= read;
849
845
850
846
// Stop writing chunks after this one if no more data.
851
- if ( p_request_context->m_remaining_to_write == 0 )
847
+ if (p_request_context->m_remaining_to_write == 0 )
852
848
{
853
849
p_request_context->m_bodyType = no_body;
854
850
}
Original file line number Diff line number Diff line change @@ -279,16 +279,15 @@ class IResponseStream
279
279
*pcbWritten = 0 ;
280
280
}
281
281
282
+ if (cb == 0 )
283
+ {
284
+ return S_OK;
285
+ }
286
+
282
287
try
283
288
{
284
289
auto buffer = context->_get_writebuffer ();
285
- if ( cb == 0 )
286
- {
287
- buffer.sync ().wait ();
288
- return S_OK;
289
- }
290
-
291
- const size_t count = buffer.putn ((const uint8_t *)pv, (size_t )cb).get ();
290
+ const size_t count = buffer.putn (reinterpret_cast <uint8_t *>(pv), static_cast <size_t >(cb)).get ();
292
291
293
292
_ASSERTE (count != static_cast <size_t >(-1 ));
294
293
_ASSERTE (count <= static_cast <size_t >(ULONG_MAX));
@@ -299,7 +298,7 @@ class IResponseStream
299
298
context->m_downloaded += count;
300
299
301
300
auto progress = context->m_request ._get_impl ()->_progress_handler ();
302
- if ( progress && count > 0 )
301
+ if (progress && count > 0 )
303
302
{
304
303
try { (*progress)(message_direction::download, context->m_downloaded ); } catch (...)
305
304
{
You can’t perform that action at this time.
0 commit comments