Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@httptoolkit/httpolyglot
Advanced tools
Serve http and https connections over the same port with node.js
Part of HTTP Toolkit: powerful tools for building, testing & debugging HTTP(S)
A module for serving HTTP, HTTPS and HTTP/2 connections, all over the same port.
Forked from the original httpolyglot
to fix various issues required for HTTP Toolkit, including:
tlsClientError
: https://github.com/mscdex/httpolyglot/pull/11clientError
events (https://github.com/mscdex/httpolyglot/issues/13)server.on(x, ...)
to hear about x
from all internal servers - HTTP/2, HTTP/1, TLS and net)npm install @httptoolkit/httpolyglot
const httpolyglot = require('@httptoolkit/httpolyglot');
const fs = require('fs');
httpolyglot.createServer({
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.crt')
}, function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end((req.socket.encrypted ? 'HTTPS' : 'HTTP') + ' Connection!');
}).listen(9000, 'localhost', function() {
console.log('httpolyglot server listening on port 9000');
// visit http://localhost:9000 and https://localhost:9000 in your browser ...
});
const httpolyglot = require('@httptoolkit/httpolyglot');
const fs = require('fs');
httpolyglot.createServer({
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.crt')
}, function(req, res) {
if (!req.socket.encrypted) {
res.writeHead(301, { 'Location': 'https://localhost:9000' });
return res.end();
}
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Welcome, HTTPS user!');
}).listen(9000, 'localhost', function() {
console.log('httpolyglot server listening on port 9000');
// visit http://localhost:9000 and https://localhost:9000 in your browser ...
});
Server - A class similar to https.Server (except instances have setTimeout()
from http.Server).
createServer(< object >tlsConfig[, < function >requestListener]) - Server - Creates and returns a new Server instance.
TLS and HTTP connections are easy to distinguish based on the first byte sent by clients trying to connect. See this comment for more information.
FAQs
Serve http and https connections over the same port with node.js
The npm package @httptoolkit/httpolyglot receives a total of 120,157 weekly downloads. As such, @httptoolkit/httpolyglot popularity was classified as popular.
We found that @httptoolkit/httpolyglot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.