Socket
Socket
Sign inDemoInstall

pagexray

Package Overview
Dependencies
1
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.1 to 4.0.0

5

CHANGELOG.md
# CHANGELOG - PageXray
version 4.0.0 2020-12-12
------------------------
### Changed
* The new header structure actually sucked. Instead follow other tools and flatten headers returning an array [#98](https://github.com/sitespeedio/pagexray/pull/98).
version 3.1.1 2020-12-11

@@ -4,0 +9,0 @@ ------------------------

13

lib/collect.js

@@ -47,3 +47,2 @@ 'use strict';

const contentType = util.getContentType(response.content.mimeType);
const responseHeadersFlatten = headers.flatten(response.headers);
const content =

@@ -68,2 +67,4 @@ response.content && response.content.text ? response.content.text : '';

const responseHeaders = headers.flatten(response.headers);
const requestHeaders = headers.flatten(request.headers);
return {

@@ -76,7 +77,5 @@ type: contentType,

headerSize: response.headersSize,
expires: headers.getExpires(responseHeadersFlatten),
expires: headers.getExpires(responseHeaders),
status: response.status,
timeSinceLastModified: headers.getTimeSinceLastModified(
responseHeadersFlatten
),
timeSinceLastModified: headers.getTimeSinceLastModified(responseHeaders),
cookieNames: headers.getCookieNames(response.headers),

@@ -89,4 +88,4 @@ cookieNamesThirdParties: headers.getThirdPartyCookieNames(

headers: {
request: request.headers,
response: response.headers
request: requestHeaders,
response: responseHeaders
},

@@ -93,0 +92,0 @@ totalTime,

@@ -29,3 +29,7 @@ 'use strict';

const theHeaders = headers.reduce((result, header) => {
result[header.name.toLowerCase()] = header.value;
if (!result[header.name.toLowerCase()]) {
result[header.name.toLowerCase()] = [header.value];
} else {
result[header.name.toLowerCase()].push(header.value);
}
return result;

@@ -49,8 +53,8 @@ }, {});

if (
responseHeaders['cache-control'].indexOf('no-cache') !== -1 ||
responseHeaders['cache-control'].indexOf('no-store') !== -1
responseHeaders['cache-control'][0].indexOf('no-cache') !== -1 ||
responseHeaders['cache-control'][0].indexOf('no-store') !== -1
) {
return 0;
}
const matches = responseHeaders['cache-control'].match(maxAgeRegExp);
const matches = responseHeaders['cache-control'][0].match(maxAgeRegExp);
if (matches) {

@@ -60,3 +64,3 @@ return parseInt(matches[1], 10);

} else if (responseHeaders.expires) {
const expiresMillis = parseHttpDate(responseHeaders.expires);
const expiresMillis = parseHttpDate(responseHeaders.expires[0]);

@@ -75,13 +79,21 @@ if (isFinite(expiresMillis))

getTimeSinceLastModified: headers => {
const lastModifiedMillis = parseHttpDate(headers['last-modified']);
if (headers['last-modified']) {
const lastModifiedMillis = parseHttpDate(headers['last-modified'][0]);
if (!isFinite(lastModifiedMillis)) {
if (!isFinite(lastModifiedMillis)) {
return -1;
}
if (headers.date) {
let dateMillis = parseHttpDate(headers.date[0]);
if (!isFinite(dateMillis)) {
dateMillis = Date.now();
}
return (dateMillis - lastModifiedMillis) / 1000;
} else {
return (Date.now() - lastModifiedMillis) / 1000;
}
} else {
return -1;
}
let dateMillis = parseHttpDate(headers.date);
if (!isFinite(dateMillis)) {
dateMillis = Date.now();
}
return (dateMillis - lastModifiedMillis) / 1000;
},

@@ -88,0 +100,0 @@ getCookieNames: headers => {

{
"name": "pagexray",
"version": "3.1.1",
"version": "4.0.0",
"description": "Xray your HAR file and know all about the page",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc