8000 fix: match net module headers & http.IncomingMessage headers by codebytere · Pull Request #17517 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: match net module headers & http.IncomingMessage headers #17517

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

Merged
merged 5 commits into from
Apr 2, 2019

Conversation

codebytere
Copy link
Member
@codebytere codebytere commented Mar 22, 2019

Description of Change

BREAKING CHANGE

Fixes #8117.

Filters net module incoming headers to more accurately match those returned in http.IncomingMessage.

cc @nornagon @MarshallOfSound

More specifically, after this change:

  • Duplicates of age, authorization, content-length, content-type, etag, expires, from, host, if-modified-since, if-unmodified-since, last-modified, location, max-forwards, proxy-authorization, referer, retry-after, or user-agent are discarded.
  • set-cookie is always an array. Duplicates are added to the array.
  • For duplicate cookie headers, the values are joined together with '; '.
  • For all other headers, the values are joined together with ', '.

Tested with:

const { app } = require('electron')

app.on('ready', () => {
  const { net } = require('electron')
  const request = net.request('https://github.com')
  request.on('response', response => {
    console.log('HEADERS: ', response.headers)
  })
  request.end()
})

to ensure that headers conform to the new rules appropriately

Checklist

Release Notes

Notes: Fixed disparity between net module headers and Node.js' http.IncomingMessage headers

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Mar 22, 2019
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Mar 23, 2019
Co-Authored-By: codebytere <codebytere@github.com>
@codebytere
Copy link
Member Author

Failure is:

not ok 139 BrowserWindow module "useContentSize" option make window created with content size when used
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  
  124 !== 400
  
      at Context.<anonymous> (C:\projects\src\electron\spec\api-browser-window-spec.js:1229:14)
      at callFn (C:\projects\src\electron\spec\node_modules\mocha\lib\runnable.js:372:21)
      at Test.Runnable.run (C:\projects\src\electron\spec\node_modules\mocha\lib\runnable.js:364:7)
      at Runner.runTest (C:\projects\src\electron\spec\node_modules\mocha\lib\runner.js:455:10)
      at C:\projects\src\electron\spec\node_modules\mocha\lib\runner.js:573:12
      at next (C:\projects\src\electron\spec\node_modules\mocha\lib\runner.js:369:14)
      at C:\projects\src\electron\spec\node_modules\mocha\lib\runner.js:379:7
      at next (C:\projects\src\electron\spec\node_modules\mocha\lib\runner.js:303:14)
      at Immediate._onImmediate (C:\projects\src\electron\spec\node_modules\mocha\lib\runner.js:347:5)
      at processImmediate (timers.js:632:19)

which is assuredly not related, so merging regardless.

@codebytere codebytere merged commit 8ea33d6 into master Apr 2, 2019
@release-clerk
Copy link
release-clerk bot commented Apr 2, 2019

Release Notes Persisted

Fixed disparity between net module headers and Node.js' http.IncomingMessage headers

@codebytere codebytere deleted the net-headers branch April 2, 2019 14:41
kiku-jw pushed a commit to kiku-jw/electron that referenced this pull request May 16, 2019
…n#17517)

* fix: match net module headers & http.IncomingMessage headers

* update net doc for cleanliness

* address feedback from review

* Update spec/api-net-spec.js

Co-Authored-By: codebytere <codebytere@github.com>

* add special cookie case
@ckerr ckerr added the semver/major incompatible API changes label Jul 29, 2019
NilSet pushed a commit to NilSet/electron that referenced this pull request Mar 4, 2020
Fixes electron#22521

Updates the docs for IncomingMessage.headers to match the changes made in electron#17517
zcbenz added a commit that referenced this pull request Mar 18, 2020
* docs: update type and description of IncomingMessage.headers

Fixes #22521

Updates the docs for IncomingMessage.headers to match the changes made in #17517

* Update docs/api/incoming-message.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Cheng Zhao <zcbenz@electronjs.org>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
sentialx pushed a commit to sentialx/electron that referenced this pull request Apr 7, 2020
…n#22522)

* docs: update type and description of IncomingMessage.headers

Fixes electron#22521

Updates the docs for IncomingMessage.headers to match the changes made in electron#17517

* Update docs/api/incoming-message.md

Co-Authored-By: Mark Lee <malept@users.noreply.github.com>

Co-authored-by: Cheng Zhao <zcbenz@electronjs.org>
Co-authored-by: Mark Lee <malept@users.noreply.github.com>
@gschier gschier mentioned this pull request Jul 17, 2020
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/major incompatible API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disparity between net module headers and Node IncommingMessage headers
3 participants
0