🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

urllib

Package Overview
Dependencies
Maintainers
12
Versions
244
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

to
3.18.0

4

package.json
{
"name": "urllib",
"version": "3.17.2",
"version": "3.18.0",
"publishConfig": {

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

"pump": "^3.0.0",
"qs": "^6.11.2",
"undici": "^5.22.1",

@@ -81,2 +82,3 @@ "ylru": "^1.3.2"

"@types/pump": "^1.1.1",
"@types/qs": "^6.9.7",
"@types/selfsigned": "^2.0.1",

@@ -83,0 +85,0 @@ "@types/tar-stream": "^2.2.2",

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

/**
* sockePath string | null (optional) - Default: null - An IPC endpoint, either Unix domain socket or Windows named pipe
* socketPath string | null (optional) - Default: null - An IPC endpoint, either Unix domain socket or Windows named pipe
*/

@@ -37,0 +37,0 @@ socketPath?: string | null;

@@ -24,2 +24,3 @@ "use strict";

const mime_types_1 = __importDefault(require("mime-types"));
const qs_1 = __importDefault(require("qs"));
const pump_1 = __importDefault(require("pump"));

@@ -76,3 +77,3 @@ // Compatible with old style formstream

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

@@ -172,3 +173,3 @@ const filePath = stream.path;

};
const orginalOpaque = args.opaque;
const originalOpaque = args.opaque;
// using opaque to diagnostics channel, binding request and socket

@@ -180,3 +181,3 @@ const internalOpaque = {

[symbols_1.default.kRequestTiming]: timing,
[symbols_1.default.kRequestOrginalOpaque]: orginalOpaque,
[symbols_1.default.kRequestOriginalOpaque]: originalOpaque,
};

@@ -388,8 +389,16 @@ const reqMeta = {

if (!isStringOrBufferOrReadable) {
for (const field in args.data) {
const fieldValue = args.data[field];
if (fieldValue === undefined)
continue;
requestUrl.searchParams.append(field, fieldValue);
if (args.nestedQuerystring) {
const querystring = qs_1.default.stringify(args.data);
// reset the requestUrl
const href = requestUrl.href;
requestUrl = new URL(href + (href.includes('?') ? '&' : '?') + querystring);
}
else {
for (const field in args.data) {
const fieldValue = args.data[field];
if (fieldValue === undefined)
continue;
requestUrl.searchParams.append(field, fieldValue);
}
}
}

@@ -413,3 +422,8 @@ }

headers['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
requestOptions.body = new URLSearchParams(args.data).toString();
if (args.nestedQuerystring) {
requestOptions.body = qs_1.default.stringify(args.data);
}
else {
requestOptions.body = new URLSearchParams(args.data).toString();
}
}

@@ -524,3 +538,3 @@ }

const clientResponse = {
opaque: orginalOpaque,
opaque: originalOpaque,
data,

@@ -580,3 +594,3 @@ status: res.status,

}
err.opaque = orginalOpaque;
err.opaque = originalOpaque;
err.status = res.status;

@@ -583,0 +597,0 @@ err.headers = res.headers;

@@ -48,2 +48,7 @@ /// <reference types="node" />

/**
* urllib default use URLSearchParams to stringify form data which don't support nested object,
* will use qs instead of URLSearchParams to support nested object by set this option to true.
*/
nestedQuerystring?: boolean;
/**
* @deprecated

@@ -50,0 +55,0 @@ * Only for d.ts keep compatible with urllib@2, don't use it anymore.

@@ -15,4 +15,4 @@ declare const _default: {

kRequestTiming: symbol;
kRequestOrginalOpaque: symbol;
kRequestOriginalOpaque: symbol;
};
export default _default;

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

kRequestTiming: Symbol('request timing'),
kRequestOrginalOpaque: Symbol('request orginal opaque'),
kRequestOriginalOpaque: Symbol('request original opaque'),
};

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

/**
* sockePath string | null (optional) - Default: null - An IPC endpoint, either Unix domain socket or Windows named pipe
* socketPath string | null (optional) - Default: null - An IPC endpoint, either Unix domain socket or Windows named pipe
*/

@@ -37,0 +37,0 @@ socketPath?: string | null;

@@ -18,2 +18,3 @@ import diagnosticsChannel from 'node:diagnostics_channel';

import mime from 'mime-types';
import qs from 'qs';
import pump from 'pump';

@@ -70,3 +71,3 @@ // Compatible with old style formstream

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

@@ -166,3 +167,3 @@ const filePath = stream.path;

};
const orginalOpaque = args.opaque;
const originalOpaque = args.opaque;
// using opaque to diagnostics channel, binding request and socket

@@ -174,3 +175,3 @@ const internalOpaque = {

[symbols.kRequestTiming]: timing,
[symbols.kRequestOrginalOpaque]: orginalOpaque,
[symbols.kRequestOriginalOpaque]: originalOpaque,
};

