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

http2-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http2-wrapper - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

5

package.json
{
"name": "http2-wrapper",
"version": "0.3.1",
"version": "0.3.2",
"description": "Use HTTP2 the same way like HTTP1",

@@ -47,4 +47,5 @@ "main": "source",

"dependencies": {
"defer-to-connect": "^1.0.0"
"defer-to-connect": "^1.0.0",
"url-parse-lax": "^3.0.0"
}
}

16

source/HTTP2ClientRequest.js

@@ -5,2 +5,3 @@ 'use strict';

const deferToConnect = require('defer-to-connect');
const urlParseLax = require('url-parse-lax');
const HTTP2IncomingMessage = require('./HTTP2IncomingMessage');

@@ -26,2 +27,4 @@ const proxySocket = require('./proxySocket');

const normalizePort = (port, protocol) => port ? port : (protocol === 'http:' ? 80 : 443);
class HTTP2ClientRequest extends Writable {

@@ -37,11 +40,8 @@ constructor(options, cb) {

// Accepts custom authority
if (options.authority) {
const parsed = new URL(options.authority);
options.port = parsed.port;
options.hostname = parsed.hostname;
options.host = parsed.hostname;
if (typeof options.authority === 'string') {
options.authority = urlParseLax(options.authority);
} else {
// We should normalize options.port on our own,
// because the TLS API and HTTP2 API normalize it in a different way.
options.port = options.port ? options.port : (options.protocol === 'http:' ? 80 : 443);
options.port = normalizePort(options.port, options.protocol);
}

@@ -62,3 +62,5 @@ }

this.session = http2.connect(options.authority || options, options);
const {authority} = options;
const normalizedAuthority = authority ? `${authority.protocol}//${authority.hostname}:${normalizePort(authority.port, authority.protocol)}` : options;
this.session = http2.connect(normalizedAuthority, {...options, host: options.hostname, path: undefined, session: undefined});
}

@@ -65,0 +67,0 @@

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