-
-
Notifications
You must be signed in to change notification settings - Fork 145
Proxied requests cannot be aborted #332
New issue
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
Comments
I enabled logging and found out that the problem is with this line, which calls continue on an intercepted request before we call abort. As a result, when we call abort, we get back an "Invalid state for continueInterceptedRequest" error. Until this is fixed, the workaround is to do the following: browser = Ferrum::Browser.new(proxy: { host: 'host.com', port: '80' }, headless: false)
browser.network.authorize(user: 'username', password: 'password', type: :proxy) {}
browser.network.intercept
browser.on(:request) do |request|
if request.resource_type == 'Image'
request.abort
else
request.continue
end
end
browser.go_to('https://bing.com') This ensures that the line I linked to isn't called, while still enabling authorization, but passing through an empty block to authorize that doesn't call request.continue. |
Thank you guys for reporting and for findings, I’ll get back to you after investigation |
I ran into this issue as well with proxies. Thank you for the tip on how to solve it |
@danest could you make it work using the same workaround? For me both this approach, and the request filtering directly within the Curious to know if you managed to solve it in a slightly different way |
Hi guys. I'm trying to reduce traffic usage by not loading images. However, it seems that intercepted requests cannot be aborted when a proxy is used.
Here's an example:
The result is a page with no images loaded, so everything works as expected. But if I just change the browser options by adding a proxy, all the images will load:
I also checked if the
on(:request)
block is executed at all, and yes, it is. Butrequest.abort
doesn't seem to do anything.Does anyone have any idea why this is happening and how to fix the problem?
Thanks in advance.
The text was updated successfully, but these errors were encountered: