| 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 | |
| 622 | Result 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 |