Skip to content

Commit abd5844

Browse files
committed
chore: add warning for unified delay test when second failed
1 parent a330fa1 commit abd5844

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

adapter/adapter.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"net/netip"
1111
"net/url"
1212
"strconv"
13+
"strings"
1314
"time"
1415

1516
"github.com/metacubex/mihomo/common/atomic"
@@ -18,6 +19,7 @@ import (
1819
"github.com/metacubex/mihomo/component/ca"
1920
"github.com/metacubex/mihomo/component/dialer"
2021
C "github.com/metacubex/mihomo/constant"
22+
"github.com/metacubex/mihomo/log"
2123
"github.com/puzpuzpuz/xsync/v3"
2224
)
2325

@@ -260,10 +262,16 @@ func (p *Proxy) URLTest(ctx context.Context, url string, expectedStatus utils.In
260262

261263
if unifiedDelay {
262264
second := time.Now()
263-
resp, err = client.Do(req)
264-
if err == nil {
265+
var ignoredErr error
266+
resp, ignoredErr = client.Do(req)
267+
if ignoredErr == nil {
265268
_ = resp.Body.Close()
266269
start = second
270+
} else {
271+
log.Errorln("UnifiedDelay failed to get the second response: %v", ignoredErr)
272+
if strings.HasPrefix(url, "http://") {
273+
log.Warnln("It is recommended to use HTTPS for provider.health-check.url and group.url to ensure better reliability. Due to some proxy providers hijacking test addresses and not being compatible with repeated HEAD requests, using HTTP may result in failed tests.")
274+
}
267275
}
268276
}
269277

0 commit comments

Comments
 (0)