koenbuyens / securityheaders

Check any website (or set of websites) for insecure security headers.
Apache License 2.0
244 stars 50 forks source link

[BUG] follow_redirects doesn't work with Python 3 #9

Open qfayet opened 3 years ago

qfayet commented 3 years ago

For example, results are not the same for http://google.com/ between version 2 and 3 of Python.

python securityheaders.py http://google.com/

Because with Python 3, the code doesn't follow redirections.

The error is located line 233 of securityheaders/securityheader.py.

The line:

                    if (header[0] == 'location'):

must be changed in:

                    if (header[0].lower() == 'location'):

Because, in version 3 of Python, header are not in lower case.

Pull request: https://github.com/koenbuyens/securityheaders/pull/10.