Skip to content

fix(http): honour Content-Length on every method and reject bad field lines - #3735

Closed
BaseMax wants to merge 2 commits into
mainfrom
fix/http-framing
Closed

BaseMax wants to merge 2 commits into
mainfrom
fix/http-framing

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

GET, HEAD and OPTIONS ignored Content-Length, so their body was read as the next pipelined request. Header lines with whitespace before the colon and obs-fold continuation lines were silently skipped instead of rejected.

Content-Length is now honoured for every method (the body is read and available like any other). Any field line that starts with whitespace or has whitespace between the name and the colon gets 400, as RFC 9112 sections 5.1 and 5.2 require. Transfer-Encoding and duplicate or non-digit Content-Length are still rejected as before.

Tested: new cases in tests/en/general/net_http_smuggling (one response for GET/HEAD/OPTIONS with a body, 400 for the bad field lines; before the fix they gave two responses and 200), plus the nearby net_http tests.

This should merge after #3737 (the Content-Length overflow fix), since that bug becomes reachable through GET too once GET bodies are read.

… lines

GET, HEAD and OPTIONS bodies were parsed as the next request. Whitespace before the colon and obs-fold lines now get 400.
@BaseMax
BaseMax requested a review from a team as a code owner November 21, 2026 05:29
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 129 files, which is 29 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

CodeRabbit couldn't verify your organization's usage billing state, so no usage-priced review was started. Retry after the billing service recovers.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ebd3efd9-2b2e-4656-ac27-f830e6db0ea5
Commits

Reviewing files that changed from the base of the PR and between 3d0dd9e and 495feed.

Files ignored due to path filters: 48

  • tests/en/general/net_http_limits.out is excluded by !**/*.out
  • tests/en/general/net_http_smuggling.out is excluded by !**/*.out
  • tests/en/stdlib/gui_tray.out is excluded by !**/*.out
  • tests/en/stdlib/nav_routes.out is excluded by !**/*.out
  • tests/en/stdlib/net_spa_fallback.out is excluded by !**/*.out
  • tests/en/stdlib/net_tun_packet.out is excluded by !**/*.out
  • tests/en/stdlib/net_tun_plan.out is excluded by !**/*.out
  • tests/en/stdlib/net_tun_session.out is excluded by !**/*.out
  • tests/en/stdlib/net_tun_sniff.out is excluded by !**/*.out
  • tests/en/stdlib/net_wifi.out is excluded by !**/*.out
  • tests/fa/general/net_spa_fallback.out is excluded by !**/*.out
  • tests/fa/stdlib/gui_tray.out is excluded by !**/*.out
  • tests/fa/stdlib/nav_routes.out is excluded by !**/*.out
  • tests/fa/stdlib/net_tun_packet.out is excluded by !**/*.out
  • tests/fa/stdlib/net_tun_plan.out is excluded by !**/*.out
  • tests/fa/stdlib/net_tun_session.out is excluded by !**/*.out
  • tests/fa/stdlib/net_tun_sniff.out is excluded by !**/*.out
  • tests/fa/stdlib/net_wifi.out is excluded by !**/*.out
  • website/content/en/examples/net-wifi-guide-trust.out is excluded by !**/*.out
  • website/content/en/std-examples/gui-tray/gui-tray-Events.out is excluded by !**/*.out
  • website/content/en/std-examples/gui-tray/gui-tray-Items.out is excluded by !**/*.out
  • website/content/en/std-examples/nav/nav-History.out is excluded by !**/*.out
  • website/content/en/std-examples/nav/nav-Match.out is excluded by !**/*.out
  • website/content/en/std-examples/nav/nav-Resolve.out is excluded by !**/*.out
  • website/content/en/std-examples/net-tun/net-tun-Nat.out is excluded by !**/*.out
  • website/content/en/std-examples/net-tun/net-tun-Packet.out is excluded by !**/*.out
  • website/content/en/std-examples/net-tun/net-tun-Plan.out is excluded by !**/*.out
  • website/content/en/std-examples/net-tun/net-tun-Sniff.out is excluded by !**/*.out
  • website/content/en/std-examples/net-wifi/net-wifi-Parsers.out is excluded by !**/*.out
  • website/content/en/std-examples/net-wifi/net-wifi-Security.out is excluded by !**/*.out
  • website/content/en/std-examples/net-wifi/net-wifi-State.out is excluded by !**/*.out
  • website/content/en/std-examples/net-wifi/net-wifi-Trust.out is excluded by !**/*.out
  • website/content/en/std-examples/net-wifi/net-wifi-Windows.out is excluded by !**/*.out
  • website/content/fa/examples/net-wifi-guide-trust.out is excluded by !**/*.out
  • website/content/fa/std-examples/gui-tray/gui-tray-Events.out is excluded by !**/*.out
  • website/content/fa/std-examples/gui-tray/gui-tray-Items.out is excluded by !**/*.out
  • website/content/fa/std-examples/nav/nav-History.out is excluded by !**/*.out
  • website/content/fa/std-examples/nav/nav-Match.out is excluded by !**/*.out
  • website/content/fa/std-examples/nav/nav-Resolve.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-tun/net-tun-Nat.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-tun/net-tun-Packet.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-tun/net-tun-Plan.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-tun/net-tun-Sniff.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-wifi/net-wifi-Parsers.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-wifi/net-wifi-Security.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-wifi/net-wifi-State.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-wifi/net-wifi-Trust.out is excluded by !**/*.out
  • website/content/fa/std-examples/net-wifi/net-wifi-Windows.out is excluded by !**/*.out
