Register before starting the body stream, which can synchronously emit buffered body data.
| 266 | HttpAsyncServerTransportSetup setup; |
| 267 | setup.connection = &client; |
| 268 | setup.eventLoop = eventLoop; |
| 269 | setup.complete = {[this, &client](Result result) { onTransportSetupComplete(client, result); }}; |
| 270 | setup.fail = {[this, &client](Result result) |
| 271 | { |
| 272 | if (onError.isValid()) |
| 273 | { |
| 274 | onError(result); |
| 275 | } |
| 276 | closeAsync(client); |
| 277 | }}; |
| 278 | return transportSetup(setup); |
| 279 | } |
| 280 | |
| 281 | void HttpAsyncServer::onTransportSetupComplete(HttpConnection& client, Result result) |
| 282 | { |
| 283 | if (not result) |
| 284 | { |
| 285 | if (onError.isValid()) |
| 286 | { |
| 287 | onError(result); |
| 288 | } |
| 289 | closeAsync(client); |
| 290 | return; |
| 291 | } |
| 292 | |
| 293 | Result setup = beginHttpConnection(client); |
| 294 | if (not setup) |
| 295 | { |
| 296 | if (onError.isValid()) |
| 297 | { |
| 298 | onError(setup); |
| 299 | } |
| 300 | closeAsync(client); |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | void HttpAsyncServer::onStreamReceive(HttpConnection& client, AsyncBufferView::ID bufferID) |
| 305 | { |
| 306 | Span<char> readData; |
| 307 | SC_HTTP_ASSERT_RELEASE(client.buffersPool.getWritableData(bufferID, readData)); |
| 308 | |
| 309 | Result headerWrite = |
| 310 | client.request.writeHeaders(maxHeaderSize, readData, client.getReadableTransportStream(), bufferID); |
| 311 | if (not headerWrite) |
| 312 | { |
| 313 | if (onError.isValid()) |
| 314 | { |
nothing calls this directly
no outgoing calls
no test coverage detected