Skip to content

Web: populate $_SERVER HTTP_* from incoming headers (closes #193)#229

Merged
PurHur merged 1 commit into
masterfrom
feat/web-http-server-headers-193
May 18, 2026
Merged

Web: populate $_SERVER HTTP_* from incoming headers (closes #193)#229
PurHur merged 1 commit into
masterfrom
feat/web-http-server-headers-193

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 18, 2026

Summary

  • Map parsed HTTP request headers to CGI-style $_SERVER keys (HTTP_HOST, HTTP_X_*, CONTENT_TYPE, CONTENT_LENGTH) in bin/serve.php / bin/serve-aot.php via DevServer
  • Copy HTTP_* / CONTENT_* from $_ENV in VM superglobal population (PHPT/CGI env)
  • Refresh the same keys in AOT __superglobals__refresh() from the process environment
  • Add unit, PHPT, serve integration, and AOT tests

Test plan

  • php vendor/bin/phpunit test/unit/Web/SuperglobalsHttpHeadersTest.php (Docker php:8.2-cli)
  • VM smoke: HTTP_HOST=example.test HTTP_X_CUSTOM=1 … php bin/vm.php -r '…'
  • php vendor/bin/phpunit test/aot/RuntimeSuperglobalRefreshTest.php --filter testHttpHostFromCgiEnvironment (with LLVM 9)
  • Full script/docker-ci.sh on maintainer host

Closes #193

Made with Cursor

Map incoming HTTP headers to CGI-style $_SERVER keys in the dev server,
VM superglobal population, and AOT runtime refresh so small web apps can
read HTTP_HOST and custom X-* headers under static compilation.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur force-pushed the feat/web-http-server-headers-193 branch from 6373172 to 734254b Compare May 18, 2026 18:58
@PurHur PurHur merged commit e86cbb2 into master May 18, 2026
@PurHur PurHur deleted the feat/web-http-server-headers-193 branch May 18, 2026 18:59
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.

Web: Populate $_SERVER['HTTP_*'] and REQUEST_URI from incoming headers

1 participant