Files selected for processing: 129

  • .github/linters/codespell.txt
  • .gitignore
  • SECURITY.md
  • compiler/cli/cli_api.salam
  • compiler/cli/cli_parse.salam
  • compiler/driver/driver.salam
  • compiler/driver/driver_api_web.salam
  • compiler/sal_core.salam
  • docs/PLATFORMS.md
  • docs/ai/stdlib-index.json
  • install.ps1
  • install.sh
  • std/gui/tray/linux.salam
  • std/gui/tray/macos.salam
  • std/gui/tray/none.salam
  • std/gui/tray/tray.salam
  • std/gui/tray/windows.salam
  • std/gui/ui/element.salam
  • std/gui/ui/run.salam
  • std/gui/ui/ui.salam
  • std/gui/window/cocoa.salam
  • std/gui/window/win32.salam
  • std/gui/window/window.salam
  • std/gui/window/x11.salam
  • std/nav/nav.salam
  • std/net/http/ctx_internal.salam
  • std/net/http/raw.salam
  • std/net/httpd/config.salam
  • std/net/httpd/serve.salam
  • std/net/router/router.salam
  • std/net/tun/bypass.salam
  • std/net/tun/device.salam
  • std/net/tun/nat.salam
  • std/net/tun/packet.salam
  • std/net/tun/plan.salam
  • std/net/tun/sniff.salam
  • std/net/tun/stack.salam
  • std/net/tun/tun.salam
  • std/net/wifi/linux.salam
  • std/net/wifi/macos.salam
  • std/net/wifi/wifi.salam
  • std/net/wifi/windows.salam
  • tests/en/general/net_http_limits.salam
  • tests/en/general/net_http_smuggling.salam
  • tests/en/stdlib/gui_tray.salam
  • tests/en/stdlib/nav_routes.salam
  • tests/en/stdlib/net_spa_fallback.salam
  • tests/en/stdlib/net_tun_packet.salam
  • tests/en/stdlib/net_tun_plan.salam
  • tests/en/stdlib/net_tun_session.salam
  • tests/en/stdlib/net_tun_sniff.salam
  • tests/en/stdlib/net_wifi.salam
  • tests/fa/general/net_spa_fallback.salam
  • tests/fa/stdlib/gui_tray.salam
  • tests/fa/stdlib/nav_routes.salam
  • tests/fa/stdlib/net_tun_packet.salam
  • tests/fa/stdlib/net_tun_plan.salam
  • tests/fa/stdlib/net_tun_session.salam
  • tests/fa/stdlib/net_tun_sniff.salam
  • tests/fa/stdlib/net_wifi.salam
  • tools/interop/tun_e2e.salam
  • tools/interop/tun_e2e.sh
  • tools/salam/std-coverage-docs-baseline.txt
  • website/content/en/examples/gui-tray-guide-hide.salam
  • website/content/en/examples/gui-tray-guide-menu.salam
  • website/content/en/examples/net-wifi-guide-current.salam
  • website/content/en/examples/net-wifi-guide-trust.salam
  • website/content/en/examples/net-wifi-guide-watch.salam
  • website/content/en/learn/49-serve.txt
  • website/content/en/std-examples/gui-tray/gui-tray-Events.salam
  • website/content/en/std-examples/gui-tray/gui-tray-Items.salam
  • website/content/en/std-examples/gui-tray/gui-tray-Show.salam
  • website/content/en/std-examples/gui-ui/gui-ui-Window.salam
  • website/content/en/std-examples/nav/nav-History.salam
  • website/content/en/std-examples/nav/nav-Match.salam
  • website/content/en/std-examples/nav/nav-Resolve.salam
  • website/content/en/std-examples/net-tun/net-tun-Nat.salam
  • website/content/en/std-examples/net-tun/net-tun-Packet.salam
  • website/content/en/std-examples/net-tun/net-tun-Plan.salam
  • website/content/en/std-examples/net-tun/net-tun-Session.salam
  • website/content/en/std-examples/net-tun/net-tun-Sniff.salam
  • website/content/en/std-examples/net-wifi/net-wifi-Current.salam
  • website/content/en/std-examples/net-wifi/net-wifi-Interfaces.salam
  • website/content/en/std-examples/net-wifi/net-wifi-Parsers.salam
  • website/content/en/std-examples/net-wifi/net-wifi-Security.salam
  • website/content/en/std-examples/net-wifi/net-wifi-State.salam
  • website/content/en/std-examples/net-wifi/net-wifi-Trust.salam
  • website/content/en/std-examples/net-wifi/net-wifi-Watch.salam
  • website/content/en/std-examples/net-wifi/net-wifi-Windows.salam
  • website/content/en/std/139-net-httpd.txt
  • website/content/en/std/185-gui-ui.txt
  • website/content/en/std/189-gui-tray.txt
  • website/content/en/std/190-net-wifi.txt
  • website/content/en/std/191-nav.txt
  • website/content/en/std/191-net-tun.txt
  • website/content/en/std/79-net-router.txt
  • website/content/fa/examples/gui-tray-guide-hide.salam
  • website/content/fa/examples/gui-tray-guide-menu.salam
  • website/content/fa/examples/net-wifi-guide-current.salam
  • website/content/fa/examples/net-wifi-guide-trust.salam
  • website/content/fa/examples/net-wifi-guide-watch.salam
  • website/content/fa/learn/49-serve.txt
  • website/content/fa/std-examples/gui-tray/gui-tray-Events.salam
  • website/content/fa/std-examples/gui-tray/gui-tray-Items.salam
  • website/content/fa/std-examples/gui-tray/gui-tray-Show.salam
  • website/content/fa/std-examples/gui-ui/gui-ui-Window.salam
  • website/content/fa/std-examples/nav/nav-History.salam
  • website/content/fa/std-examples/nav/nav-Match.salam
  • website/content/fa/std-examples/nav/nav-Resolve.salam
  • website/content/fa/std-examples/net-tun/net-tun-Nat.salam
  • website/content/fa/std-examples/net-tun/net-tun-Packet.salam
  • website/content/fa/std-examples/net-tun/net-tun-Plan.salam
  • website/content/fa/std-examples/net-tun/net-tun-Session.salam
  • website/content/fa/std-examples/net-tun/net-tun-Sniff.salam
  • website/content/fa/std-examples/net-wifi/net-wifi-Current.salam
  • website/content/fa/std-examples/net-wifi/net-wifi-Interfaces.salam
  • website/content/fa/std-examples/net-wifi/net-wifi-Parsers.salam
  • website/content/fa/std-examples/net-wifi/net-wifi-Security.salam
  • website/content/fa/std-examples/net-wifi/net-wifi-State.salam
  • website/content/fa/std-examples/net-wifi/net-wifi-Trust.salam
  • website/content/fa/std-examples/net-wifi/net-wifi-Watch.salam
  • website/content/fa/std-examples/net-wifi/net-wifi-Windows.salam
  • website/content/fa/std/139-net-httpd.txt
  • website/content/fa/std/185-gui-ui.txt
  • website/content/fa/std/189-gui-tray.txt
  • website/content/fa/std/190-net-wifi.txt
  • website/content/fa/std/191-nav.txt
  • website/content/fa/std/191-net-tun.txt
  • website/content/fa/std/79-net-router.txt

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@github-actions

