mirror of
https://github.com/gospider007/requests.git
synced 2025-12-24 13:57:52 +08:00
302 bug
This commit is contained in:
@@ -116,11 +116,18 @@ func (obj *Client) do(req *http.Request, option *RequestOption) (resp *http.Resp
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
ireq.Method, _, _ = redirectBehavior(req.Method, resp, ireq)
|
||||
ireq.Response = resp
|
||||
ireq.Header = defaultHeaders()
|
||||
ireq.Header.Set("Referer", req.URL.String())
|
||||
if getDomain(u) == getDomain(req.URL) {
|
||||
ireq.Header.Set("Cookie", Cookies(req.Cookies()).String())
|
||||
if Authorization := req.Header.Get("Authorization"); Authorization != "" {
|
||||
ireq.Header.Set("Authorization", Authorization)
|
||||
}
|
||||
cookies := Cookies(req.Cookies()).String()
|
||||
if cookies != "" {
|
||||
ireq.Header.Set("Cookie", cookies)
|
||||
}
|
||||
addCookie(ireq, resp.Cookies())
|
||||
}
|
||||
io.Copy(io.Discard, resp.Body)
|
||||
|
||||
4
go.mod
4
go.mod
@@ -13,7 +13,7 @@ require (
|
||||
github.com/gospider007/tools v0.0.0-20231202084937-8b2bc66f8198
|
||||
github.com/gospider007/websocket v0.0.0-20231215083826-2227da2a2a13
|
||||
github.com/refraction-networking/utls v1.6.0
|
||||
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611
|
||||
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b
|
||||
golang.org/x/net v0.19.0
|
||||
)
|
||||
|
||||
@@ -41,7 +41,7 @@ require (
|
||||
go.mongodb.org/mongo-driver v1.13.1 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.26.0 // indirect
|
||||
golang.org/x/crypto v0.16.0 // indirect
|
||||
golang.org/x/crypto v0.17.0 // indirect
|
||||
golang.org/x/image v0.14.0 // indirect
|
||||
golang.org/x/mod v0.14.0 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@@ -114,8 +114,12 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
|
||||
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
|
||||
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 h1:qCEDpW1G+vcj3Y7Fy52pEM1AWm3abj8WimGYejI3SC4=
|
||||
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
|
||||
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4=
|
||||
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI=
|
||||
golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4=
|
||||
golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
|
||||
3
tools.go
3
tools.go
@@ -92,6 +92,9 @@ func shouldSendContentLength(t *http.Request) bool
|
||||
//go:linkname removeEmptyPort net/http.removeEmptyPort
|
||||
func removeEmptyPort(host string) string
|
||||
|
||||
//go:linkname redirectBehavior net/http.redirectBehavior
|
||||
func redirectBehavior(reqMethod string, resp *http.Response, ireq *http.Request) (redirectMethod string, shouldRedirect, includeBody bool)
|
||||
|
||||
//go:linkname readTransfer net/http.readTransfer
|
||||
func readTransfer(msg any, r *bufio.Reader) (err error)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user