Repository navigation
Description
Summary
TestDo/content-length_with_binary_body is a unit test for response handling,
but it makes a live request to a third-party W3Schools favicon and asserts that
the raw response is larger than 800 bytes. The current resource produces a
smaller response, so the committed test fails even though the request and
binary-body handling complete successfully.
The failure reproduces on the current dev revision
811409809ea2b1706c49452149ab454861543138.
Steps to reproduce
-
Check out current
projectdiscovery/httpxdevat
811409809ea2b1706c49452149ab454861543138. -
Run only the affected subtest:
go test ./common/httpx \ -run '^TestDo$/^content-length_with_binary_body$' \ -count=1 \ -v
-
Observe the size assertion failure:
=== RUN TestDo/content-length_with_binary_body httpx_test.go:29: Error: "665" is not greater than "800" --- FAIL: TestDo/content-length_with_binary_body
Expected behavior
The binary-response unit test should have a deterministic input controlled by
the test suite and should pass without requiring a mutable public website. The
regression check is green when it still proves the intended binary-body and
content-length behavior while succeeding offline and independently of
W3Schools content changes.
Actual behavior
common/httpx/httpx_test.go sends a GET request to:
https://www.w3schools.com/images/favicon.ico
It then requires len(resp.Raw) > 800. The request succeeds, but the current
raw response is 665 bytes, causing the test to fail. A separate run during the
same verification pass observed 663 bytes, demonstrating that the asserted
quantity is controlled by the external service rather than the unit under
test.
Affected area
common/httpx/httpx_test.goTestDo/content-length_with_binary_body- Local and CI runs of
go test ./common/httpxthat have external network
access - Offline or restricted-network development environments
Runtime or environment
- httpx source:
dev - Source revision:
811409809ea2b1706c49452149ab454861543138 - Current release:
v1.10.0 - Go:
go1.26.4 darwin/arm64 - Reproduced on 2026-08-08
Evidence
The current test body is equivalent to:
req, err := retryablehttp.NewRequest(
http.MethodGet,
"https://www.w3schools.com/images/favicon.ico",
nil,
)
require.Nil(t, err)
resp, err := ht.Do(req, UnsafeOptions{})
require.Nil(t, err)
require.Greater(t, len(resp.Raw), 800)The live dev ref still resolves to
811409809ea2b1706c49452149ab454861543138, so the failing assertion is present
in the current branch rather than only an older checkout. Focused neighboring
tests that do not depend on this public resource pass.
Impact
The package test suite can fail because a third party changes an asset, its
headers, or its delivery behavior. That creates a false negative for unrelated
source changes, prevents reliable offline testing, and makes CI depend on
external availability and response size rather than only the HTTP behavior the
test is intended to cover.
Additional context
An open-and-closed issue search for the W3Schools URL, the subtest name, favicon
test failures, and the len(resp.Raw) assertion found no matching report in
projectdiscovery/httpx.
The existing issue #2543 covers
the separate DIT model download triggered by JSON/CSV output and does not share
this test reproduction or closure signal.
Activity
fix: make binary body test use a local server