awslabs / aws-c-http

C99 implementation of the HTTP/1.1 and HTTP/2 specifications
Apache License 2.0
136 stars 42 forks source link

Better helper functions for querying header values #412

Closed graebm closed 1 year ago

graebm commented 1 year ago

Issue:

Our one helper function for querying header values isn't great. It works like this:

Get the first value for this name, ignoring any additional values.

This does not help us query headers with comma-separated values, which may be split across multiple entries.

Also, it's vulnerable to maliciously constructed headers (i.e. has multiple "Content-Length" entries).

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov-commenter commented 1 year ago

Codecov Report

Base: 79.29% // Head: 79.29% // Decreases project coverage by -0.00% :warning:

Coverage data is based on head (72ef396) compared to base (69b952e). Patch coverage: 91.93% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #412 +/- ## ========================================== - Coverage 79.29% 79.29% -0.01% ========================================== Files 27 27 Lines 11759 11806 +47 ========================================== + Hits 9324 9361 +37 - Misses 2435 2445 +10 ``` | [Impacted Files](https://codecov.io/gh/awslabs/aws-c-http/pull/412?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs) | Coverage Δ | | |---|---|---| | [source/http.c](https://codecov.io/gh/awslabs/aws-c-http/pull/412/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs#diff-c291cmNlL2h0dHAuYw==) | `53.19% <ø> (ø)` | | | [source/request\_response.c](https://codecov.io/gh/awslabs/aws-c-http/pull/412/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs#diff-c291cmNlL3JlcXVlc3RfcmVzcG9uc2UuYw==) | `81.87% <91.93%> (+0.44%)` | :arrow_up: | | [source/hpack\_huffman\_static.c](https://codecov.io/gh/awslabs/aws-c-http/pull/412/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs#diff-c291cmNlL2hwYWNrX2h1ZmZtYW5fc3RhdGljLmM=) | `34.13% <0.00%> (-0.16%)` | :arrow_down: | | [source/h2\_connection.c](https://codecov.io/gh/awslabs/aws-c-http/pull/412/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs#diff-c291cmNlL2gyX2Nvbm5lY3Rpb24uYw==) | `82.81% <0.00%> (-0.16%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=awslabs)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.