Skip to content

Commit

Permalink
Add insecure parameter passed to constructor
Browse files Browse the repository at this point in the history
Support request to sites with invalid certificates (development)
  • Loading branch information
kirdia authored and seantomburke committed Dec 23, 2021
1 parent 7577349 commit 1228187
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ You can add options on the initial Sitemapper object when instantiating it.
+ `debug`: (Boolean) - Enables/Disables debug console logging. Default: False
+ `concurrency`: (Number) - Sets the maximum number of concurrent sitemap crawling threads. Default: 10
+ `retries`: (Number) - Sets the maximum number of retries to attempt in case of an error response (e.g. 404 or Timeout). Default: 0
+ `requestHeaders`: (Object) - Additional Request Headers
+ `insecure`: (Boolean) - Ignore invalid certificates

```javascript

const sitemapper = new Sitemapper({
url: 'https://art-works.community/sitemap.xml',
insecure: true,
timeout: 15000,
requestHeaders: {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0'
Expand Down
2 changes: 1 addition & 1 deletion lib/assets/sitemapper.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/assets/sitemapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default class Sitemapper {
this.debug = settings.debug;
this.concurrency = settings.concurrency || 10;
this.retries = settings.retries || 0;
this.insecure = settings.insecure || false;
}

/**
Expand Down Expand Up @@ -149,6 +150,9 @@ export default class Sitemapper {
gzip: true,
responseType: 'buffer',
headers: this.requestHeaders,
https: {
rejectUnauthorized: Boolean(this.insecure)
}
};

try {
Expand Down

0 comments on commit 1228187

Please sign in to comment.