@@ -1231,37 +1231,22 @@ class winhttp_client : public _http_client_communicator
1231
1231
}
1232
1232
1233
1233
auto writebuf = p_request_context->_get_writebuffer ();
1234
- if ( !_check_streambuf (p_request_context, writebuf, _XPLATSTR (" Output stream is not open" )) )
1235
- break ;
1236
-
1237
- auto after_sync =
1238
- [hRequestHandle, p_request_context]
1239
- (pplx::task<void > sync_op)
1234
+
1235
+ if ( p_request_context->is_externally_allocated () )
1240
1236
{
1241
- try { sync_op.wait (); } catch (...)
1242
- {
1243
- p_request_context->report_exception (std::current_exception ());
1244
- return ;
1245
- }
1237
+ writebuf.commit (statusInfoLength);
1246
1238
1247
1239
// Look for more data
1248
- if ( !WinHttpQueryDataAvailable (hRequestHandle, nullptr ))
1240
+ if ( !WinHttpQueryDataAvailable (hRequestHandle, nullptr ))
1249
1241
{
1250
1242
p_request_context->report_error (GetLastError (), _XPLATSTR (" Error querying for http body chunk" ));
1251
1243
return ;
1252
1244
}
1253
- };
1254
-
1255
- if ( p_request_context->is_externally_allocated () )
1256
- {
1257
- writebuf.commit (statusInfoLength);
1258
-
1259
- writebuf.sync ().then (after_sync);
1260
1245
}
1261
1246
else
1262
1247
{
1263
1248
writebuf.putn (p_request_context->m_body_data .get (), statusInfoLength).then (
1264
- [hRequestHandle, p_request_context, statusInfoLength, after_sync ]
1249
+ [hRequestHandle, p_request_context, statusInfoLength]
1265
1250
(pplx::task<size_t > op)
1266
1251
{
1267
1252
size_t written = 0 ;
@@ -1278,11 +1263,12 @@ class winhttp_client : public _http_client_communicator
1278
1263
return ;
1279
1264
}
1280
1265
1281
- auto wbuf = p_request_context->_get_writebuffer ();
1282
- if ( !_check_streambuf (p_request_context, wbuf, _XPLATSTR (" Output stream is not open" )) )
1266
+ // Look for more data
1267
+ if (!WinHttpQueryDataAvailable (hRequestHandle, nullptr ))
1268
+ {
1269
+ p_request_context->report_error (GetLastError (), _XPLATSTR (" Error querying for http body chunk" ));
1283
1270
return ;
1284
-
1285
- wbuf.sync ().then (after_sync);
1271
+ }
1286
1272
});
1287
1273
}
1288
1274
}
0 commit comments