Skip to content

test: cover direct HTTP/1.0 keep-alive reuse - #1656

Open
He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:test/http1-0-direct-keepalive-reuse
Open

He-Pin wants to merge 1 commit into
apache:mainfrom
He-Pin:test/http1-0-direct-keepalive-reuse

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 26, 2026

Copy link
Copy Markdown
Member

Motivation

The HTTP/1.0 parser and response renderer are tested separately, but neither test shows that a direct connection negotiated for keep-alive can deliver a second request after a complete first response.

Modification

Render two ordinary HTTP/1.0 GET requests with the existing typed keep-alive option. On a single native server flow, fully consume a length-delimited 200 response for the first request before sending the second. Verify both requests reach the server and both responses keep their status, connection option and body.

Result

Cover direct HTTP/1.0 keep-alive reuse without changing default persistence, proxy policy, or production code.

Tests

JDK 17; focused HttpServerSpec passed on Scala 2.13.18 and 3.3.9 (1/1 each). Scoped test Scalafmt and license-header checks passed.

References

### Motivation

The HTTP/1.0 parser and response renderer are tested separately, but neither test shows that a direct connection negotiated for keep-alive can deliver a second request after a complete first response.

### Modification

Render two ordinary HTTP/1.0 GET requests with the existing typed keep-alive option. On a single native server flow, fully consume a length-delimited 200 response for the first request before sending the second. Verify both requests reach the server and both responses keep their status, connection option and body.

### Result

Cover direct HTTP/1.0 keep-alive reuse without changing default persistence, proxy policy, or production code.

### Tests

JDK 17; focused HttpServerSpec passed on Scala 2.13.18 and 3.3.9 (1/1 each). Scoped test Scalafmt and license-header checks passed.

### References

- [RFC 9112 §9.3](https://www.rfc-editor.org/rfc/rfc9112.html#section-9.3)
- [RFC 9112 Appendix C.2.2](https://www.rfc-editor.org/rfc/rfc9112.html#appendix-C.2.2)
@He-Pin
He-Pin requested a review from pjfanning November 26, 2026 08:48

@pjfanning pjfanning 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.

Nit: building the raw request via the client's HttpRequestRendererFactory.renderStrict couples the server test to the client renderer and hides the wire bytes. A send("""GET /first HTTP/1.0 ...""") literal like the neighbouring tests would be simpler and clearer, and drop two imports.

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