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

Method findCookie

Libraries/HttpClient/HttpClientSession.cpp:720–740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

718 size_t remaining = sessionMemory.stateScratch.sizeInBytes() - stateScratchUsed;
719 for (size_t idx = 0; idx < sources.sizeInElements(); ++idx)
720 {
721 if (remaining < sources[idx].sizeInBytes())
722 return Result::Error(HttpClientResultCategory, HttpClientError::SessionStateStorageTooSmall);
723 remaining -= sources[idx].sizeInBytes();
724 }
725
726 size_t destinationOffset = stateScratchUsed;
727 for (size_t idx = 0; idx < sources.sizeInElements(); ++idx)
728 {
729 const StringSpan source = sources[idx];
730 if (source.isEmpty())
731 {
732 destinations[idx] = StringSpan(source.getEncoding());
733 continue;
734 }
735
736 char* const destinationBytes = sessionMemory.stateScratch.data() + destinationOffset;
737 ::memcpy(destinationBytes, source.bytesWithoutTerminator(), source.sizeInBytes());
738 destinations[idx] = StringSpan({destinationBytes, source.sizeInBytes()}, false, source.getEncoding());
739 destinationOffset += source.sizeInBytes();
740 }
741 stateScratchUsed = destinationOffset;
742 return Result(true);
743}

Callers 1

sessionLayerMethod · 0.80

Calls 1

Tested by 1

sessionLayerMethod · 0.64