Skip to content

Add HTTP/1.1 wire tests for One’s server - #1334

Closed
HarshPopat23 wants to merge 2 commits into
sourcemeta:mainfrom
HarshPopat23:test/http1-wire-conformance
Closed

HarshPopat23 wants to merge 2 commits into
sourcemeta:mainfrom
HarshPopat23:test/http1-wire-conformance

Conversation

@HarshPopat23

@HarshPopat23 HarshPopat23 commented Nov 19, 2026 •

Copy link
Copy Markdown

Description

Adds a one.http.wire CTest target that sends raw HTTP/1.1 requests over loopback to a test-only echo server built with One’s HTTPServer, HTTPRequest, and HTTPResponse wrappers. The tests establish a baseline for evaluating future HTTP parser changes.

The seven cases cover request-target parsing, requests split across writes, fixed-length binary bodies, chunked bodies, rejection of a missing Host header, and payloads at and above the configured body limit. The cases were written against RFC 9112 and informed by the h1spec revision pinned by uWebSockets. The test README documents the selected coverage and exclusions.

The fixture binds to an OS-assigned loopback port, announces readiness, and shuts down after the run. The runner bounds request and shutdown waits. The existing CTest job picks up the suite when server tests are enabled.

Validation

  • Built the test fixture and compiled the production server translation unit with GCC 14.2.
  • All seven cases passed across 20 consecutive CTest runs.
  • A deliberately incorrect expected response body caused CTest to fail as intended.
  • Formatting, JavaScript syntax, and whitespace checks passed.
  • Full Docker CI and macOS runtime verification remain pending.

View guided diff

Exercise the real HTTP wrappers over loopback with RFC-based cases informed by h1spec. Register the fixture and runner with CTest.

Signed-off-by: HarshPopat23 <musichk61@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread test/cli/http/wire.test.cjs Resolved
Comment thread test/cli/http/echo.cc Resolved
Comment thread test/cli/http/README.md Resolved
Comment thread test/cli/http/README.md Resolved
Comment thread test/cli/http/wire.test.cjs Resolved
Signed-off-by: HarshPopat23 <musichk61@gmail.com>
@HarshPopat23

Copy link
Copy Markdown
Author

PTAL : @jviotti

Comment thread test/cli/http/README.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general try to avoid these markdown files. Its unnecessary documentation that can easily go out of date.

@jviotti jviotti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the idea but I think an actual unit test runner for this would be something to do when the HTTP server gets into the Core repo.

I think for now the most important one would be to test the HTTP parser, independently, on the Core repo, and grow that enough to attempt an implementation on top of uSockets.

Because the HTTP parser is essentially a pure function, we can unit test it a lot for adversarial cases, etc. So maybe let's start with that?

@HarshPopat23

Copy link
Copy Markdown
Author

Thanks, Juan. I’ll close this PR and start with a standalone HTTP/1.1 parser and direct unit tests in Core. Once the HTTP server is in Core, I’ll revisit the wire-level test runner and refer back to this PR for any fixtures that still apply.

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.

2 participants