Update urlanalyzer.ex

This commit is contained in:
Mikko Ahlroth 2021-11-23 18:41:15 +00:00
parent b548fdd1bb
commit 8e500164db

View file

@ -184,7 +184,7 @@ defmodule Nulform.Plugins.URLAnalyzer do
if status == 301 or status == 302 or status == 303 or status == 307 do
new_url = to_string headers['location']
# Fix non-absolute location URIs by retard webdevs
# Fix non-absolute location URIs
if not String.starts_with? String.downcase(new_url), ["http://", "https://"] do
IO.puts "Fixing " <> new_url <> " to..."
new_url = URI.parse(url).scheme <> "://" <> domain <> "/" <> String.lstrip new_url, "/"
@ -195,7 +195,7 @@ defmodule Nulform.Plugins.URLAnalyzer do
if mode != :get and (status != 200 or Enum.any? @parseable_types, fn(x) -> x == content_type end) do
analyze_url url, redirects + 1, :get
else
# Maybe gunzip body since retard server send gzip for us
# Maybe gunzip body since server send gzip for us
body = maybe_gunzip headers, body
IO.inspect mode