From 363e81fc4754e6732c241fba117e3357e5a56fba Mon Sep 17 00:00:00 2001 From: Odboy Date: Tue, 3 Nov 2026 20:55:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20net=20speed=20=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=94=B9=E7=94=A8=20Cloudflare=20=E7=AB=AF?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit httpbin.org 对 10MB 上传返回 HTTP 400,改为 speed.cloudflare.com/__up --- internal/executor/netspeed.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/executor/netspeed.go b/internal/executor/netspeed.go index 6818fee..4ad0cda 100644 --- a/internal/executor/netspeed.go +++ b/internal/executor/netspeed.go @@ -132,8 +132,8 @@ func testDownload(ctx context.Context, size int64) (int64, error) { } func testUpload(ctx context.Context, size int64) (int64, error) { - // Use httpbin.org for upload test - url := "https://httpbin.org/post" + // Use Cloudflare's speed test endpoint for upload + url := fmt.Sprintf("https://speed.cloudflare.com/__up?bytes=%d", size) // Create a reader that generates data on the fly data := make([]byte, size) @@ -156,7 +156,7 @@ func testUpload(ctx context.Context, size int64) (int64, error) { defer resp.Body.Close() io.Copy(io.Discard, resp.Body) - if resp.StatusCode != http.StatusOK { + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusNoContent { return 0, fmt.Errorf("HTTP %d", resp.StatusCode) }