Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore empty values when returning canonical form of header values #307

Merged
merged 2 commits into from
Sep 29, 2021

Conversation

glbrntt
Copy link
Contributor

@glbrntt glbrntt commented Sep 29, 2021

Motivation:

The return value from HPACKHeaders.subscript(canonicalForm:) is
inconsistent with respect to returning empty strings.

If a value for a header field is an empty string then the canonical form
will not return that empty string. However, if a value is a string
containing only whitespace then an empty string will be returned.

Modifications:

  • Filter out empty substrings after trimming whitespace
  • Add a test

Result:

  • HPACKHeaders.subscript(canonicalForm:) does not produce empty strings

@glbrntt glbrntt requested a review from Lukasa September 29, 2021 09:38
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Sep 29, 2021
Motivation:

The return value from `HPACKHeaders.subscript(canonicalForm:)` is
inconsistent with respect to returning empty strings.

If a value for a header field is an empty string then the canonical form
will not return that empty string. However, if a value is a string
containing only whitespace then an empty string will be returned.

Modifications:

- Filter out empty substrings after trimming whitespace
- Add a test

Result:

- `HPACKHeaders.subscript(canonicalForm:)` does not produce empty strings
@glbrntt glbrntt force-pushed the gb-no-empty-strings-for-canonical-form branch from bd32469 to d402ae8 Compare September 29, 2021 09:55
@glbrntt glbrntt requested a review from Lukasa September 29, 2021 11:52
@Lukasa Lukasa merged commit cce39c3 into apple:main Sep 29, 2021
@glbrntt glbrntt deleted the gb-no-empty-strings-for-canonical-form branch September 29, 2021 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants