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

@comunica/actor-http-native

Package Overview
Dependencies
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comunica/actor-http-native - npm Package Compare versions

Comparing version 1.16.0 to 1.16.2

2

lib/Requester-browser.d.ts
/// <reference types="node" />
import { EventEmitter } from 'events';
import { IncomingHttpHeaders } from 'http';
export default class Requester {

@@ -7,3 +8,4 @@ private negotiatedResources;

createRequest(settings: any): EventEmitter;
convertRequestHeadersToFetchHeaders(headers: IncomingHttpHeaders): Headers;
private removeQuery;
}

30

lib/Requester-browser.js

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

if (this.negotiatedResources[this.removeQuery(settings.url)]) {
delete settings.headers['accept-datetime'];
settings.headers.delete('accept-datetime');
}

@@ -31,7 +31,7 @@ // Create the actual XMLHttpRequest

request.withCredentials = settings.withCredentials;
for (const header of reqHeaders) {
if (!(header[0] in UNSAFE_REQUEST_HEADERS) && header[1]) {
request.setRequestHeader(header[0], header[1]);
reqHeaders.forEach((value, key) => {
if (!(key in UNSAFE_REQUEST_HEADERS) && value) {
request.setRequestHeader(key, value);
}
}
});
// Create a proxy for the XMLHttpRequest

@@ -52,4 +52,4 @@ const requestProxy = new events_1.EventEmitter();

// Parse the response headers
response.headers = {};
const resHeaders = response.headers;
const resHeaders = this.convertRequestHeadersToFetchHeaders(response.headers);
response.headers = resHeaders;
const rawHeaders = request.getAllResponseHeaders() || '';

@@ -59,3 +59,3 @@ const headerMatcher = /^([^\n\r:]+):[\t ]*([^\n\r]*)$/gmu;

while (match) {
resHeaders[match[1].toLowerCase()] = match[2];
resHeaders.set(match[1].toLowerCase(), match[2]);
match = headerMatcher.exec(rawHeaders);

@@ -67,7 +67,7 @@ }

// to enable the PERFORMANCE HACK explained above
if (reqHeaders['accept-datetime'] && resHeaders['memento-datetime']) {
const resource = this.removeQuery((_a = resHeaders['content-location']) !== null && _a !== void 0 ? _a : settings.url);
if (reqHeaders.has('accept-datetime') && resHeaders.has('memento-datetime')) {
const resource = this.removeQuery((_a = resHeaders.get('content-location')) !== null && _a !== void 0 ? _a : settings.url);
if (!this.negotiatedResources[resource]) {
// Ensure the resource is not a timegate
const links = (_b = (resHeaders.link && parseLink(resHeaders.link))) !== null && _b !== void 0 ? _b : undefined;
const links = (_b = (resHeaders.get('link') && parseLink(resHeaders.get('link')))) !== null && _b !== void 0 ? _b : undefined;
const timegate = this.removeQuery(links && links.timegate && links.timegate.url);

@@ -91,2 +91,10 @@ if (resource !== timegate) {

}
// Wrap headers into an header object type
convertRequestHeadersToFetchHeaders(headers) {
const responseHeaders = new Headers();
for (const key in headers) {
responseHeaders.append(key, headers[key]);
}
return responseHeaders;
}
// Removes the query string from a URL

@@ -93,0 +101,0 @@ removeQuery(url) {

{
"name": "@comunica/actor-http-native",
"version": "1.16.0",
"version": "1.16.2",
"description": "A native http actor",

@@ -77,3 +77,3 @@ "lsd:module": "https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-http-native",

},
"gitHead": "ed0260a5d71d61a1a77916454fb83039a4ab47b6"
"gitHead": "e6bc00085042ab6a1bc47bddeefdc056acc6d6ba"
}
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