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

urllib

Package Overview
Dependencies
Maintainers
2
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urllib - npm Package Compare versions

Comparing version 3.16.0 to 3.16.1

7

package.json
{
"name": "urllib",
"version": "3.16.0",
"version": "3.16.1",
"publishConfig": {

@@ -70,3 +70,4 @@ "tag": "latest"

"pump": "^3.0.0",
"undici": "^5.22.1"
"undici": "^5.22.1",
"ylru": "^1.3.2"
},

@@ -91,3 +92,3 @@ "devDependencies": {

"typescript": "^5.0.4",
"vitest": "^0.30.1"
"vitest": "^0.31.1"
},

@@ -94,0 +95,0 @@ "engines": {

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

}
exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.16.0');
exports.HEADER_USER_AGENT = (0, default_user_agent_1.default)('node-urllib', '3.16.1');
function getFileName(stream) {

@@ -75,0 +75,0 @@ const filePath = stream.path;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.USER_AGENT = exports.HttpClient2 = exports.HttpClient = exports.getGlobalDispatcher = exports.setGlobalDispatcher = exports.Dispatcher = exports.Agent = exports.ProxyAgent = exports.MockAgent = exports.curl = exports.request = void 0;
const ylru_1 = __importDefault(require("ylru"));
const HttpClient_1 = require("./HttpClient");
let httpclient;
const domainSocketHttpclients = new ylru_1.default(50);
async function request(url, options) {
if (!httpclient) {
if (options?.socketPath) {
httpclient = new HttpClient_1.HttpClient({
if (options?.socketPath) {
let domainSocketHttpclient = domainSocketHttpclients.get(options.socketPath);
if (!domainSocketHttpclient) {
domainSocketHttpclient = new HttpClient_1.HttpClient({
connect: { socketPath: options.socketPath },
});
domainSocketHttpclients.set(options.socketPath, domainSocketHttpclient);
}
else {
httpclient = new HttpClient_1.HttpClient({});
}
return await domainSocketHttpclient.request(url, options);
}
if (!httpclient) {
httpclient = new HttpClient_1.HttpClient({});
}
return await httpclient.request(url, options);

@@ -18,0 +26,0 @@ }

@@ -66,3 +66,3 @@ import { EventEmitter } from 'node:events';

}
export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.16.0');
export const HEADER_USER_AGENT = createUserAgent('node-urllib', '3.16.1');
function getFileName(stream) {

@@ -69,0 +69,0 @@ const filePath = stream.path;

@@ -0,14 +1,19 @@

import LRU from 'ylru';
import { HttpClient, HEADER_USER_AGENT } from './HttpClient.js';
let httpclient;
const domainSocketHttpclients = new LRU(50);
export async function request(url, options) {
if (!httpclient) {
if (options?.socketPath) {
httpclient = new HttpClient({
if (options?.socketPath) {
let domainSocketHttpclient = domainSocketHttpclients.get(options.socketPath);
if (!domainSocketHttpclient) {
domainSocketHttpclient = new HttpClient({
connect: { socketPath: options.socketPath },
});
domainSocketHttpclients.set(options.socketPath, domainSocketHttpclient);
}
else {
httpclient = new HttpClient({});
}
return await domainSocketHttpclient.request(url, options);
}
if (!httpclient) {
httpclient = new HttpClient({});
}
return await httpclient.request(url, options);

@@ -15,0 +20,0 @@ }

@@ -0,1 +1,2 @@

import LRU from 'ylru';
import { HttpClient, HEADER_USER_AGENT } from './HttpClient';

@@ -5,12 +6,18 @@ import { RequestOptions, RequestURL } from './Request';

let httpclient: HttpClient;
const domainSocketHttpclients = new LRU(50);
export async function request<T = any>(url: RequestURL, options?: RequestOptions) {
if (!httpclient) {
if (options?.socketPath) {
httpclient = new HttpClient({
if (options?.socketPath) {
let domainSocketHttpclient = domainSocketHttpclients.get<HttpClient>(options.socketPath);
if (!domainSocketHttpclient) {
domainSocketHttpclient = new HttpClient({
connect: { socketPath: options.socketPath },
});
} else {
httpclient = new HttpClient({});
domainSocketHttpclients.set(options.socketPath, domainSocketHttpclient);
}
return await domainSocketHttpclient.request<T>(url, options);
}
if (!httpclient) {
httpclient = new HttpClient({});
}
return await httpclient.request<T>(url, options);

@@ -17,0 +24,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