@@ -382,8 +383,16 @@ const reqMeta = {

if (!isStringOrBufferOrReadable) {
for (const field in args.data) {
const fieldValue = args.data[field];
if (fieldValue === undefined)
continue;
requestUrl.searchParams.append(field, fieldValue);
if (args.nestedQuerystring) {
const querystring = qs.stringify(args.data);
// reset the requestUrl
const href = requestUrl.href;
requestUrl = new URL(href + (href.includes('?') ? '&' : '?') + querystring);
}
else {
for (const field in args.data) {
const fieldValue = args.data[field];
if (fieldValue === undefined)
continue;
requestUrl.searchParams.append(field, fieldValue);
}
}
}

@@ -407,3 +416,8 @@ }

headers['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
requestOptions.body = new URLSearchParams(args.data).toString();
if (args.nestedQuerystring) {
requestOptions.body = qs.stringify(args.data);
}
else {
requestOptions.body = new URLSearchParams(args.data).toString();
}
}

@@ -518,3 +532,3 @@ }

const clientResponse = {
opaque: orginalOpaque,
opaque: originalOpaque,
data,

@@ -574,3 +588,3 @@ status: res.status,

}
err.opaque = orginalOpaque;
err.opaque = originalOpaque;
err.status = res.status;

@@ -577,0 +591,0 @@ err.headers = res.headers;

@@ -48,2 +48,7 @@ /// <reference types="node" />

/**
* urllib default use URLSearchParams to stringify form data which don't support nested object,
* will use qs instead of URLSearchParams to support nested object by set this option to true.
*/
nestedQuerystring?: boolean;
/**
* @deprecated

@@ -50,0 +55,0 @@ * Only for d.ts keep compatible with urllib@2, don't use it anymore.

@@ -15,4 +15,4 @@ declare const _default: {

kRequestTiming: symbol;
kRequestOrginalOpaque: symbol;
kRequestOriginalOpaque: symbol;
};
export default _default;

@@ -15,3 +15,3 @@ export default {

kRequestTiming: Symbol('request timing'),
kRequestOrginalOpaque: Symbol('request orginal opaque'),
kRequestOriginalOpaque: Symbol('request original opaque'),
};

@@ -29,2 +29,3 @@ import diagnosticsChannel from 'node:diagnostics_channel';

import mime from 'mime-types';
import qs from 'qs';
import pump from 'pump';

@@ -91,3 +92,3 @@ // Compatible with old style formstream

/**
* sockePath string | null (optional) - Default: null - An IPC endpoint, either Unix domain socket or Windows named pipe
* socketPath string | null (optional) - Default: null - An IPC endpoint, either Unix domain socket or Windows named pipe
*/

@@ -249,3 +250,3 @@ socketPath?: string | null;

};
const orginalOpaque = args.opaque;
const originalOpaque = args.opaque;
// using opaque to diagnostics channel, binding request and socket

@@ -257,3 +258,3 @@ const internalOpaque = {

[symbols.kRequestTiming]: timing,
[symbols.kRequestOrginalOpaque]: orginalOpaque,
[symbols.kRequestOriginalOpaque]: originalOpaque,
};

@@ -459,6 +460,13 @@ const reqMeta = {

if (!isStringOrBufferOrReadable) {
for (const field in args.data) {
const fieldValue = args.data[field];
if (fieldValue === undefined) continue;
requestUrl.searchParams.append(field, fieldValue);
if (args.nestedQuerystring) {
const querystring = qs.stringify(args.data);
// reset the requestUrl
const href = requestUrl.href;
requestUrl = new URL(href + (href.includes('?') ? '&' : '?') + querystring);
} else {
for (const field in args.data) {
const fieldValue = args.data[field];
if (fieldValue === undefined) continue;
requestUrl.searchParams.append(field, fieldValue);
}
}

@@ -480,3 +488,7 @@ }

headers['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
requestOptions.body = new URLSearchParams(args.data).toString();
if (args.nestedQuerystring) {
requestOptions.body = qs.stringify(args.data);
} else {
requestOptions.body = new URLSearchParams(args.data).toString();
}
}

@@ -591,3 +603,3 @@ }

const clientResponse: HttpClientResponse = {
opaque: orginalOpaque,
opaque: originalOpaque,
data,

@@ -647,3 +659,3 @@ status: res.status,

}
err.opaque = orginalOpaque;
err.opaque = originalOpaque;
err.status = res.status;

@@ -650,0 +662,0 @@ err.headers = res.headers;

@@ -50,2 +50,7 @@ import { Readable, Writable } from 'node:stream';

/**
* urllib default use URLSearchParams to stringify form data which don't support nested object,
* will use qs instead of URLSearchParams to support nested object by set this option to true.
*/
nestedQuerystring?: boolean;
/**
* @deprecated

@@ -52,0 +57,0 @@ * Only for d.ts keep compatible with urllib@2, don't use it anymore.

@@ -15,3 +15,3 @@ export default {

kRequestTiming: Symbol('request timing'),
kRequestOrginalOpaque: Symbol('request orginal opaque'),
kRequestOriginalOpaque: Symbol('request original opaque'),
};