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.10.2 to 3.11.0

5

package.json
{
"name": "urllib",
"version": "3.10.2",
"version": "3.11.0",
"publishConfig": {

@@ -67,3 +67,2 @@ "tag": "latest"

"pump": "^3.0.0",
"tslib": "^2.4.0",
"undici": "^5.6.0"

@@ -89,3 +88,3 @@ },

"typescript": "^4.8.3",
"vitest": "^0.26.3"
"vitest": "^0.28.5"
},

@@ -92,0 +91,0 @@ "engines": {

8

src/cjs/diagnosticsChannel.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.initDiagnosticsChannel = void 0;
const tslib_1 = require("tslib");
const diagnostics_channel_1 = tslib_1.__importDefault(require("diagnostics_channel"));
const diagnostics_channel_1 = __importDefault(require("diagnostics_channel"));
const perf_hooks_1 = require("perf_hooks");
const util_1 = require("util");
const symbols_1 = tslib_1.__importDefault(require("./symbols"));
const symbols_1 = __importDefault(require("./symbols"));
const utils_1 = require("./utils");

@@ -10,0 +12,0 @@ const debug = (0, util_1.debuglog)('urllib:DiagnosticsChannel');

"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _HttpAgent_checkAddress;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpAgent = void 0;
const tslib_1 = require("tslib");
const dns_1 = tslib_1.__importDefault(require("dns"));
const dns_1 = __importDefault(require("dns"));
const net_1 = require("net");

@@ -38,6 +51,6 @@ const undici_1 = require("undici");

_HttpAgent_checkAddress.set(this, void 0);
tslib_1.__classPrivateFieldSet(this, _HttpAgent_checkAddress, options.checkAddress, "f");
__classPrivateFieldSet(this, _HttpAgent_checkAddress, options.checkAddress, "f");
}
dispatch(options, handler) {
if (tslib_1.__classPrivateFieldGet(this, _HttpAgent_checkAddress, "f") && options.origin) {
if (__classPrivateFieldGet(this, _HttpAgent_checkAddress, "f") && options.origin) {
const originUrl = typeof options.origin === 'string' ? new URL(options.origin) : options.origin;

@@ -52,3 +65,3 @@ let hostname = originUrl.hostname;

// if request hostname is ip, custom lookup won't excute
if (!tslib_1.__classPrivateFieldGet(this, _HttpAgent_checkAddress, "f").call(this, hostname, family)) {
if (!__classPrivateFieldGet(this, _HttpAgent_checkAddress, "f").call(this, hostname, family)) {
throw new IllegalAddressError(hostname, hostname, family);

@@ -55,0 +68,0 @@ }

"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _BlobFromStream_stream, _BlobFromStream_type, _HttpClient_instances, _HttpClient_defaultArgs, _HttpClient_dispatcher, _HttpClient_requestInternal, _HttpClient_updateSocketInfo;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpClient = exports.HEADER_USER_AGENT = void 0;
const tslib_1 = require("tslib");
const events_1 = require("events");
const http_1 = require("http");
const util_1 = require("util");

@@ -11,3 +25,3 @@ const zlib_1 = require("zlib");

const stream_1 = require("stream");
const stream_2 = tslib_1.__importDefault(require("stream"));
const stream_2 = __importDefault(require("stream"));
const path_1 = require("path");

@@ -20,10 +34,10 @@ const fs_1 = require("fs");

const form_data_encoder_1 = require("form-data-encoder");
const default_user_agent_1 = tslib_1.__importDefault(require("default-user-agent"));
const mime_types_1 = tslib_1.__importDefault(require("mime-types"));
const pump_1 = tslib_1.__importDefault(require("pump"));
const default_user_agent_1 = __importDefault(require("default-user-agent"));
const mime_types_1 = __importDefault(require("mime-types"));
const pump_1 = __importDefault(require("pump"));
// Compatible with old style formstream
const formstream_1 = tslib_1.__importDefault(require("formstream"));
const formstream_1 = __importDefault(require("formstream"));
const HttpAgent_1 = require("./HttpAgent");
const utils_1 = require("./utils");
const symbols_1 = tslib_1.__importDefault(require("./symbols"));
const symbols_1 = __importDefault(require("./symbols"));
const diagnosticsChannel_1 = require("./diagnosticsChannel");

@@ -51,10 +65,10 @@ const PROTO_RE = /^https?:\/\//i;

_BlobFromStream_type.set(this, void 0);
tslib_1.__classPrivateFieldSet(this, _BlobFromStream_stream, stream, "f");
tslib_1.__classPrivateFieldSet(this, _BlobFromStream_type, type, "f");
__classPrivateFieldSet(this, _BlobFromStream_stream, stream, "f");
__classPrivateFieldSet(this, _BlobFromStream_type, type, "f");
}
stream() {
return tslib_1.__classPrivateFieldGet(this, _BlobFromStream_stream, "f");
return __classPrivateFieldGet(this, _BlobFromStream_stream, "f");
}
get type() {
return tslib_1.__classPrivateFieldGet(this, _BlobFromStream_type, "f");
return __classPrivateFieldGet(this, _BlobFromStream_type, "f");
}

@@ -90,5 +104,5 @@ get [(_BlobFromStream_stream = new WeakMap(), _BlobFromStream_type = new WeakMap(), Symbol.toStringTag)]() {

_HttpClient_dispatcher.set(this, void 0);
tslib_1.__classPrivateFieldSet(this, _HttpClient_defaultArgs, clientOptions?.defaultArgs, "f");
__classPrivateFieldSet(this, _HttpClient_defaultArgs, clientOptions?.defaultArgs, "f");
if (clientOptions?.lookup || clientOptions?.checkAddress || clientOptions?.connect) {
tslib_1.__classPrivateFieldSet(this, _HttpClient_dispatcher, new HttpAgent_1.HttpAgent({
__classPrivateFieldSet(this, _HttpClient_dispatcher, new HttpAgent_1.HttpAgent({
lookup: clientOptions.lookup,

@@ -102,3 +116,3 @@ checkAddress: clientOptions.checkAddress,

async request(url, options) {
return await tslib_1.__classPrivateFieldGet(this, _HttpClient_instances, "m", _HttpClient_requestInternal).call(this, url, options);
return await __classPrivateFieldGet(this, _HttpClient_instances, "m", _HttpClient_requestInternal).call(this, url, options);
}

@@ -135,3 +149,3 @@ // alias to request, keep compatible with urlib@2 HttpClient.curl

retry: 0,
...tslib_1.__classPrivateFieldGet(this, _HttpClient_defaultArgs, "f"),
...__classPrivateFieldGet(this, _HttpClient_defaultArgs, "f"),
...options,

@@ -197,2 +211,3 @@ // keep method and headers exists on args for request event handler to easy use

statusCode: -1,
statusText: '',
headers: resHeaders,

@@ -261,3 +276,3 @@ size: 0,

opaque: internalOpaque,
dispatcher: args.dispatcher ?? tslib_1.__classPrivateFieldGet(this, _HttpClient_dispatcher, "f"),
dispatcher: args.dispatcher ?? __classPrivateFieldGet(this, _HttpClient_dispatcher, "f"),
};

@@ -424,2 +439,3 @@ if (args.followRedirect === false) {

res.status = res.statusCode = response.statusCode;
res.statusText = http_1.STATUS_CODES[res.status] || '';
if (res.headers['content-length']) {

@@ -481,3 +497,3 @@ res.size = parseInt(res.headers['content-length']);

// get real socket info from internalOpaque
tslib_1.__classPrivateFieldGet(this, _HttpClient_instances, "m", _HttpClient_updateSocketInfo).call(this, socketInfo, internalOpaque);
__classPrivateFieldGet(this, _HttpClient_instances, "m", _HttpClient_updateSocketInfo).call(this, socketInfo, internalOpaque);
const clientResponse = {

@@ -488,2 +504,3 @@ opaque: orginalOpaque,

statusCode: res.status,
statusText: res.statusText,
headers: res.headers,

@@ -502,3 +519,3 @@ url: lastUrl,

requestContext.retries++;
return await tslib_1.__classPrivateFieldGet(this, _HttpClient_instances, "m", _HttpClient_requestInternal).call(this, url, options, requestContext);
return await __classPrivateFieldGet(this, _HttpClient_instances, "m", _HttpClient_requestInternal).call(this, url, options, requestContext);
}

@@ -538,3 +555,3 @@ }

res.rt = (0, utils_1.performanceTime)(requestStartTime);
tslib_1.__classPrivateFieldGet(this, _HttpClient_instances, "m", _HttpClient_updateSocketInfo).call(this, socketInfo, internalOpaque);
__classPrivateFieldGet(this, _HttpClient_instances, "m", _HttpClient_updateSocketInfo).call(this, socketInfo, internalOpaque);
if (this.listenerCount('response') > 0) {

@@ -541,0 +558,0 @@ this.emit('response', {

@@ -31,2 +31,3 @@ /// <reference types="node" />

statusCode: number;
statusText: string;
headers: IncomingHttpHeaders;

@@ -46,2 +47,3 @@ timing: Timing;

statusCode: number;
statusText: string;
headers: IncomingHttpHeaders;

@@ -48,0 +50,0 @@ url: string;

@@ -0,3 +1,13 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _HttpAgent_checkAddress;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import dns from 'dns';

@@ -4,0 +14,0 @@ import { isIP } from 'net';

@@ -0,4 +1,15 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _BlobFromStream_stream, _BlobFromStream_type, _HttpClient_instances, _HttpClient_defaultArgs, _HttpClient_dispatcher, _HttpClient_requestInternal, _HttpClient_updateSocketInfo;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { EventEmitter } from 'events';
import { STATUS_CODES } from 'http';
import { debuglog } from 'util';

@@ -187,2 +198,3 @@ import { createGunzip, createBrotliDecompress, gunzipSync, brotliDecompressSync, } from 'zlib';

statusCode: -1,
statusText: '',
headers: resHeaders,

@@ -413,2 +425,3 @@ size: 0,

res.status = res.statusCode = response.statusCode;
res.statusText = STATUS_CODES[res.status] || '';
if (res.headers['content-length']) {

@@ -476,2 +489,3 @@ res.size = parseInt(res.headers['content-length']);

statusCode: res.status,
statusText: res.statusText,
headers: res.headers,

@@ -478,0 +492,0 @@ url: lastUrl,

@@ -31,2 +31,3 @@ /// <reference types="node" />

statusCode: number;
statusText: string;
headers: IncomingHttpHeaders;

@@ -46,2 +47,3 @@ timing: Timing;

statusCode: number;
statusText: string;
headers: IncomingHttpHeaders;

@@ -48,0 +50,0 @@ url: string;

import { EventEmitter } from 'events';
import { LookupFunction } from 'net';
import { STATUS_CODES } from 'http';
import { debuglog } from 'util';

@@ -252,2 +253,3 @@ import {

statusCode: -1,
statusText: '',
headers: resHeaders,

@@ -474,2 +476,3 @@ size: 0,

res.status = res.statusCode = response.statusCode;
res.statusText = STATUS_CODES[res.status] || '';
if (res.headers['content-length']) {

@@ -532,2 +535,3 @@ res.size = parseInt(res.headers['content-length']);

statusCode: res.status,
statusText: res.statusText,
headers: res.headers,

@@ -534,0 +538,0 @@ url: lastUrl,

@@ -40,2 +40,3 @@ import { Readable } from 'stream';

statusCode: number;
statusText: string;
headers: IncomingHttpHeaders;

@@ -58,2 +59,3 @@ timing: Timing;

statusCode: number;
statusText: string;
headers: IncomingHttpHeaders;

@@ -60,0 +62,0 @@ url: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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