@httptoolkit/httpolyglot
Advanced tools
Comparing version 1.0.1 to 2.0.0
@@ -8,3 +8,2 @@ "use strict"; | ||
const http2 = require("http2"); | ||
const SocketWrapper = require('_stream_wrap'); | ||
const events_1 = require("events"); | ||
@@ -113,3 +112,9 @@ function onError(err) { } | ||
// We have a full match for the preface - it's definitely HTTP/2. | ||
h2Server.emit('connection', new SocketWrapper(socket)); | ||
// For HTTP/2 we hit issues when passing non-socket streams (like HTTP/2 streams, | ||
// for proxying H2-over-H2). Marking the sockets like this resolves that: | ||
const socketWithInternals = socket; | ||
if (socketWithInternals._handle) { | ||
socketWithInternals._handle.isStreamBase = false; | ||
} | ||
h2Server.emit('connection', socket); | ||
return; | ||
@@ -116,0 +121,0 @@ } |
{ | ||
"name": "@httptoolkit/httpolyglot", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"author": "Tim Perry <pimterry@gmail.com>", | ||
@@ -20,3 +20,3 @@ "description": "Serve http and https connections over the same port with node.js", | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=12.0.0" | ||
}, | ||
@@ -23,0 +23,0 @@ "keywords": [ |
@@ -1,4 +0,5 @@ | ||
Description | ||
=========== | ||
# 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)_ | ||
A module for serving http and https connections over the same port. | ||
@@ -8,2 +9,3 @@ | ||
* Support for HTTP/2 | ||
* Fixing `tlsClientError`: https://github.com/mscdex/httpolyglot/pull/11. | ||
@@ -17,3 +19,3 @@ * Exposing the lost bytes from https://github.com/mscdex/httpolyglot/issues/13 on the socket, as `__httpPeekedData`. | ||
* [node.js](http://nodejs.org/) -- v8.0.0 or newer | ||
* [node.js](http://nodejs.org/) -- v12.0.0 or newer | ||
@@ -20,0 +22,0 @@ |
@@ -6,3 +6,2 @@ import * as net from 'net'; | ||
import * as http2 from 'http2'; | ||
const SocketWrapper = require('_stream_wrap'); | ||
@@ -140,3 +139,11 @@ import { EventEmitter } from 'events'; | ||
// We have a full match for the preface - it's definitely HTTP/2. | ||
h2Server.emit('connection', new SocketWrapper(socket)); | ||
// For HTTP/2 we hit issues when passing non-socket streams (like HTTP/2 streams, | ||
// for proxying H2-over-H2). Marking the sockets like this resolves that: | ||
const socketWithInternals = socket as { _handle?: { isStreamBase?: boolean } }; | ||
if (socketWithInternals._handle) { | ||
socketWithInternals._handle.isStreamBase = false; | ||
} | ||
h2Server.emit('connection', socket); | ||
return; | ||
@@ -143,0 +150,0 @@ } else { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23141
308
85
4