@@ -1254,37 +1254,22 @@ class winhttp_client : public _http_client_communicator
1254
1254
}
1255
1255
1256
1256
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 () )
1263
1259
{
1264
- try { sync_op.wait (); } catch (...)
1265
- {
1266
- p_request_context->report_exception (std::current_exception ());
1267
- return ;
1268
- }
1260
+ writebuf.commit (statusInfoLength);
1269
1261
1270
1262
// Look for more data
1271
- if ( !WinHttpQueryDataAvailable (hRequestHandle, nullptr ))
1263
+ if ( !WinHttpQueryDataAvailable (hRequestHandle, nullptr ))
1272
1264
{
1273
1265
p_request_context->report_error (GetLastError (), _XPLATSTR (" Error querying for http body chunk" ));
1274
1266
return ;
1275
1267
}
1276
- };
1277
-
1278
- if ( p_request_context->is_externally_allocated () )
1279
- {
1280
- writebuf.commit (statusInfoLength);
1281
-
1282
- writebuf.sync ().then (after_sync);
1283
1268
}
1284
1269
else
1285
1270
{
1286
1271
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]
1288
1273
(pplx::task<size_t > op)
1289
1274
{
1290
1275
size_t written = 0 ;
@@ -1301,11 +1286,12 @@ class winhttp_client : public _http_client_communicator
1301
1286
return ;
1302
1287
}
1303
1288
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" ));
1306
1293
return ;
1307
-
1308
- wbuf.sync ().then (after_sync);
1294
+ }
1309
1295
});
1310
1296
}
1311
1297
}
0 commit comments