forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plumb raw headers when intercepting a request
This CL ensures that |RequestHeadersCallback| and |ResponseHeadersCallback| are proxied from the |URLRequest| to the |DevToolsURLInterceptorJob::SubRequest| when intercepting a request. This allows the SubRequest to receive SPDY/QUIC internal headers, as well as plain HTTP raw headers. BUG=806281 R=caseq@chromium.org Change-Id: Id152c63426468ab7637d2885dad7b91f124b54aa Reviewed-on: https://chromium-review.googlesource.com/916901 Commit-Queue: Andrey Kosyakov <caseq@chromium.org> Reviewed-by: Andrey Kosyakov <caseq@chromium.org> Cr-Commit-Position: refs/heads/master@{#537971}
- Loading branch information
Showing
6 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...Tests/http/tests/inspector-protocol/network/request-interception-raw-headers-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Tests that raw response headers are correctly reported in case of interception. | ||
Test started | ||
Network agent enabled | ||
Request interception enabled | ||
Page agent enabled | ||
Runtime agent enabled | ||
Response.requestHeadersText present: true | ||
Connection raw header present: true | ||
Network.requestIntercepted ID 1 GET simple-iframe.html type: Document | ||
allowRequest ID 1 | ||
Network.responseReceived simple-iframe.html 200 text/html | ||
Page.frameStoppedLoading | ||
|
28 changes: 28 additions & 0 deletions
28
...Kit/LayoutTests/http/tests/inspector-protocol/network/request-interception-raw-headers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(async function(testRunner) { | ||
var {page, session, dp} = await testRunner.startBlank( | ||
`Tests that raw response headers are correctly reported in case of interception.`); | ||
|
||
var InterceptionHelper = await testRunner.loadScript('../resources/interception-test.js'); | ||
var helper = new InterceptionHelper(testRunner, session); | ||
|
||
var requestInterceptedDict = { | ||
'simple-iframe.html': event => helper.allowRequest(event), | ||
}; | ||
|
||
await helper.startInterceptionTest(requestInterceptedDict); | ||
session.evaluate(` | ||
var iframe = document.createElement('iframe'); | ||
iframe.src = '${testRunner.url('./resources/simple-iframe.html')}'; | ||
document.body.appendChild(iframe); | ||
`); | ||
|
||
await dp.Network.onResponseReceived(event => { | ||
const response = event.params.response; | ||
const haveRequestHeadersText = response.requestHeadersText; | ||
const splitRawHeaders = response.requestHeadersText.split('\r\n'); | ||
const connectionHeaderPresent = splitRawHeaders.filter(header => header.includes('Connection')); | ||
|
||
testRunner.log(`Response.requestHeadersText present: ${!!haveRequestHeadersText}`); | ||
testRunner.log(`Connection raw header present: ${!!connectionHeaderPresent.length}`); | ||
}); | ||
}) |