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
615Result HttpWriteBasicAuthorization(StringSpan base64Credentials, Span<char> storage, StringSpan& output)
616{
617 output = {};
618 size_t offset = 0;
619 SC_TRY_MSG(not base64Credentials.isEmpty(), "Basic authorization credentials are empty");
620 SC_TRY_MSG(HttpHeaderInternal::appendTo(storage, offset, "Basic "), "Authorization output buffer is too small");
621 SC_TRY_MSG(HttpHeaderInternal::appendTo(storage, offset, base64Credentials),
622 "Authorization output buffer is too small");
623 output = {{storage.data(), offset}, false, StringEncoding::Ascii};
624 return Result(true);
625}
626
627Result HttpWriteBasicAuthorizationCredentials(StringSpan username, StringSpan password, Span<char> storage,
628 StringSpan& output)

Callers 1

headerBuildersMethod · 0.85

Calls 3

ResultClass · 0.50
isEmptyMethod · 0.45
dataMethod · 0.45

Tested by 1

headerBuildersMethod · 0.68