MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / onHeadersBufferWritten

Method onHeadersBufferWritten

Libraries/Http/HttpAsyncClient.cpp:598–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
603void 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
653Result HttpAsyncClient::beginResponseRead()
654{
655 const bool addedResponseData = connection->getReadableTransportStream()

Callers

nothing calls this directly

Calls 11

AsyncBufferViewFunction · 0.85
getBoundaryMethod · 0.80
writtenMethod · 0.80
ResultClass · 0.50
pipeMethod · 0.45
startMethod · 0.45
writeMethod · 0.45
endMethod · 0.45
resetMethod · 0.45
appendMethod · 0.45
sizeInBytesMethod · 0.45

Tested by

no test coverage detected