Skip to content

Tests: $body_bytes_sent with early hints - #90

Open
SEPURI-SAI-KRISHNA wants to merge 1 commit into
nginx:masterfrom
SEPURI-SAI-KRISHNA:early-hints-body-bytes-sent
Open

Tests: $body_bytes_sent with early hints#90
SEPURI-SAI-KRISHNA wants to merge 1 commit into
nginx:masterfrom
SEPURI-SAI-KRISHNA:early-hints-body-bytes-sent

Conversation

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown

Proposed changes

Adds proxy_early_hints_bytes.t.

Companion to nginx/nginx#1606 — this test does not
pass until that change lands.

Bytes written for a 103 (Early Hints) response are header bytes and should not
be counted in $body_bytes_sent. The upstream returns an 8-byte body, so
$body_bytes_sent must be 8 whether or not early hints are sent.

Covers HTTP/1.1 with early_hints on, HTTP/1.1 with early_hints off as a
control, and HTTP/2 — HTTP/2 already accumulates r->header_size correctly,
so it guards against a regression in the other direction.

Against current nginx master:

#   Failed test 'body bytes sent'
#   at proxy_early_hints_bytes.t line 85.
#                   '/ HTTP/1.1 79
# /off/ HTTP/1.1 8
# / HTTP/2.0 8
# '
#     doesn't match '(?^m:^/ HTTP/1\.1 8$)'
# Looks like you failed 1 test of 6.

The 79 is 8 body bytes plus the 71-byte 103 response. The two control cases
pass unchanged, which is what pins the bug to HTTP/1.x with early hints
enabled.

With the fix applied:

proxy_early_hints_bytes.t .... ok
All tests successful.

The test is not vacuous: the first assertion checks a 103 was actually
emitted, so it cannot pass by early hints silently not firing.

Needs only http_v2 and proxy, so no leg of it is skipped on a default
build.

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

2 participants