FatalSSLAlert with HTTP to HTTPS redirect

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
User avatar
sander
Release Testers
Release Testers
Posts: 8824
Joined: January 22nd, 2008, 2:22 pm

FatalSSLAlert with HTTP to HTTPS redirect

Post by sander »

Running a fresh, new, unaltered SAB 0.7.18, with both HTTP and HTTPS enabled, when I use Chromium to connect to http://localhost:9090/ it redirects to https://localhost:9090/, with the error message below on stdout.

Is this known or as-designed? Or is it a bug?

FWIW: It only seems to happen once after a fresh start of Chromium. Happens to happen with Firefox too.

Sander

Code: Select all

Exception in thread CP WSGIServer Thread-14:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/home/sander/6939/SABnzbd-0.7.18/cherrypy/wsgiserver/__init__.py", line 1295, in run
    conn.communicate()
  File "/home/sander/6939/SABnzbd-0.7.18/cherrypy/wsgiserver/__init__.py", line 1212, in communicate
    req.simple_response("408 Request Timeout")
  File "/home/sander/6939/SABnzbd-0.7.18/cherrypy/wsgiserver/__init__.py", line 612, in simple_response
    self.wfile.sendall("".join(buf))
  File "/home/sander/6939/SABnzbd-0.7.18/cherrypy/wsgiserver/__init__.py", line 1126, in sendall
    return self._safe_call(False, super(SSL_fileobject, self).sendall, *args, **kwargs)
  File "/home/sander/6939/SABnzbd-0.7.18/cherrypy/wsgiserver/__init__.py", line 1078, in _safe_call
    return call(*args, **kwargs)
  File "/home/sander/6939/SABnzbd-0.7.18/cherrypy/wsgiserver/__init__.py", line 748, in sendall
    bytes_sent = self.send(data)
  File "/home/sander/6939/SABnzbd-0.7.18/cherrypy/wsgiserver/__init__.py", line 1129, in send
    return self._safe_call(False, super(SSL_fileobject, self).send, *args, **kwargs)
  File "/home/sander/6939/SABnzbd-0.7.18/cherrypy/wsgiserver/__init__.py", line 1108, in _safe_call
    raise FatalSSLAlert(*e.args)
FatalSSLAlert: [('SSL routines', 'SSL23_WRITE', 'ssl handshake failure')]
I checked, and it also happens with SAB 0.6.8:

Code: Select all

Exception in thread CP WSGIServer Thread-28:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/home/sander/sabnzbd/SABnzbd-0.6.8/cherrypy/wsgiserver/__init__.py", line 1295, in run
    conn.communicate()
  File "/home/sander/sabnzbd/SABnzbd-0.6.8/cherrypy/wsgiserver/__init__.py", line 1212, in communicate
    req.simple_response("408 Request Timeout")
  File "/home/sander/sabnzbd/SABnzbd-0.6.8/cherrypy/wsgiserver/__init__.py", line 612, in simple_response
    self.wfile.sendall("".join(buf))
  File "/home/sander/sabnzbd/SABnzbd-0.6.8/cherrypy/wsgiserver/__init__.py", line 1126, in sendall
    return self._safe_call(False, super(SSL_fileobject, self).sendall, *args, **kwargs)
  File "/home/sander/sabnzbd/SABnzbd-0.6.8/cherrypy/wsgiserver/__init__.py", line 1078, in _safe_call
    return call(*args, **kwargs)
  File "/home/sander/sabnzbd/SABnzbd-0.6.8/cherrypy/wsgiserver/__init__.py", line 748, in sendall
    bytes_sent = self.send(data)
  File "/home/sander/sabnzbd/SABnzbd-0.6.8/cherrypy/wsgiserver/__init__.py", line 1129, in send
    return self._safe_call(False, super(SSL_fileobject, self).send, *args, **kwargs)
  File "/home/sander/sabnzbd/SABnzbd-0.6.8/cherrypy/wsgiserver/__init__.py", line 1108, in _safe_call
    raise FatalSSLAlert(*e.args)
FatalSSLAlert: [('SSL routines', 'SSL23_WRITE', 'ssl handshake failure')]
The error output occurs a bit asynchronously ... one ore two seconds after access the URLs.

Corresponding code:

Code: Select all

            except SSL.Error, e:
                if is_reader and e.args == (-1, 'Unexpected EOF'):
                    return ""

                thirdarg = None
                try:
                    thirdarg = e.args[0][0][2]
                except IndexError:
                    pass

                if thirdarg == 'http request':
                    # The client is talking HTTP to an HTTPS server.
                    raise NoSSLError()
                raise FatalSSLAlert(*e.args)
OK, the "# The client is talking HTTP to an HTTPS server." is correct, but there is a raise, but no catch somewhere else in the code? ???
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: FatalSSLAlert with HTTP to HTTPS redirect

Post by shypike »

I think this is caused by the browser.
Once you connect to, say, http://localhost:8080 you cannot just change to https://localhost:8080. Nor vice versa.
IIRC you need to clear the browser cache (and history) first.
What happens in CherryPy code might not be right either.
Post Reply