This commit is contained in:
gospider
2025-01-21 09:51:36 +08:00
parent 268e90152a
commit 00507c88a9
2 changed files with 9 additions and 5 deletions

View File

@@ -13,13 +13,12 @@
<img src="https://img.shields.io/badge/language-golang-brightgreen"> <img src="https://img.shields.io/badge/language-golang-brightgreen">
</a> </a>
</p> </p>
<center> <p align="center">
## A request library designed specifically for web crawlers ## A request library designed specifically for web crawlers
</p>
</center> ## Requests is a fully featured HTTP client library for Golang. Network requests can be completed with just a few lines of code. Unified support for http1, http2, http3, websocket, sse, utls, uquic
## Requests is a fully featured HTTP client library for Golang. Network requests can be completed with just a few lines of code. Unified support for http1, http2, http3, websocket, sse protocols
--- ---
## Innovative Features ## Innovative Features
@@ -29,7 +28,7 @@
| HTTP/3 fingerprint spoofing protection | Not supported | | HTTP/3 fingerprint spoofing protection | Not supported |
| Arbitrary closure of underlying connections | Not supported | | Arbitrary closure of underlying connections | Not supported |
| Genuine request-level proxy settings | Not supported | | Genuine request-level proxy settings | Not supported |
| Unique transport layer management mechanism, fully unifying HTTP/1, HTTP/2, HTTP/3, WebSocket, and SSE protocol handling | Not supported | | Unique transport layer management mechanism, fully unifying HTTP/1, HTTP/2, HTTP/3, WebSocket, SSE, UTLS, QUIC protocol handling | Not supported |
## Features ## Features
* [Simple for settings and Request](https://github.com/gospider007/requests#quickly-send-requests) * [Simple for settings and Request](https://github.com/gospider007/requests#quickly-send-requests)

View File

@@ -146,6 +146,11 @@ func (obj *Client) Request(ctx context.Context, method string, href string, opti
} }
} }
for ; optionBak.MaxRetries >= 0; optionBak.MaxRetries-- { for ; optionBak.MaxRetries >= 0; optionBak.MaxRetries-- {
select {
case <-ctx.Done():
return nil, ctx.Err()
default:
}
option := optionBak option := optionBak
option.Url = cloneUrl(uhref) option.Url = cloneUrl(uhref)
response = NewResponse(ctx, option) response = NewResponse(ctx, option)