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

Function HttpWriteBasicAuthorization

Libraries/Http/HttpHeaders.cpp:615–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

613 }
614 if (colonIndex == static_cast<size_t>(-1))
615 return Result::Error(HttpResultCategory, HttpError::BasicPasswordSeparatorMissing);
616
617 username = {{storage.data(), colonIndex}, false, StringEncoding::Ascii};
618 password = {{storage.data() + colonIndex + 1, decodedSize - colonIndex - 1}, false, StringEncoding::Ascii};
619 return Result(true);
620}
621
622Result HttpWriteBearerAuthorization(StringSpan token, Span<char> storage, StringSpan& output)
623{
624 output = {};
625 size_t offset = 0;
626 if (token.isEmpty())
627 return Result::Error(HttpResultCategory, HttpError::BearerTokenEmpty);
628 if (not HttpHeaderInternal::appendTo(storage, offset, "Bearer ") or

Callers 1

headerBuildersMethod · 0.85

Calls 3

ResultClass · 0.50
isEmptyMethod · 0.45
dataMethod · 0.45

Tested by 1

headerBuildersMethod · 0.68