From 4df257c3ef72719e779426f9277fd3d1a6e05b11 Mon Sep 17 00:00:00 2001 From: tombui99 Date: Wed, 24 Apr 2024 15:51:14 +1000 Subject: [PATCH 1/2] Renamed user agent and Added default maxthread to GO --- docker/sswlinkauditor.go | 2 +- docker/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/sswlinkauditor.go b/docker/sswlinkauditor.go index ae16e847..c25c6e1c 100644 --- a/docker/sswlinkauditor.go +++ b/docker/sswlinkauditor.go @@ -64,7 +64,7 @@ func getClient() *http.Client { func addClientHeaders(r *http.Request) { if r != nil { - r.Header.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36") + r.Header.Add("User-Agent", "Mozilla/5.0 (compatible; SSWCodeAuditor; +https://codeauditor.com/)") r.Header.Set("Cache-Control", "no-cache") r.Header.Set("Connection", "keep-alive") r.Header.Set("Accept-Encoding", "*") diff --git a/docker/utils.js b/docker/utils.js index 49b965b3..32e4cd04 100644 --- a/docker/utils.js +++ b/docker/utils.js @@ -267,7 +267,7 @@ exports.runBrokenLinkCheck = (url, maxthread) => { try { const comand = maxthread ? `./sswlinkauditor ${url} ${maxthread}` - : `./sswlinkauditor ${url}`; + : `./sswlinkauditor ${url} 100`; // Default maxthread to 100 (Golang default is 10000) return [execSync(comand, { maxBuffer: 20000 * 1024 }).toString(), null]; } catch (error) { return [null, error.message]; From fe1114ce9c405eafd117cefacddfa2138e5fee18 Mon Sep 17 00:00:00 2001 From: tombui99 Date: Wed, 24 Apr 2024 17:04:27 +1000 Subject: [PATCH 2/2] Added 3ms pause after each scan on a link completes --- docker/sswlinkauditor.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/sswlinkauditor.go b/docker/sswlinkauditor.go index c25c6e1c..6d7940b0 100644 --- a/docker/sswlinkauditor.go +++ b/docker/sswlinkauditor.go @@ -336,6 +336,9 @@ func main() { allUrls[status.url] = status } + // Pause for 3 milliseconds before each job completes + time.Sleep(3 * time.Millisecond) + } elapse := time.Since(start)