@@ -1254,37 +1254,22 @@ class winhttp_client : public _http_client_communicator
12541254 }
12551255
12561256 auto writebuf = p_request_context->_get_writebuffer ();
1257- if ( !_check_streambuf (p_request_context, writebuf, _XPLATSTR (" Output stream is not open" )) )
1258- break ;
1259-
1260- auto after_sync =
1261- [hRequestHandle, p_request_context]
1262- (pplx::task<void > sync_op)
1257+
1258+ if ( p_request_context->is_externally_allocated () )
12631259 {
1264- try { sync_op.wait (); } catch (...)
1265- {
1266- p_request_context->report_exception (std::current_exception ());
1267- return ;
1268- }
1260+ writebuf.commit (statusInfoLength);
12691261
12701262 // Look for more data
1271- if ( !WinHttpQueryDataAvailable (hRequestHandle, nullptr ))
1263+ if ( !WinHttpQueryDataAvailable (hRequestHandle, nullptr ))
12721264 {
12731265 p_request_context->report_error (GetLastError (), _XPLATSTR (" Error querying for http body chunk" ));
12741266 return ;
12751267 }
1276- };
1277-
1278- if ( p_request_context->is_externally_allocated () )
1279- {
1280- writebuf.commit (statusInfoLength);
1281-
1282- writebuf.sync ().then (after_sync);
12831268 }
12841269 else
12851270 {
12861271 writebuf.putn (p_request_context->m_body_data .get (), statusInfoLength).then (
1287- [hRequestHandle, p_request_context, statusInfoLength, after_sync ]
1272+ [hRequestHandle, p_request_context, statusInfoLength]
12881273 (pplx::task<size_t > op)
12891274 {
12901275 size_t written = 0 ;
@@ -1301,11 +1286,12 @@ class winhttp_client : public _http_client_communicator
13011286 return ;
13021287 }
13031288
1304- auto wbuf = p_request_context->_get_writebuffer ();
1305- if ( !_check_streambuf (p_request_context, wbuf, _XPLATSTR (" Output stream is not open" )) )
1289+ // Look for more data
1290+ if (!WinHttpQueryDataAvailable (hRequestHandle, nullptr ))
1291+ {
1292+ p_request_context->report_error (GetLastError (), _XPLATSTR (" Error querying for http body chunk" ));
13061293 return ;
1307-
1308- wbuf.sync ().then (after_sync);
1294+ }
13091295 });
13101296 }
13111297 }
0 commit comments