New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@opencensus/instrumentation-https

Package Overview
Dependencies
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opencensus/instrumentation-https - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

17

build/src/https.d.ts

@@ -1,16 +0,1 @@

/**
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { HttpPlugin } from '@opencensus/instrumentation-http';

@@ -25,2 +10,4 @@ /** Https instrumentation plugin for Opencensus */

protected applyPatch(): any;
/** Patches HTTPS outgoing requests */
private getPatchHttpsOutgoingRequest();
/** Unpatches all HTTPS patched function. */

@@ -27,0 +14,0 @@ protected applyUnpatch(): void;

28

build/src/https.js

@@ -19,2 +19,4 @@ "use strict";

const instrumentation_http_1 = require("@opencensus/instrumentation-http");
const https = require("https");
const semver = require("semver");
const shimmer = require("shimmer");

@@ -40,6 +42,23 @@ /** Https instrumentation plugin for Opencensus */

}
// TODO: review the need to patch 'request'
shimmer.wrap(this.moduleExports, 'get', this.getPatchOutgoingRequestFunction());
shimmer.wrap(this.moduleExports, 'request', this.getPatchHttpsOutgoingRequest());
if (semver.satisfies(this.version, '>=8.0.0')) {
shimmer.wrap(this.moduleExports, 'get', this.getPatchHttpsOutgoingRequest());
}
return this.moduleExports;
}
/** Patches HTTPS outgoing requests */
getPatchHttpsOutgoingRequest() {
return (original) => {
const plugin = this;
return function httpsOutgoingRequest(options, callback) {
// Makes sure options will have default HTTPS parameters
if (typeof (options) !== 'string') {
options.protocol = options.protocol || 'https:';
options.port = options.port || 443;
options.agent = options.agent || https.globalAgent;
}
return (plugin.getPatchOutgoingRequestFunction())(original)(options, callback);
};
};
}
/** Unpatches all HTTPS patched function. */

@@ -52,3 +71,6 @@ applyUnpatch() {

}
shimmer.unwrap(this.moduleExports, 'get');
shimmer.unwrap(this.moduleExports, 'request');
if (semver.satisfies(this.version, '>=8.0.0')) {
shimmer.unwrap(this.moduleExports, 'get');
}
}

@@ -55,0 +77,0 @@ }

{
"name": "@opencensus/instrumentation-https",
"version": "0.0.2",
"version": "0.0.3",
"description": "Opencensus https automatic instrumentation package.",

@@ -59,4 +59,4 @@ "main": "build/src/index.js",

"dependencies": {
"@opencensus/instrumentation-http": "^0.0.2",
"@opencensus/opencensus-core": "^0.0.2",
"@opencensus/core": "^0.0.3",
"@opencensus/instrumentation-http": "^0.0.3",
"semver": "^5.5.0",

@@ -63,0 +63,0 @@ "shimmer": "^1.2.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