kpcyrd/sn0int

Option to follow redirects

Opened this issue · 2 comments

There should be a way to automatically resolve redirects, like

req = http_request(session, 'GET', 'https://example.com', {
    follow_redirects=true,
})

I was about to open an issue re redirects, an example here is after running url-scan 30x's has identified an https:// URL (sandbox.), which has not been added to the urls table.

[sn0int][test][kpcyrd/url-scan] > select urls
#1, "http://example.com/" (301 => "https://example.com")
#2, "https://example.com/" (200)
#3, "http://www.example.com/" (301 => "http://example.com/")
#4, "https://www.example.com/" (301 => "https://example.com/")
#5, "http://sandbox.example.com/" (301 => "https://sandbox.example.com/")

hmm, url-scan is supposed to find the https:// variant (not by following redirects, but because it's supposed to try both http:// and https://. I'm suspecting either the certificate was invalid (which can't be disabled yet, unfortunately) or the tls library used didn't like the configuration of the server (which is a more elaborate issue to tackle). You can try to get a more specific error like this:

% sn0int repl
:: sn0int v0.18.2 lua repl
Assign variables with `a = sn0int_version()` and `return a` to print
Read the docs at https://sn0int.readthedocs.io/en/stable/reference.html

> session = http_mksession()
> r = http_request(session, 'GET', 'https://example.com', {})
> r = http_send(r)
> return r['status']
200.0
>