Skip to content

tests: convert base64 data to %b64[]#20547

Closed
bagder wants to merge 1 commit intomasterfrom
bagder/de-b64-tests
Closed

tests: convert base64 data to %b64[]#20547
bagder wants to merge 1 commit intomasterfrom
bagder/de-b64-tests

Conversation

@bagder
Copy link
Member

@bagder bagder commented Feb 8, 2026

To make it easier to read and understand tests - and grep them.

Perl script for the conversion. Provide the base64 blob as an argument on the command line:

use MIME::Base64;

# encode non-printable and <> into %XX
sub encode {
    my ($l) = @_;
    $l =~ s/([^\x20-\x7f]|\x3c|\x3e)/sprintf "%%%02x", ord $1/eg;
    return $l;
}

my $b = $ARGV[0];
my $o = decode_base64($b);
my $e = encode($o);
print "%b64[$e]b64%\n";

@bagder bagder added the tests label Feb 8, 2026
@bagder bagder changed the title test823: convert base64 data to %b64[] tests: convert base64 data to %b64[] Feb 8, 2026
@bagder bagder requested a review from Copilot February 8, 2026 23:22
@bagder bagder marked this pull request as ready for review February 8, 2026 23:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates curl’s protocol test definitions to replace opaque base64 blobs with the test-runner’s inline %b64[... ]b64% expansion syntax, improving readability and making auth payloads easier to search/grep.

Changes:

  • Convert SMTP/POP3/IMAP AUTH payloads from raw base64 to %b64[... ]b64% in many tests/data/test* files.
  • Represent binary delimiters explicitly using %NN escapes (e.g., %00, %01) inside the %b64[...]b64% blocks.
  • Update DIGEST-MD5 challenges/responses similarly to be human-readable pre-encoding.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/data/test992 Replace XOAUTH2 base64 payloads with %b64[...]b64% for SMTP server/client exchange.
tests/data/test937 Replace AUTH PLAIN base64 payloads with %b64[%00... ]b64% for SMTP.
tests/data/test936 Replace AUTH PLAIN base64 payloads with %b64[%00... ]b64% for SMTP.
tests/data/test935 Replace AUTH PLAIN base64 payloads with %b64[%00... ]b64% for SMTP.
tests/data/test922 Replace XOAUTH2 base64 initial response with %b64[...]b64% for SMTP.
tests/data/test920 Replace AUTH LOGIN password prompt/response base64 with %b64[...]b64% for SMTP.
tests/data/test919 Replace AUTH PLAIN base64 initial response with %b64[%00... ]b64% for SMTP.
tests/data/test908 Replace XOAUTH2 base64 payloads with %b64[...]b64% for SMTP server/client exchange.
tests/data/test907 Replace DIGEST-MD5 base64 challenge/response fields with %b64[...]b64% for SMTP.
tests/data/test904 Replace AUTH LOGIN password prompt/response base64 with %b64[...]b64% for SMTP.
tests/data/test903 Replace AUTH PLAIN base64 payloads with %b64[%00... ]b64% for SMTP.
tests/data/test892 Replace POP3 AUTH PLAIN base64 payloads with %b64[...]b64% including %00 separators.
tests/data/test881 Replace POP3 AUTH PLAIN base64 payloads with %b64[%00... ]b64%.
tests/data/test880 Replace POP3 AUTH PLAIN base64 payloads with %b64[%00... ]b64%.
tests/data/test879 Replace POP3 AUTH PLAIN base64 payloads with %b64[%00... ]b64%.
tests/data/test874 Replace POP3 XOAUTH2 base64 initial response with %b64[...]b64%.
tests/data/test872 Replace POP3 AUTH LOGIN prompt/response base64 with %b64[...]b64%.
tests/data/test871 Replace POP3 AUTH PLAIN base64 initial response with %b64[%00... ]b64%.
tests/data/test870 Replace POP3 XOAUTH2 base64 payloads with %b64[...]b64% for server/client exchange.
tests/data/test869 Replace POP3 DIGEST-MD5 base64 challenge/response fields with %b64[...]b64%.
tests/data/test866 Replace POP3 AUTH LOGIN prompt/response base64 with %b64[...]b64%.
tests/data/test865 Replace POP3 AUTH PLAIN base64 payloads with %b64[%00... ]b64%.
tests/data/test848 Replace IMAP AUTHENTICATE PLAIN base64 payloads with %b64[...]b64% including %00 separators.
tests/data/test835 Replace IMAP AUTHENTICATE PLAIN base64 payloads with %b64[%00... ]b64%.
tests/data/test834 Replace IMAP AUTHENTICATE PLAIN base64 payloads with %b64[%00... ]b64%.
tests/data/test833 Replace IMAP AUTHENTICATE PLAIN base64 payloads with %b64[%00... ]b64%.
tests/data/test828 Replace IMAP AUTHENTICATE XOAUTH2 base64 initial response with %b64[...]b64%.
tests/data/test826 Replace IMAP AUTHENTICATE LOGIN prompt/response base64 with %b64[...]b64%.
tests/data/test825 Replace IMAP AUTHENTICATE PLAIN base64 initial response with %b64[%00... ]b64%.
tests/data/test824 Replace IMAP XOAUTH2 base64 payloads with %b64[...]b64% for server/client exchange.
tests/data/test823 Replace IMAP DIGEST-MD5 base64 challenge/response fields with %b64[...]b64%.
tests/data/test820 Replace IMAP AUTHENTICATE LOGIN prompt/response base64 with %b64[...]b64%.
tests/data/test819 Replace IMAP AUTHENTICATE PLAIN base64 payloads with %b64[%00... ]b64%.
tests/data/test779 Replace IMAP XOAUTH2 base64 initial response with %b64[...]b64% (but see review comment).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bagder bagder force-pushed the bagder/de-b64-tests branch from eb86b4f to 3e26aba Compare February 8, 2026 23:46
@testclutch
Copy link

Analysis of PR #20547 at eb86b4fe:

Test ../../tests/http/test_12_reuse.py::TestReuse::test_12_01_h1_conn_close[http/1.1] failed, which has NOT been flaky recently, so there could be a real issue in this PR. Note that this test has failed in 2 different CI jobs (the link just goes to one of them).

Generated by Testclutch

To make it easier to read, understand and edit tests - and grep them.

Closes #20547
@bagder bagder force-pushed the bagder/de-b64-tests branch from c928c3e to df1cdd0 Compare February 9, 2026 07:18
@bagder bagder closed this in afe9fdd Feb 9, 2026
@bagder bagder deleted the bagder/de-b64-tests branch February 9, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants