Skip to main content

is_executable_url

Function is_executable_url 

Source
pub fn is_executable_url(url: &str) -> bool
Expand description

Whether url would execute if a browser followed it.

★ IT NORMALISES THE WAY A BROWSER DOES, WHICH IS THE WHOLE DIFFICULTY. A browser strips leading whitespace and control characters before reading the scheme, and compares it case-insensitively — so JaVaScRiPt:, a leading space, and a tab or newline spliced INSIDE the word all reach the same place as the plain spelling. A check that compared the raw text would pass every one of them while looking correct, which is worse than no check at all.