After configuring HTTPS, rocket.py crashes when I try to access using HTTP

22 views
Skip to first unread message

João Matos

unread,
Mar 24, 2019, 8:24:54 PM3/24/19
to web2py-users
Hello,

I created the .crt and .key files using this command on a linux machine
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout certificate.key -out certificate.crt
from Niphlod in

Copied both files to c:\web2py.

Uncommented
request.requires_https()

and added secure=True to
auth = Auth(db, host_names=configuration.get('host.names'), secure=True)

in db.py.

Uncommented these 2 lines
ssl_certificate = 'certificate.crt'
ssl_private_key
= 'certificate.key'

in my options.py.

I added this self-signed certificate to the Trusted CAs of Windows and checked that it also appears in the Firefox's Trusted CAs in the certificates store.

When I try to access https://my_hostname:8000 eveything works.
When I try to access http://my_hostname:8000 rocket crashes with this error:

Exception in thread Thread-2:
Traceback (most recent call last):
 
File "C:\Users\JMatos\OneDrive\Python\winpython371-32\python-3.7.1\lib\threadi
ng.py"
, line 917, in _bootstrap_inner
   
self.run()
 
File "C:\web2py\gluon\rocket.py", line 1268, in run
    conn
= Connection(*conn)
 
File "C:\web2py\gluon\rocket.py", line 105, in __init__
   
self.socket.settimeout(SOCKET_TIMEOUT)
OSError: [WinError 10038] Foi tentada uma operação em algum item que não é um so
cket

The translation of the WinError is "It was attempted an operation on some item which is not a socket".

I tried with and without secure=True in Auth.
And I tried with and without
request.requires_https()

Every time HTTPS works and HTTP crashes rocket.py.

I'm using:
web2py 2.18.4
Python 3.7.1 x86
Windows 7 Pro x64 SP1+all updates
Firefox 66.0.1 x64

Any ideas?

Thanks,

JM
Reply all
Reply to author
Forward
0 new messages