http_server: http1: Fix ignored query string - #12295
Conversation
The HTTP server discards the query string before processing the request, resulting in the query string being entirely missing for downstream plugins. This issue happens on HTTP1 only. The fix re-appends the query string to the path to be processed by `flb_http_request_normalize()` the same way currently done in HTTP2 with the `:path` pseudo-header already containing the query string. Signed-off-by: Ra'Jiska <dodo.lasticot@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe HTTP/1 request handler now appends a non-empty query string to the request path before normalization. It uses a temporary SDS result and aborts processing when either append operation fails. ChangesHTTP/1 query string path handling
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change restores query-string handling for HTTP/1 requests; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8a57fbc2d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (session->inner_request.query_string.data != NULL && | ||
| session->inner_request.query_string.len > 0) { |
There was a problem hiding this comment.
Add HTTP/1 query-string regression coverage
Add an automated HTTP/1 case that sends a query string and asserts the callback receives the expected request->path and request->query_string; this protocol-parsing behavior is currently validated only by the manual reproduction in the commit message, so the original regression or HTTP/1/HTTP/2 divergence could return unnoticed. The repository explicitly requires tests for behavior changes, especially protocol parsing.
AGENTS.md reference: AGENTS.md:L83-L85
Useful? React with 👍 / 👎.
Summary
The HTTP server discards the query string before processing the request, resulting in the query string being entirely missing for downstream plugins. This issue happens on HTTP1 only. The fix re-appends the query string to the path to be processed by
flb_http_request_normalize()the same way currently done in HTTP2 with the:pathpseudo-header already containing the query string.As mentioned the fix re-appends the query string before being split again by the
flb_http_request_normalize()function. Even though this seems redundant, the idea is to keep the logic consistent between HTTP1 and HTTP2, with the alternative being to simply set the query string ourselves after the call to the normalize function.Found about this issue when working on #12192.
Reproducing
A configuration with
vivo_exporter, a plugin making use of query strings:Querying the plugin using
?limitquery string hoping to limit the output:Valgrind w/ fix
Now working queries:
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit