-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix proxying HTTPS requests to IP addresses (#4947)
* use own server-destroy implementation that supports secureConnect events * stand up HTTPS server for requests over ssl to IPs * don't need to resolve with * fix tests * stand up a server on 127.0.0.1 for test * tighten up / cleanup code, consolidate + refactor - lazily fs.outputfile’s - move sslIpServers to be global - add remove all CA utility * Improve proxy_spec test * Don't crash on server error events * feedback * derp Co-authored-by: Brian Mann <brian.mann86@gmail.com>
- Loading branch information
1 parent
1a4ac7d
commit 7b85344
Showing
13 changed files
with
186 additions
and
124 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
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
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,31 @@ | ||
import net from 'net' | ||
|
||
/** | ||
* `allowDestroy` adds a `destroy` method to a `net.Server`. `destroy(cb)` | ||
* will kill all open connections and call `cb` when the server is closed. | ||
* | ||
* Note: `server-destroy` NPM package cannot be used - it does not track | ||
* `secureConnection` events. | ||
*/ | ||
export function allowDestroy (server: net.Server) { | ||
let connections: net.Socket[] = [] | ||
|
||
function trackConn (conn) { | ||
connections.push(conn) | ||
|
||
conn.on('close', () => { | ||
connections = connections.filter((connection) => connection !== conn) | ||
}) | ||
} | ||
|
||
server.on('connection', trackConn) | ||
server.on('secureConnection', trackConn) | ||
|
||
// @ts-ignore Property 'destroy' does not exist on type 'Server'. | ||
server.destroy = function (cb) { | ||
server.close(cb) | ||
connections.map((connection) => connection.destroy()) | ||
} | ||
|
||
return server | ||
} |
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,6 +1,9 @@ | ||
import agent from './agent' | ||
import * as connect from './connect' | ||
import { allowDestroy } from './allow-destroy' | ||
|
||
export { agent } | ||
|
||
export { connect } | ||
export { | ||
agent, | ||
allowDestroy, | ||
connect, | ||
} |
Oops, something went wrong.
7b85344
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
linux x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.7b85344
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.7b85344
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppVeyor has built the
win32 ia32
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.7b85344
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circle has built the
darwin x64
version of the Test Runner.You can install this pre-release platform-specific build using instructions at https://on.cypress.io/installing-cypress#Install-pre-release-version.
You will need to use custom
CYPRESS_INSTALL_BINARY
url and install Cypress using an url instead of the version.