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

node-iframe

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-iframe - npm Package Compare versions

Comparing version 1.8.9 to 1.9.0

143

dist/fetch.js

@@ -13,25 +13,2 @@ "use strict";

};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -77,86 +54,56 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

exports.fetcher = fetcher;
var https;
var http;
if (!fetcher) {
(function () { return __awaiter(void 0, void 0, void 0, function () {
var e_1, e_2, getHttp_1, get_1;
var followRedirects, http_1, https_1, getHttp_1, get;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!process) return [3, 9];
if (!!https) return [3, 4];
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
return [4, Promise.resolve().then(function () { return __importStar(require("https")); })];
case 2:
https = _a.sent();
return [3, 4];
case 3:
e_1 = _a.sent();
console.error("https support is disabled!");
return [3, 4];
case 4:
if (!!http) return [3, 8];
_a.label = 5;
case 5:
_a.trys.push([5, 7, , 8]);
return [4, Promise.resolve().then(function () { return __importStar(require("http")); })];
case 6:
http = _a.sent();
return [3, 8];
case 7:
e_2 = _a.sent();
console.error("http support is disabled!");
return [3, 8];
case 8:
getHttp_1 = function (url) {
return url.startsWith("https://") ? https : http;
};
get_1 = function (url, options, retry) {
var _a = options !== null && options !== void 0 ? options : {}, agent = _a.agent, headers = _a.headers;
var fetchOptions = {};
if (typeof agent !== "undefined") {
if (typeof agent === "function") {
var ua = agent();
if (typeof ua !== "undefined") {
fetchOptions = { agent: ua };
}
if (process) {
followRedirects = require('follow-redirects');
followRedirects.maxRedirects = 4;
http_1 = followRedirects.http;
https_1 = followRedirects.https;
getHttp_1 = function (url) {
return url.startsWith("https://") ? https_1 : http_1;
};
get = function (url, options) {
var _a = options !== null && options !== void 0 ? options : {}, agent = _a.agent, headers = _a.headers;
var fetchOptions = {};
if (typeof agent !== "undefined") {
if (typeof agent === "function") {
var ua = agent();
if (typeof ua !== "undefined") {
fetchOptions = { agent: ua };
}
else {
fetchOptions = { agent: agent };
}
}
if (typeof headers !== "undefined") {
fetchOptions = __assign(__assign({}, fetchOptions), { headers: headers });
else {
fetchOptions = { agent: agent };
}
var httpMethod = getHttp_1(url);
return new Promise(function (resolve, reject) {
var body = "";
httpMethod
.get(url, fetchOptions, function (res) {
if ((res.statusCode === 301 || res.statusCode === 302) && retry) {
return get_1(res.headers.location, options, --retry);
}
res.setEncoding("utf8");
res.on("data", function (d) {
body += d;
});
res.on("end", function () {
resolve(body);
});
})
.on("error", function (e) {
console.error(e);
reject(e);
}
if (typeof headers !== "undefined") {
fetchOptions = __assign(__assign({}, fetchOptions), { headers: headers });
}
var httpMethod = getHttp_1(url);
return new Promise(function (resolve, reject) {
var body = "";
httpMethod
.get(url, fetchOptions, function (res) {
res.setEncoding("utf8");
res.on("data", function (d) {
body += d;
});
res.on("end", function () {
resolve(body);
});
})
.on("error", function (e) {
console.error(e);
reject(e);
});
};
exports.fetcher = fetcher = get_1;
return [3, 10];
case 9:
exports.fetcher = fetcher = global.fetch;
_a.label = 10;
case 10: return [2];
});
};
exports.fetcher = fetcher = get;
}
else {
exports.fetcher = fetcher = global.fetch;
}
return [2];
});

@@ -163,0 +110,0 @@ }); })();

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

exports.configureAgent = configureAgent;
var mutateSource = function (_a, url, $html, headers, retry) {
var mutateSource = function (_a, url, $html, headers) {
var _b = _a.src, src = _b === void 0 ? "" : _b, key = _a.key;

@@ -113,3 +113,3 @@ return __awaiter(void 0, void 0, void 0, function () {

agent: agent
}, retry)];
})];
case 2:

@@ -146,3 +146,3 @@ res = _d.sent();

function renderHtml(_a, server) {
var url = _a.url, baseHref = _a.baseHref, config = _a.config, _b = _a.head, head = _b === void 0 ? {} : _b, retry = _a.retry;
var url = _a.url, baseHref = _a.baseHref, config = _a.config, _b = _a.head, head = _b === void 0 ? {} : _b;
if (server === void 0) { server = false; }

@@ -168,3 +168,3 @@ return __awaiter(this, void 0, void 0, function () {

agent: agent
}, retry)];
})];
case 2:

@@ -221,3 +221,3 @@ response = _j.sent();

element = "".concat(key, "[").concat(attribute, "=\"").concat(src, "\"]");
return [4, mutateSource({ key: element, src: src }, url, $html, headers, retry)];
return [4, mutateSource({ key: element, src: src }, url, $html, headers)];
case 10:

@@ -224,0 +224,0 @@ _j.sent();

{
"name": "node-iframe",
"version": "1.8.9",
"version": "1.9.0",
"description": "create iframes on your server to bypass CORS. Reverse engineer security issues.",

@@ -23,3 +23,4 @@ "main": "dist/iframe.js",

"dependencies": {
"cheerio": "^1.0.0-rc.3"
"cheerio": "^1.0.0-rc.3",
"follow-redirects": "^1.15.2"
},

@@ -26,0 +27,0 @@ "devDependencies": {

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