| 613 | } |
| 614 | |
| 615 | Result 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 | |
| 627 | Result HttpWriteBasicAuthorizationCredentials(StringSpan username, StringSpan password, Span<char> storage, |
| 628 | StringSpan& output) |