Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@httptoolkit/httpolyglot

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@httptoolkit/httpolyglot - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

5

dist/index.d.ts

@@ -12,2 +12,7 @@ /// <reference types="node" />

interface Socket {
/**
* Only preserved for types backward compat - always undefined in new releases.
*
* @deprecated
*/
__httpPeekedData?: Buffer;

@@ -14,0 +19,0 @@ }

9

dist/index.js

@@ -71,3 +71,3 @@ "use strict";

connectionListener(socket) {
const data = socket.read(1);
const data = socket.read();
if (data === null) {

@@ -87,4 +87,2 @@ socket.removeListener('error', onError);

if (firstByte === TLS_HANDSHAKE_BYTE) {
// TLS sockets don't allow half open
socket.allowHalfOpen = false;
this._tlsServer.emit('connection', socket);

@@ -99,7 +97,2 @@ }

else {
// The above unshift isn't always sufficient to invisibly replace the
// read data. The rawPacket property on errors in the clientError event
// for plain HTTP servers loses this data - this prop makes it available.
// Bit of a hacky fix, but sufficient to allow for manual workarounds.
socket.__httpPeekedData = data;
this._httpServer.emit('connection', socket);

@@ -106,0 +99,0 @@ }

{
"name": "@httptoolkit/httpolyglot",
"version": "2.1.1",
"version": "2.2.0",
"author": "Tim Perry <pimterry@gmail.com>",

@@ -40,3 +40,3 @@ "description": "Serve http and https connections over the same port with node.js",

"dependencies": {
"@types/node": "^16.7.10"
"@types/node": "*"
},

@@ -43,0 +43,0 @@ "devDependencies": {

# Httpolyglot [![Build Status](https://github.com/httptoolkit/httpolyglot/workflows/CI/badge.svg)](https://github.com/httptoolkit/httpolyglot/actions) [![Available on NPM](https://img.shields.io/npm/v/@httptoolkit/httpolyglot.svg)](https://npmjs.com/package/@httptoolkit/httpolyglot)
> _Part of [HTTP Toolkit](https://httptoolkit.tech): powerful tools for building, testing & debugging HTTP(S)_
> _Part of [HTTP Toolkit](https://httptoolkit.com): powerful tools for building, testing & debugging HTTP(S)_
A module for serving http and https connections over the same port.
A module for serving HTTP, HTTPS and HTTP/2 connections, all over the same port.
Forked from the original [`httpolyglot`](https://github.com/mscdex/httpolyglot) to fix various issues required for [HTTP Toolkit](https://httptoolkit.tech), including:
Forked from the original [`httpolyglot`](https://github.com/mscdex/httpolyglot) to fix various issues required for [HTTP Toolkit](https://httptoolkit.com), including:
* Support for HTTP/2
* Fixing `tlsClientError`: https://github.com/mscdex/httpolyglot/pull/11.
* Exposing the lost bytes from https://github.com/mscdex/httpolyglot/issues/13 on the socket, as `__httpPeekedData`.
* Dropping support for old versions of Node (and thereby simplifying the code somewhat)
* Fixing `tlsClientError`: https://github.com/mscdex/httpolyglot/pull/11
* Include initially sniffed bytes aren't lost in subsequent `clientError` events (https://github.com/mscdex/httpolyglot/issues/13)
* Dropping support for very old versions of Node (and thereby simplifying the code somewhat)
* Converting to TypeScript
* Event subscription support (subscribe to `server.on(x, ...)` to hear about `x` from _all_ internal servers - HTTP/2, HTTP/1, TLS and net)

@@ -15,0 +16,0 @@ Requirements

@@ -11,2 +11,7 @@ import * as net from 'net';

interface Socket {
/**
* Only preserved for types backward compat - always undefined in new releases.
*
* @deprecated
*/
__httpPeekedData?: Buffer;

@@ -116,3 +121,3 @@ }

private connectionListener(socket: net.Socket) {
const data = socket.read(1);
const data = socket.read();

@@ -135,4 +140,2 @@ if (data === null) {

if (firstByte === TLS_HANDSHAKE_BYTE) {
// TLS sockets don't allow half open
socket.allowHalfOpen = false;
this._tlsServer.emit('connection', socket);

@@ -145,7 +148,2 @@ } else {

} else {
// The above unshift isn't always sufficient to invisibly replace the
// read data. The rawPacket property on errors in the clientError event
// for plain HTTP servers loses this data - this prop makes it available.
// Bit of a hacky fix, but sufficient to allow for manual workarounds.
socket.__httpPeekedData = data;
this._httpServer.emit('connection', socket);

@@ -152,0 +150,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc