Skip to content

Commit 732b4c0

Browse files
committed
Remove www canonicalization check
1 parent c89eb33 commit 732b4c0

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

plain-scan/plain/scan/audits/redirects.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def check(self, scanner: Scanner) -> AuditResult:
2828
# No redirects - but we still run checks on the final URL
2929
checks = [
3030
self._check_final_url_https(scanner.url, response.url),
31-
self._check_www_canonicalization(scanner.url, response.url),
3231
self._check_trailing_slash_redirect(scanner.url, response),
3332
]
3433

@@ -47,7 +46,6 @@ def check(self, scanner: Scanner) -> AuditResult:
4746
self._check_final_url_https(scanner.url, response.url),
4847
self._check_cross_origin_redirects(scanner.url, response),
4948
self._check_status_codes(response),
50-
self._check_www_canonicalization(scanner.url, response.url),
5149
self._check_trailing_slash_redirect(scanner.url, response),
5250
]
5351

@@ -213,39 +211,6 @@ def _check_status_codes(self, response: requests.Response) -> CheckResult:
213211
message=f"All {len(response.history)} redirect(s) use valid status codes",
214212
)
215213

216-
def _check_www_canonicalization(
217-
self, original_url: str, final_url: str
218-
) -> CheckResult:
219-
"""Check for www vs non-www canonicalization."""
220-
original_parsed = urlparse(original_url)
221-
final_parsed = urlparse(final_url)
222-
223-
# If domains differ, check if it's just www prefix
224-
if original_parsed.netloc != final_parsed.netloc:
225-
# Remove www. prefix from both for comparison
226-
orig_without_www = original_parsed.netloc.removeprefix("www.")
227-
final_without_www = final_parsed.netloc.removeprefix("www.")
228-
229-
if orig_without_www == final_without_www:
230-
# It's a www canonicalization redirect
231-
if original_parsed.netloc.startswith("www."):
232-
direction = "www to non-www"
233-
else:
234-
direction = "non-www to www"
235-
236-
return CheckResult(
237-
name="www-canonicalization",
238-
passed=True,
239-
message=f"WWW canonicalization in place ({direction})",
240-
)
241-
242-
# Either no redirect or redirect for other reasons
243-
return CheckResult(
244-
name="www-canonicalization",
245-
passed=True,
246-
message="No WWW canonicalization redirect detected",
247-
)
248-
249214
def _check_trailing_slash_redirect(
250215
self, original_url: str, response: requests.Response
251216
) -> CheckResult:

0 commit comments

Comments
 (0)