| 596 | ::memset(currentHostStorage, 0, sizeof(currentHostStorage)); |
| 597 | ::memcpy(currentHostStorage, currentURL.host.bytesWithoutTerminator(), hostLen); |
| 598 | currentHost = StringSpan::fromNullTerminated(currentHostStorage, StringEncoding::Ascii); |
| 599 | currentPort = currentURL.port; |
| 600 | return Result(true); |
| 601 | } |
| 602 | |
| 603 | void HttpAsyncClient::completeTransportSetup(Result result) |
| 604 | { |
| 605 | if (state != State::Connecting or connection == nullptr) |
| 606 | { |
| 607 | return; |
| 608 | } |
| 609 | if (not result) |
| 610 | { |
| 611 | fail(result); |
| 612 | return; |
| 613 | } |
| 614 | |
| 615 | const bool addedReadableError = |
| 616 | connection->getReadableTransportStream() |
| 617 | .eventError.addListener<HttpAsyncClient, &HttpAsyncClient::onReadableError>(*this); |
| 618 | const bool addedWritableError = |
| 619 | connection->getWritableTransportStream() |
| 620 | .eventError.addListener<HttpAsyncClient, &HttpAsyncClient::onWritableError>(*this); |
| 621 | const bool addedReadableEnd = |
| 622 | connection->getReadableTransportStream().eventEnd.addListener<HttpAsyncClient, &HttpAsyncClient::onReadableEnd>( |
| 623 | *this); |
| 624 | const bool addedPipelineError = |
| 625 | connection->pipeline.eventError.addListener<HttpAsyncClient, &HttpAsyncClient::onPipelineError>(*this); |
| 626 | SC_HTTP_ASSERT_RELEASE(addedReadableError); |
| 627 | SC_HTTP_ASSERT_RELEASE(addedWritableError); |
| 628 | SC_HTTP_ASSERT_RELEASE(addedReadableEnd); |
| 629 | SC_HTTP_ASSERT_RELEASE(addedPipelineError); |
| 630 | |
| 631 | Result origin = rememberConnectedOrigin(); |
| 632 | if (not origin) |
| 633 | { |
| 634 | fail(origin); |
| 635 | return; |
| 636 | } |
| 637 | |
| 638 | hasOpenConnection = true; |
| 639 | |
| 640 | Result responseStart = beginResponseRead(); |
| 641 | if (not responseStart) |
| 642 | { |
| 643 | fail(responseStart); |
| 644 | return; |
| 645 | } |
| 646 | Result sendResult = beginRequestSend(); |
| 647 | if (not sendResult) |
| 648 | { |
| 649 | fail(sendResult); |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | Result HttpAsyncClient::beginResponseRead() |
| 654 | { |
| 655 | const bool addedResponseData = connection->getReadableTransportStream() |
nothing calls this directly
no test coverage detected