Copy link
Copy Markdown
Contributor
sha=c4c91660b0fef49d5625870822c4e396f86eeb9b

🤖 Salam AI review

Verdict: ⚠️ Review could not be parsed

commit c4c9166 · 3 files · +27 −9 · model salam

Maximum steps for this agent have been reached.

Summary of work so far: I reviewed the PR diff for std/net/http/ctx_internal.salam and its test changes. The change removes the method-based body exclusion (_has_body_at) so Content-Length is honoured for GET, HEAD, and OPTIONS, and adds _bad_field_name to reject field lines starting with whitespace or containing whitespace before the colon.

Remaining tasks not completed: I did not run the Salam compiler/tests or inspect the full repository/test harness, and I could not verify the separate Content-Length overflow fix ordering.

Recommendations: Before merging, verify the overflow fix is already in place, run net_http and net_http_smuggling tests, and consider whether empty field names should also be rejected under RFC 9112.


⚠️ This review was written automatically by an AI and may contain mistakes. It is a helper for maintainers, not a replacement for a human review: check the code yourself before merging.

@BaseMax

BaseMax commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Replaced by 3743, the same change rebased onto main.

@BaseMax BaseMax closed this Nov 21, 2026
@BaseMax
BaseMax deleted the fix/http-framing branch November 21, 2026 06:35
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.

1 participant