forked from request/request
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exposed socket in http2 response to handle false positive strictSSL e…
…rror * Refactoring changes
- Loading branch information
1 parent
859226d
commit ffd8667
Showing
5 changed files
with
24 additions
and
11 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
/* | ||
* The following code has been borrowed from the Node.js project | ||
* v20.15.0 /Users/[email protected]/node/lib/internal/http2/compat.js | ||
*/ | ||
const {constants = {}} = require('http2') | ||
|
||
// Referenced from https://github.com/nodejs/node/blob/0bf200b49a9a6eacdea6d5e5939cc2466506d532/lib/internal/http2/util.js#L107 | ||
const kValidPseudoHeaders = new Set([ | ||
constants.HTTP2_HEADER_STATUS, | ||
constants.HTTP2_HEADER_METHOD, | ||
|
@@ -12,17 +9,20 @@ const kValidPseudoHeaders = new Set([ | |
constants.HTTP2_HEADER_PATH | ||
]) | ||
|
||
// Referenced from https://github.com/nodejs/node/blob/0bf200b49a9a6eacdea6d5e5939cc2466506d532/lib/internal/http2/util.js#L573 | ||
function assertValidPseudoHeader (header) { | ||
if (!kValidPseudoHeaders.has(header)) { | ||
throw new Error('Invalid PseudoHeader ' + header) | ||
} | ||
} | ||
|
||
// Referenced from https://github.com/nodejs/node/blob/0bf200b49a9a6eacdea6d5e5939cc2466506d532/lib/_http_common.js#L206 | ||
const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/ | ||
function checkIsHttpToken (token) { | ||
return RegExp(tokenRegExp).exec(token) !== null | ||
} | ||
|
||
|
||
module.exports = { | ||
assertValidPseudoHeader, | ||
checkIsHttpToken | ||
|
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