Skip to content

HTTPCLIENT-2395: Avoid double-encoding of RFC 5987 filename* and pass through pre-encoded values#723

Merged
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:HTTPCLIENT-2395
Sep 18, 2025
Merged

HTTPCLIENT-2395: Avoid double-encoding of RFC 5987 filename* and pass through pre-encoded values#723
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:HTTPCLIENT-2395

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Make ConnPoolSupport.formatStats null-safe to prevent NPEs during lease/shutdown. Add multipart tests covering EXTENDED mode and pre-encoded filename*.

if (value.startsWith("UTF-8''")) {
writeBytes(value, StandardCharsets.US_ASCII, out);
} else {
final String encodedValue = "UTF-8''" + PercentCodec.RFC5987.encode(value);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@arturobernalg Could you please use StringBuilder and PercentCodec#encode(StringBuilder, CharSequence) here? Small optimization but still a bit less garbage.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@ok2c done

… through pre-encoded values.

Make ConnPoolSupport.formatStats null-safe to prevent NPEs during lease/shutdown.
Add multipart tests covering EXTENDED mode and pre-encoded filename*.
@arturobernalg arturobernalg merged commit 4d30dbb into apache:master Sep 18, 2025
10 checks passed
@arturobernalg

Copy link
Copy Markdown
Member Author

@ok2c cherry-pick to 5.5.x. as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants