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.7.0 to 0.8.0

source/utils/is-compatible.js

2

package.json
{
"name": "http2-wrapper",
"version": "0.7.0",
"version": "0.8.0",
"description": "HTTP2 client, just with the familiar `https` API",

@@ -5,0 +5,0 @@ "main": "source",

'use strict';
const {URL} = require('url'); // eslint-disable-line node/prefer-global/url
const {URL} = require('url');
const EventEmitter = require('events');

@@ -4,0 +4,0 @@ const tls = require('tls');

'use strict';
const {URL} = require('url'); // eslint-disable-line node/prefer-global/url
const {URL} = require('url');
const http = require('http');
const https = require('https');
const Http2ClientRequest = require('./client-request');
const isCompatible = require('./utils/is-compatible');
const Http2ClientRequest = isCompatible ? require('./client-request') : undefined;
const httpResolveALPN = require('./utils/http-resolve-alpn');

@@ -31,3 +32,3 @@ const urlToOptions = require('./utils/url-to-options');

if (alpnProtocol === 'h2') {
if (alpnProtocol === 'h2' && isCompatible) {
return (options, callback) => {

@@ -34,0 +35,0 @@ if (options.agent && options.agent.http2) {

'use strict';
const {URL} = require('url'); // eslint-disable-line node/prefer-global/url
const {URL} = require('url');
const http2 = require('http2');

@@ -4,0 +4,0 @@ const {Writable} = require('stream');

'use strict';
const http2 = require('http2');
const agent = require('./agent');
const ClientRequest = require('./client-request');
const IncomingMessage = require('./incoming-message');
const isCompatible = require('./utils/is-compatible');
const auto = require('./auto');
const get = (url, options, callback) => {
const req = ClientRequest.request(url, options, callback);
req.end();
if (isCompatible) {
const http2 = require('http2');
const agent = require('./agent');
const ClientRequest = require('./client-request');
const IncomingMessage = require('./incoming-message');
return req;
};
const get = (url, options, callback) => {
const req = ClientRequest.request(url, options, callback);
req.end();
module.exports = {
...http2,
...agent,
auto,
request: ClientRequest.request,
get,
ClientRequest,
IncomingMessage
};
return req;
};
module.exports = {
...http2,
...agent,
auto,
request: ClientRequest.request,
get,
ClientRequest,
IncomingMessage
};
} else {
module.exports = {auto};
}
'use strict';
const resolveALPN = require('resolve-alpn');
const calculateServerName = require('./calculate-server-name');
const isCompatible = require('./is-compatible');
const ALPNProtocols = isCompatible ? ['h2', 'http/1.1'] : ['http/1.1'];
// Transforms HTTP options into Socket options and resolves ALPN.
module.exports = (options, headers) => {
return resolveALPN({
ALPNProtocols: ['h2', 'http/1.1'],
ALPNProtocols,
...options,

@@ -10,0 +13,0 @@ port: options.port || 443,

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