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

in_http: http realloc fus fix, http_server: same fix #8640

Closed
wants to merge 3 commits into from

Conversation

pwhelan
Copy link
Contributor

@pwhelan pwhelan commented Mar 26, 2024

Summary

These patches provide equivalent fixes for both in_http and the new http_server when it is ingesting http1/.x protocol requests.

When large requests are sent with HTTP/1.0 the buffer gets reallocated when reaching or exceeding the initial buffer size. The request (a struct mk_http_request) uses several mk_ptr_t to point to values for certain headers and parts of the request and points directly at the buffer.

This patch seeks to recalculate those pointers when this happens so they remain valid and point to valid content.

Without this patch in_http will fail, either crashing when using http2=off or returning a 400 "invalid request" error.


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:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

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.

pwhelan added 2 commits March 26, 2024 18:52
Recalculate and reassign all the pointers managed by mk_http_request, ie:

  * request.uri
  * request.parsers.headers
  * request.content_type

As well as several others. All headers as well as all mk_ptr_t are
recalculated when reallocating the request buffer so they point to
the new buffer.

Signed-off-by: Phillip Whelan <[email protected]>
…fer grows.

Reassign pointers in mk_http_request when the buffer grows.

Signed-off-by: Phillip Whelan <[email protected]>
@pwhelan
Copy link
Contributor Author

pwhelan commented Mar 27, 2024

The in_http patches are superseded by #8643, the http_server fixes will be done via changes to monkey.

@pwhelan pwhelan closed this Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant