We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rod Version: v0.105.1 在hijack request情况下,处理完特殊情况,正常情况通过ctx.LoadResponse(http.DefaultClient, true) 时,301跳转的url会有问题: 代码如下:
ctx.LoadResponse(http.DefaultClient, true)
router := page.HijackRequests() addErr := router.Add("*", "", func(ctx *rod.Hijack) { WebxHandle(ctx) }) if addErr != nil { fmt.Println("[agent]HijackRequests add err: ", addErr) return } go router.Run() func WebxHandle(ctx *rod.Hijack) { RequestHandler(ctx) // ResponseHandle(ctx) } func RequestHandler(ctx *rod.Hijack) { // drop static request reqUrl := ctx.Request.URL() err := ctx.LoadResponse(http.DefaultClient, true) if err != nil { fmt.Println("[LoadResponse]Error.", reqUrl, err) ctx.Response.Fail(proto.NetworkErrorReasonAborted) } }
如,请求:http://demo.aisec.cn/demo/aisec ,默认情况下会301跳转到 http://demo.aisec.cn/demo/aisec/ 。但是使用ctx.LoadResponse 会导致一种情况,response页面已经是新页面了,但是 url还是老的: http://demo.aisec.cn/demo/aisec , 里面的href 信息在浏览器自动拼接就会路径错误。 比如http://demo.aisec.cn/demo/js_link.php?id=2&msg=abc 正常应该是:http://demo.aisec.cn/demo/aisec/js_link.php?id=2&msg=abc
http://demo.aisec.cn/demo/aisec
http://demo.aisec.cn/demo/aisec/
ctx.LoadResponse
http://demo.aisec.cn/demo/js_link.php?id=2&msg=abc
http://demo.aisec.cn/demo/aisec/js_link.php?id=2&msg=abc
看了下代码, ctx.ContinueRequest(&proto.FetchContinueRequest{}) 似乎能解决这个问题,但是ctx.LoadResponse(http.DefaultClient, true) 的中间过程,是不是在hijack中体现出来?
The text was updated successfully, but these errors were encountered:
Please add a valid **Rod Version:** v0.0.0 to your issue. Current version is v0.105.1 generated by check-issue
**Rod Version:** v0.0.0
Sorry, something went wrong.
#322
No branches or pull requests
Rod Version: v0.105.1
在hijack request情况下,处理完特殊情况,正常情况通过
ctx.LoadResponse(http.DefaultClient, true)
时,301跳转的url会有问题:代码如下:
如,请求:
http://demo.aisec.cn/demo/aisec
,默认情况下会301跳转到http://demo.aisec.cn/demo/aisec/
。但是使用ctx.LoadResponse
会导致一种情况,response页面已经是新页面了,但是 url还是老的:http://demo.aisec.cn/demo/aisec
, 里面的href 信息在浏览器自动拼接就会路径错误。 比如http://demo.aisec.cn/demo/js_link.php?id=2&msg=abc
正常应该是:http://demo.aisec.cn/demo/aisec/js_link.php?id=2&msg=abc
看了下代码, ctx.ContinueRequest(&proto.FetchContinueRequest{}) 似乎能解决这个问题,但是ctx.LoadResponse(http.DefaultClient, true) 的中间过程,是不是在hijack中体现出来?
The text was updated successfully, but these errors were encountered: