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

Issue 692090 link

Starred by 12 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Cookie response headers not shown when inspecting headless browser

Project Member Reported by skyos...@chromium.org, Feb 14 2017

Issue description

What steps will reproduce the problem?
(1) python3 cookie.py
(2) google-chrome --headless --remote-debugging-port=9222 http://localhost:8000
(3) Navigate to localhost:9222 and click on the inspector link.
(4) Open the network pane, reload the page and click on the "localhost" resource.

"Set-Cookie" should be listed in the results but it isn't. See the screenshots.

Maybe we're missing some DevTools instrumentation for this?
 
cookie.py
310 bytes View Download
normal-headers.png
65.4 KB View Download
headless-headers.png
39.4 KB View Download
also missing on the Response when using the remote debugging protocol

https://chromedevtools.github.io/debugger-protocol-viewer/tot/Network/#type-Response
Additionally, it seems that the Cookie header isn't exposed either, and other headers like Accept, Accept-Encoding, Cache-Control, Connection, Host are missing as well from requests.
Components: Internals>Headless
I don't know why dev people decided to hide those headers. It's don't seems reasonable to me. 

Please expose Cookie headers.

In fact, please expose all headers, don't hide them.

Thank you.


Owner: alexclarke@chromium.org
Status: Assigned (was: Available)
Sami, you need to make sure the 

https://cs.chromium.org/chromium/src/content/common/resource_request.h?sq=package:chromium&l=182

is not lost. It controls raw header and timing being populated.

https://cs.chromium.org/chromium/src/content/child/web_url_loader_impl.cc?dr=CSs&l=120

Over to Alex in case it is easily fixable.
Thanks for the tip! I'm not sure where that would be getting lost since content should set it automatically when the inspector is open (i.e., network domain is enabled). We'll investigate...
I wonder if this is something to do with the net::URLRequestContext HeadlessURLRequestContextGetter.
I've reproduced this experimentally, it seems the Network.responseReceived doesn't contain the headers as expected.  I'll try and dig into what is going wrong here.
Strangely I can see that with --headless the ResourceResoonse data is going by the legacy IPC system and without it it's going via mojo.  We should find out why that is (maybe a finch trial?)
I believe I understand why cookies don't show up with --headless set.  The reason is by default with --headless there is no NetLog.  That matters because Set-Cookie headers are not usually sent to the Renderer (possibly for security reasons?) and DevTools relies on a sidechannel populated from NetLogData to obtain the full response headers.

Setting a --log-net-log=SomeFile would fix this, except HeadlessContentBrowserClient doesn't override GetNetLog, which it should.
Status: Fixed (was: Assigned)
https://www.chromium.org/developers/design-documents/network-stack/netlog

> Non-Goals
> 
> NetLog is intended solely for logging.
>
> Features needing reliable network information should never be built on top of NetLog.
> It may be tempting to add an observer of NetLog as a quick hack to glean some internal
> state (since you circumvent having to create a proper interface and plumb it
> deep into the network stack). But that is wrong, and it will break. Instead, you should
> add an interface to NetworkDelegate, complete with regression tests and
> documentation.
Can anyone confirm that this started working properly for them? I am still experiencing this issue.

Sign in to add a comment