Skip to content

Web: FastCGI record codec + VM listener (#173)#3261

Merged
PurHur merged 3 commits into
masterfrom
agent/issue-173-fastcgi-records
May 30, 2026
Merged

Web: FastCGI record codec + VM listener (#173)#3261
PurHur merged 3 commits into
masterfrom
agent/issue-173-fastcgi-records

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 29, 2026

Summary

  • Implements FastCGI 1.0 record framing and PARAMS name-value codec under lib/Web/FastCgi/ (issue Web: FastCGI request loop adapter (nginx / php-fpm compatible) #173 slice 1).
  • Adds bin/fcgi.php and phpc fcgi for VM serving over TCP; RequestHandler maps PARAMS → CGI env and runs CgiDriver::runVmScript (slice 2).
  • Slice 3: FCGI_KEEP_CONN multiplex — multiple requests per connection (php-fpm keep-alive parity).
  • Slice 4: --binary flag routes through CgiAotDriver::runCapture() for native AOT binaries (Web: AOT CGI wrapper for phpc-built binaries (production nginx spawn) #665 pattern).
  • Slice 4 tests: FastCgiTest::testAotFastCgiHealthReturnsOk + testAotFastCgiPathInfoDiagnostics behind FASTCGI_WEB_AOT_SMOKE_GATE=1.
  • PHPUnit: FastCgiRecordTest (binary fixtures), FastCgiTest (009-FastCGIWeb health + keep-alive multiplex + AOT, @group serve).

php-src reference

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/unit/FastCgiRecordTest.php test/unit/FastCgiTest.php'
# 8 tests OK (VM + record codec; AOT tests skipped without gate)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && FASTCGI_WEB_AOT_SMOKE_GATE=1 vendor/bin/phpunit test/unit/FastCgiTest.php --filter testAotFastCgi'
# 2 tests OK (AOT health + PATH_INFO via FastCGI)

Remaining on #173

Part of #173

PurHur and others added 3 commits May 30, 2026 17:25
Add lib/Web/FastCgi framing (records, PARAMS codec, request assembly),
bin/fcgi.php / phpc fcgi for single-request VM serving, and PHPUnit
coverage for binary records plus 009-FastCGIWeb health over TCP.

php-src reference: sapi/fpm/fpm/fpm_main.c. Multiplexed loop and AOT
adapter remain follow-ups on #173.

Co-authored-by: Cursor <cursoragent@cursor.com>
FCGI_KEEP_CONN serves multiple requests per connection; RequestHandler
can exec phpc-built binaries via CgiAotDriver::runCapture and fcgi --binary.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add health + PATH_INFO tests behind FASTCGI_WEB_AOT_SMOKE_GATE, exercising
bin/fcgi.php --binary with the compiled example app over TCP FastCGI records.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur force-pushed the agent/issue-173-fastcgi-records branch from 6a57b20 to bbe15d6 Compare May 30, 2026 15:25
@PurHur PurHur merged commit c33f10e into master May 30, 2026
@PurHur PurHur deleted the agent/issue-173-fastcgi-records branch May 30, 2026 15:26
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