Skip to content

Proxied requests cannot be aborted #332

Description

@tbardiuk-ua

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:

browser = Ferrum::Browser.new(headless: false)
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')

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:

browser = Ferrum::Browser.new(proxy: { host: 'host.com', port: '80', user: 'username', password: 'password' }, headless: false)

I also checked if the on(:request) block is executed at all, and yes, it is. But request.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions