Socket
Socket
Sign inDemoInstall

link-check

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

link-check - npm Package Compare versions

Comparing version 5.2.0 to 5.3.0

.github/dependabot.yml

15

CHANGELOG.md
# Changes
## Version 5.3.0
* fix failing github action with IPv6 @dklimpel
* Add http proxy support @dklimpel
* docs: Format with Markdownlint @nschonni
* upgrade dependencies
## Version 5.2.0

@@ -39,6 +46,6 @@

- bad/expired/unauthorized HTTPS certificate errors are no longer ignored.
- sites with bad certs are no longer considered `alive`
- `User-Agent` header no longer impersonates Firefox.
- defaults to `link-check/5.0.0` (override via `opts.user_agent`).
* bad/expired/unauthorized HTTPS certificate errors are no longer ignored.
* sites with bad certs are no longer considered `alive`
* `User-Agent` header no longer impersonates Firefox.
* defaults to `link-check/5.0.0` (override via `opts.user_agent`).

@@ -45,0 +52,0 @@ Changes:

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

const pkg = require('../../package.json');
var { ProxyAgent } = require('proxy-agent');

@@ -14,5 +15,3 @@ module.exports = {

if (attempts == null) {
attempts = 0;
}
attempts = attempts ?? 0;

@@ -45,2 +44,4 @@ // default request timeout set to 10s if not provided in options

const options = {
agent: new ProxyAgent(),
use_proxy_from_env_var: false,
user_agent: user_agent,

@@ -62,3 +63,3 @@ follow_max: 8,

if (additionalMessage){
err = (err == null) ? additionalMessage : `${err} ${additionalMessage}`;
err = !err ? additionalMessage : `${err} ${additionalMessage}`;
}

@@ -88,5 +89,5 @@ callback(null, new LinkCheckResult(opts, link, res ? res.statusCode : 0, err)); // alive, returned 200 OK

additionalMessage =
"Server returned a non standard \'retry-after\' header. "
+ "Non standard \'retry-after\' header will not work after link-check 4.7.0 release. "
+ "See https://github.com/tcort/link-check/releases/tag/v4.5.2 release note for details.";
"Server returned a non standard \'retry-after\' header. " +
"Non standard \'retry-after\' header will not work after link-check 4.7.0 release. " +
"See https://github.com/tcort/link-check/releases/tag/v4.5.2 release note for details.";

@@ -120,3 +121,3 @@ let buf = '';

if (additionalMessage){
err = (err == null) ? additionalMessage : `${err} ${additionalMessage}`;
err = !err ? additionalMessage : `${err} ${additionalMessage}`;
}

@@ -123,0 +124,0 @@ callback(null, new LinkCheckResult(opts, link, res ? res.statusCode : 0, err));

@@ -1,2 +0,2 @@

Copyright (c) 2016-2021 Thomas Cort <linuxgeek@gmail.com>
Copyright (c) 2016-2024 Thomas Cort <linuxgeek@gmail.com>

@@ -3,0 +3,0 @@ Permission to use, copy, modify, and distribute this software for any

{
"name": "link-check",
"version": "5.2.0",
"version": "5.3.0",
"description": "checks whether a hyperlink is alive (200 OK) or dead",
"main": "index.js",
"scripts": {
"pretest": "jshint index.js",
"pretest": "jshint index.js lib test",
"test": "mocha -R spec --exit"

@@ -34,12 +34,14 @@ },

"ms": "^2.1.3",
"needle": "^3.1.0"
"needle": "^3.3.1",
"proxy-agent": "^6.4.0"
},
"devDependencies": {
"debug": "^4.3.4",
"expect.js": "^0.3.1",
"express": "^4.18.1",
"jshint": "^2.13.5",
"mocha": "^10.0.0",
"debug": "^4.3.4"
"express": "^4.18.3",
"jshint": "^2.13.6",
"mocha": "^10.3.0"
},
"jshintConfig": {
"esversion": 11,
"bitwise": true,

@@ -46,0 +48,0 @@ "curly": true,

@@ -9,3 +9,5 @@ ![Test library workflow status](https://github.com/tcort/link-check/workflows/Test%20library/badge.svg)

npm install --save link-check
```console
npm install --save link-check
```

@@ -30,20 +32,20 @@ ## Specification

* `url` string containing a URL.
* `opts` optional options object containing any of the following optional fields:
* `anchors` array of anchor strings (e.g. `[ "#foo", "#bar" ]`) for checking anchor links (e.g. `<a href="#foo">Foo</a>`).
* `baseUrl` the base URL for relative links.
* `timeout` timeout in [zeit/ms](https://www.npmjs.com/package/ms) format. (e.g. `"2000ms"`, `20s`, `1m`). Default `10s`.
* `user_agent` the user-agent string. Default `${name}/${version}` (e.g. `link-check/4.5.5`)
* `aliveStatusCodes` an array of numeric HTTP Response codes which indicate that the link is alive. Entries in this array may also be regular expressions. Example: `[ 200, /^[45][0-9]{2}$/ ]`. Default `[ 200 ]`.
* `headers` a string based attribute value object to send custom HTTP headers. Example: `{ 'Authorization' : 'Basic Zm9vOmJhcg==' }`.
* `retryOn429` a boolean indicating whether to retry on a 429 (Too Many Requests) response. When true, if the response has a 429 HTTP code and includes an optional `retry-after` header, a retry will be attempted after the delay indicated in the `retry-after` header. If no `retry-after` header is present in the response or the `retry-after` header value is not valid according to [RFC7231](https://tools.ietf.org/html/rfc7231#section-7.1.3) (value must be in seconds), a default retry delay of 60 seconds will apply. This default can be overriden by the `fallbackRetryDelay` parameter.
* `retryCount` the number of retries to be made on a 429 response. Default `2`.
* `fallbackRetryDelay` the delay in [zeit/ms](https://www.npmjs.com/package/ms) format. (e.g. `"2000ms"`, `20s`, `1m`) for retries on a 429 response when no `retry-after` header is returned or when it has an invalid value. Default is `60s`.
* `callback` function which accepts `(err, result)`.
* `err` an Error object when the operation cannot be completed, otherwise `null`.
* `result` an object with the following properties:
* `link` the `link` provided as input
* `status` a string set to either `alive` or `dead`.
* `statusCode` the HTTP status code. Set to `0` if no HTTP status code was returned (e.g. when the server is down).
* `err` any connection error that occurred, otherwise `null`.
* `url` string containing a URL.
* `opts` optional options object containing any of the following optional fields:
* `anchors` array of anchor strings (e.g. `[ "#foo", "#bar" ]`) for checking anchor links (e.g. `<a href="#foo">Foo</a>`).
* `baseUrl` the base URL for relative links.
* `timeout` timeout in [zeit/ms](https://www.npmjs.com/package/ms) format. (e.g. `"2000ms"`, `20s`, `1m`). Default `10s`.
* `user_agent` the user-agent string. Default `${name}/${version}` (e.g. `link-check/4.5.5`)
* `aliveStatusCodes` an array of numeric HTTP Response codes which indicate that the link is alive. Entries in this array may also be regular expressions. Example: `[ 200, /^[45][0-9]{2}$/ ]`. Default `[ 200 ]`.
* `headers` a string based attribute value object to send custom HTTP headers. Example: `{ 'Authorization' : 'Basic Zm9vOmJhcg==' }`.
* `retryOn429` a boolean indicating whether to retry on a 429 (Too Many Requests) response. When true, if the response has a 429 HTTP code and includes an optional `retry-after` header, a retry will be attempted after the delay indicated in the `retry-after` header. If no `retry-after` header is present in the response or the `retry-after` header value is not valid according to [RFC7231](https://tools.ietf.org/html/rfc7231#section-7.1.3) (value must be in seconds), a default retry delay of 60 seconds will apply. This default can be overriden by the `fallbackRetryDelay` parameter.
* `retryCount` the number of retries to be made on a 429 response. Default `2`.
* `fallbackRetryDelay` the delay in [zeit/ms](https://www.npmjs.com/package/ms) format. (e.g. `"2000ms"`, `20s`, `1m`) for retries on a 429 response when no `retry-after` header is returned or when it has an invalid value. Default is `60s`.
* `callback` function which accepts `(err, result)`.
* `err` an Error object when the operation cannot be completed, otherwise `null`.
* `result` an object with the following properties:
* `link` the `link` provided as input
* `status` a string set to either `alive` or `dead`.
* `statusCode` the HTTP status code. Set to `0` if no HTTP status code was returned (e.g. when the server is down).
* `err` any connection error that occurred, otherwise `null`.

@@ -84,3 +86,5 @@ ## Examples

npm test
```console
npm test
```

@@ -87,0 +91,0 @@ ## License

@@ -46,3 +46,3 @@ 'use strict';

if (req.headers["authorization"] === "Basic Zm9vOmJhcg==") {
if (req.headers.authorization === "Basic Zm9vOmJhcg==") {
return res.sendStatus(200);

@@ -138,3 +138,9 @@ }

}
baseUrl = 'http://' + server.address().address + ':' + server.address().port;
// github action uses IPv6 addresses
// there seems missing IPv6 support in upstream libs
if (server.address().address === "::1") {
baseUrl = 'http://localhost:' + server.address().port;
} else {
baseUrl = 'http://' + server.address().address + ':' + server.address().port;
}
done();

@@ -300,3 +306,3 @@ });

expect(result.status).to.be('alive');
done()
done();
});

@@ -311,3 +317,3 @@ });

expect(result.status).to.be('alive');
done()
done();
});

@@ -322,3 +328,3 @@ });

expect(result.status).to.be('alive');
done()
done();
});

@@ -333,3 +339,3 @@ });

expect(result.status).to.be('alive');
done()
done();
});

@@ -344,3 +350,3 @@ });

expect(result.status).to.be('alive');
done()
done();
});

@@ -355,3 +361,3 @@ });

expect(result.status).to.be('dead');
done()
done();
});

@@ -368,3 +374,3 @@ });

expect(result.err).to.be(null);
done()
done();
});

@@ -378,3 +384,3 @@ });

expect(result.link).to.be('#foobar');
done()
done();
});

@@ -446,3 +452,3 @@ });

expect(err).to.be(null);
expect(result.err).not.to.be(null)
expect(result.err).not.to.be(null);
expect(result.err).to.contain("Server returned a non standard \'retry-after\' header.");

@@ -449,0 +455,0 @@ expect(result.link).to.be(baseUrl + '/later-non-standard-header');

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