MCPcopy
hub / github.com/websockets/ws / proxy

Function proxy

test/websocket.test.js:1587–1603  ·  view source on GitHub ↗
(httpServer, httpsServer)

Source from the content-addressed store, hash-verified

1585
1586 describe('When moving away from a secure context', () => {
1587 function proxy(httpServer, httpsServer) {
1588 const server = net.createServer({ allowHalfOpen: true });
1589
1590 server.on('connection', (socket) => {
1591 socket.on('readable', function read() {
1592 socket.removeListener('readable', read);
1593
1594 const buf = socket.read(1);
1595 const target = buf[0] === 22 ? httpsServer : httpServer;
1596
1597 socket.unshift(buf);
1598 target.emit('connection', socket);
1599 });
1600 });
1601
1602 return server;
1603 }
1604
1605 describe("If there is no 'redirect' event listener", () => {
1606 it('drops the `auth` option', (done) => {

Callers 1

websocket.test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected