Support experimental HTTP middleware in HttpServerRunner constructor - #311
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No blocking issues were identified; one minor documentation clarification remains.
Review effort: Lite
Findings: None
What changed in this PR
Adds experimental HTTP middleware support to HttpServerRunner, with safer server initialization and configurable request-body handling.
Changes:
- Adds middleware validation and execution.
- Prevents binding when server creation fails.
- Adds tests and documentation for request-body limits.
| File | Summary |
|---|---|
tests/Runner/HttpServerRunnerTest.php |
Tests middleware, validation, buffering, and cleanup. |
src/Runner/HttpServerRunner.php |
Adds middleware support and safer initialization. |
docs/best-practices/deployment.md |
Documents middleware configuration and request limits; clarify the stated 100 MiB memory bound. |
docs/api/request.md |
Documents default request-body limits. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
clue
force-pushed
the
http-middleware
branch
from
September 23, 2026 22:00
d181520 to
87916fb
Compare
clue
force-pushed
the
http-middleware
branch
from
September 23, 2026 22:23
87916fb to
e7337f9
Compare
This was referenced Sep 23, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changeset adds experimental support for passing HTTP middleware to the
HttpServerRunnerconstructor. The goal is to raise the built-in web server's 64 KiB request body limit, but this can also be used to preprocess or filter requests before they reach X:Note that this is an experimental feature and the API may be subject to change in future releases. Once X handles larger request bodies on its own, this may no longer be needed, but for now this avoids having to patch X. The first commit also makes sure a failure to create the HTTP server no longer leaves the listen address bound.
Without any middleware given, the HTTP server behaves exactly as before, so this should be safe to apply.
Builds on top of #294, #295, #292, #224, #237, #117, #156, #13 and others
Refs #234, #293, #196, #193 and #190