function checkurl(url) res = HTTP.get(url; readtimeout=2, redirect=false, status_exception=false, require_ssl_verification=false) if res.status == 200 @info "Valid URL $url" elseif HTTP.isredirect(res) @info "Invalid: Redirect at $url" else @info "Invalid: HTTP status code $(res.status) at $url" end end function rebase(url, base) m = match(r"^(?[a-zA-Z0-9]+)\:\/\/(?[^\/]+)\/(?.*)$", url) return base * m[:path] end function check(base) urls = Sitemap.read_sitemap(out_sitemap) @info "Found $(length(urls)) URLs" @info "Checking URLs …" for url in urls if length(base) > 0 @debug "Checking URL $url …" url = rebase(url, base) checkurl(url) else @debug "Checking URL $url …" checkurl(url) end end end