| 759 | } |
| 760 | |
| 761 | function matchesSoft404(response, text, fingerprint) { |
| 762 | if (!fingerprint) return false; |
| 763 | |
| 764 | // If it returned the same status as our random 404 probe |
| 765 | if (fingerprint.status === response.status && fingerprint.status !== 200) { |
| 766 | return true; |
| 767 | } |
| 768 | |
| 769 | // If content length is very similar to soft-404 (within 10%) |
| 770 | const lengthDiff = Math.abs(text.length - fingerprint.length); |
| 771 | if (lengthDiff < fingerprint.length * 0.1 && fingerprint.isSoft404) { |
| 772 | return true; |
| 773 | } |
| 774 | |
| 775 | return false; |
| 776 | } |
| 777 | |
| 778 | async function checkPathWithHead(baseUrl, path, settings) { |
| 779 | const testUrl = baseUrl + path; |