New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 732154 link

Starred by 21 users

Issue metadata

Status: Fixed
Merged: issue 702384
Owner:
Last visit > 30 days ago
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug


Show other hotlists

Hotlists containing this issue:
Hotlist-1


Sign in to add a comment

Request interception won't work with --proxy-server flag

Reported by excheque...@gmail.com, Jun 11 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3124.4 Safari/537.36

Steps to reproduce the problem:
1. Start Chrome with the --proxy-server flag pointing to a valid and working proxy server.
2. Connect via remote debugging, and write sample code listed here - https://groups.google.com/a/chromium.org/forum/#!topic/headless-dev/uvms04dXTIM
3. Look at results

What is the expected behavior?
Interception should work

What went wrong?
Interception doesn't work! More specifically, the Network.requestIntercepted event isn't fired.

When Chrome is started without the --proxy-server flag, interception works as intended.

Did this work before? N/A 

Chrome version: 61.0.3124.4  Channel: dev
OS Version: OS X 10.12.5
Flash Version:
 
This is related to [#702384].
Labels: Needs-Triage-M61

Comment 4 by asanka@chromium.org, Jun 19 2017

Components: Internals>Network>Proxy
Mergedinto: 702384
Status: Duplicate (was: Unconfirmed)
As per comment#2, the issue looks similar to Bug ID -- 702384, so merging into the same. Please un-merge if not the case.
Thank You.
Owner: alexclarke@chromium.org
Status: Assigned (was: Duplicate)
702384 is a tracking bug for feature development.  This is a bug report, unmerging.

Comment 7 by mmenke@chromium.org, Jun 22 2017

Components: -Internals>Network>Proxy
This is probably because HeadlessURLRequestContextGetter::GetURLRequestContext doesn't set up the proxy_service.  Looking at ProfileIOData::Init this is done:

 main_request_context_storage_->set_proxy_service(
      ProxyServiceFactory::CreateProxyService(
          io_thread->net_log(), main_request_context_.get(),
          network_delegate.get(),
          std::move(profile_params_->proxy_config_service), command_line,
          io_thread->WpadQuickCheckEnabled(),
          io_thread->PacHttpsUrlStrippingEnabled()));


We should do something similar in HeadlessURLRequestContextGetter.
One wrinkle, ProxyServiceFactory::CreateProxyService lives in the chrome/ layer (fortunately the proxy implementation lives in net/) which we (probably) can't use.  I expect we'd need to duplicate the file :(
Actually can we confirm if this is with --headless or not?
Yes it is with --headless.
Cc: alexclarke@chromium.org
 Issue 732499  has been merged into this issue.
#8 is wrong.  The proxy service is set up, not sure what I was thinking ;)

I wonder if this is something entirely different, exchequer598@ if you're listening is your --proxy_server flag a simple URL or do you have something more complex in there?

The --proxy_server flag supported by headless is currently just a URL, but normal chrome supports more complex syntax (which seems to be) parsed by ProxyConfig::ProxyRules::ParseFromString.  Maybe headless should use that too?

Project Member

Comment 14 by bugdroid1@chromium.org, Jul 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/094472afa242fa5ec156b2b744b774e1dfd0a046

commit 094472afa242fa5ec156b2b744b774e1dfd0a046
Author: Alex Clarke <alexclarke@chromium.org>
Date: Tue Jul 11 14:59:32 2017

Headless: support more complex --proxy_server strings

Previously in headless mode --proxy_server only supported a URL where as
chrome supports a richer syntax allowing various proxy fallbacks.  This patch
makes headless mode --proxy_server work the same way.

Bug:  732154 
Change-Id: I850c6ea5596ffc7e528b3a005a585c209d3af8e5
Reviewed-on: https://chromium-review.googlesource.com/567008
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485630}
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/app/headless_shell.cc
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/lib/browser/headless_browser_context_impl.cc
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/lib/browser/headless_browser_context_options.cc
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/lib/browser/headless_browser_context_options.h
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/lib/browser/headless_url_request_context_getter.cc
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/lib/browser/headless_url_request_context_getter.h
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/lib/headless_browser_browsertest.cc
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/public/headless_browser.cc
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/public/headless_browser.h
[modify] https://crrev.com/094472afa242fa5ec156b2b744b774e1dfd0a046/headless/public/headless_browser_context.h

Project Member

Comment 15 by bugdroid1@chromium.org, Jul 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/203e89c4f1912c51bb837e22c7574af1604b05c1

commit 203e89c4f1912c51bb837e22c7574af1604b05c1
Author: Alex Clarke <alexclarke@chromium.org>
Date: Wed Jul 12 10:40:00 2017

Headless: Add a test of DevTools request interception with an Auth Proxy

There have been some reports of these features not working together. This 
test tries to ensure that they do work.

Bug:  732154 
Change-Id: Ieccd55603d35a92342a868fc7753f3af98a4aed7
Reviewed-on: https://chromium-review.googlesource.com/567505
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485917}
[modify] https://crrev.com/203e89c4f1912c51bb837e22c7574af1604b05c1/headless/lib/headless_devtools_client_browsertest.cc
[modify] https://crrev.com/203e89c4f1912c51bb837e22c7574af1604b05c1/headless/test/headless_browser_test.cc
[modify] https://crrev.com/203e89c4f1912c51bb837e22c7574af1604b05c1/headless/test/headless_browser_test.h

Well it appears there's nothing fundamental in the net stack that prevents interception working with a proxy.  The test I just added spins up a simple Auth proxy and it sets up a HeadelssBrowserContext with the same code path that --proxy_server in HeadlessShell uses, and it tests that devtools interception works.  Currently I'm puzzled why this isn't working for the bug reporter.
@Alex,

Thanks for the test. I've noted it in a slightly related thread (see https://bugs.chromium.org/p/chromium/issues/detail?id=702384#c14), but installing Wireshark fixed the issue for me. I'm guessing there was some dependency I was missing on my box - Ubuntu Xenial's base Docker image.
Status: Fixed (was: Assigned)
Thanks for closing the loop. I guess we can close this too :)
@Alex,

Thanks a ton for your work on the interception API. Would you mind helping figure out the dependency that was missing? Install wireshark increases my Docker image's size considerably, so I'd rather install only the Chome interception-specific ones.

Comment 20 by rvera@chromium.org, Jul 13 2017

Cc: nednguyen@chromium.org kkaluri@chromium.org johnchen@chromium.org rmis...@chromium.org skyos...@chromium.org rvera@chromium.org
 Issue 681521  has been merged into this issue.

Sign in to add a comment