Skip to content

[DISCUSS] Add a SBuf-based Base64 encoder/decoder#2452

Draft
kinkie wants to merge 14 commits into
squid-cache:masterfrom
kinkie:base64encoder
Draft

[DISCUSS] Add a SBuf-based Base64 encoder/decoder#2452
kinkie wants to merge 14 commits into
squid-cache:masterfrom
kinkie:base64encoder

Conversation

@kinkie

@kinkie kinkie commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Stemming from the converstaions in PR #2447 which focuses on
addressing a problem as narrowly as possible, develop a longer-term solution,
based around SBuf

@yadij yadij added the M-ignored-by-merge-bots https://github.com/measurement-factory/anubis/blob/master/README.md#pull-request-labels label Jun 27, 2026
@yadij

yadij commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

The only issue I see is that Squid base64 encoding is only used on buffers. So we would end up adding a stream just for the purpose of using the encoder.

@rousskov rousskov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had already flagged this API direction as problematic before this PR was posted. Will find time to detail that claim.

@rousskov rousskov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, the serious problems identified in this incomplete review are enough to warrant switching to a different approach to base64-encoding. There are other, mostly secondary problems in this PR that this review does not flag. Most will probably disappear on the adjusted path.

I can suggest starting with an API like this:

namespace AnyP {

/// A base64-encoded version of the given input.
SBuf Base64Encode(const SBuf &);

} // namespace AnyP

Comment thread src/base64/Base64Encoder.h Outdated
Comment thread src/base64/Base64Encoder.cc Outdated
Comment thread src/base64/Base64Encoder.h Outdated
@kinkie kinkie changed the title [DISCUSS] Prototype a Base64Encoder [DISCUSS] Add a SBuf-based Base64 encoder/decoder Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M-ignored-by-merge-bots https://github.com/measurement-factory/anubis/blob/master/README.md#pull-request-labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants