Skip to content

Conversation

@ok2c
Copy link
Member

@ok2c ok2c commented Dec 15, 2025

I chose the default limit on 5 elements for no particular reason. I doubt even two compression codecs in the compression chain would be reasonable, so I chose 5 as 'crazy' enough for the majority of sane scenarios.

@arturobernalg Please rewiew

@ok2c ok2c requested a review from arturobernalg December 15, 2025 11:46
Copy link
Member

@arturobernalg arturobernalg left a comment

Choose a reason for hiding this comment

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

LGTM

final ParserCursor cursor = new ParserCursor(0, contentEncoding.length());
final HeaderElement[] codecs = BasicHeaderValueParser.INSTANCE.parseElements(contentEncoding, cursor);
if (maxCodecListLen > 0 && codecs.length > maxCodecListLen) {
throw new ProtocolException("Codec list exceeds maxumum of " + maxCodecListLen + " elements");
Copy link
Member

Choose a reason for hiding this comment

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

  • “maxumum” → maximum
  • Should we validate maxCodecListLen and reject negative values with an IllegalArgumentException?

Copy link
Member Author

Choose a reason for hiding this comment

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

@arturobernalg

“maxumum” → maximum

Corrected

Should we validate maxCodecListLen and reject negative values with an IllegalArgumentException?

This is an internal class. We control the input. If we ever make the class public, that would be a reasonable improvement

@ok2c ok2c force-pushed the limit_codec_list_len branch from 4d1b8ec to 7ab0fea Compare December 15, 2025 20:39
@ok2c ok2c merged commit 87d86a1 into apache:5.5.x Dec 15, 2025
8 checks passed
@ok2c ok2c deleted the limit_codec_list_len branch December 16, 2025 19:05
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