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

Fix minor warning for #1377 #1632

Merged
merged 1 commit into from
Jun 2, 2022
Merged

Fix minor warning for #1377 #1632

merged 1 commit into from
Jun 2, 2022

Conversation

krizhanovsky
Copy link
Contributor

@krizhanovsky krizhanovsky commented May 29, 2022

If a server sends empty header (e.g. add_header X-Crash-1377 ' '; for Nginx), then tfw_hpack_node_compare() may raise WARN_ON_ONCE(state != HPACK_HDR_VALUE_FOUND).

In case of empty header tfw_hpack_add_node() -> tfw_http_hdr_split() strips spaces and ':' so we may fall to the warning statement with matching the header name only, but HPACK_HDR_OWS_PROCESS() didn't move state to HPACK_HDR_NAME_FOUND (beacuse no spaces and no ':').

The patch moves the hdr processing tail out of the loop, so hlen might be non-zero after the main loop and WARN_ON_ONCE(hlen) is also eliminated.

Nginx), then tfw_hpack_node_compare() may raise
WARN_ON_ONCE(state != HPACK_HDR_VALUE_FOUND).

In case of empty header tfw_hpack_add_node() -> tfw_http_hdr_split()
strips spaces and ':' so we may fall to the warning statement with
matching the header name only, but HPACK_HDR_OWS_PROCESS() didn't
move @State to HPACK_HDR_NAME_FOUND (beacuse no spaces and no ':').

The patch moves the @HDR processing tail out of the loop, so hlen
might be non-zero after the main loop and WARN_ON_ONCE(hlen) is
also eliminated.
@krizhanovsky krizhanovsky requested a review from s0nx May 29, 2022 20:03
@HDR
Copy link

HDR commented May 30, 2022

Going to assume the mention was unintentional 😄

@krizhanovsky
Copy link
Contributor Author

Going to assume the mention was unintentional smile

@HDR, Yes, sorry - just copy & pasted comment with doxygen's @.

@krizhanovsky krizhanovsky merged commit 38cfaf2 into master Jun 2, 2022
@krizhanovsky krizhanovsky deleted the ak-1377-empy-hdr-warn branch June 2, 2022 14:58
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.

3 participants