Basic SSL with Bottle

1,199 views
Skip to first unread message

Matt Murfitt

unread,
Jan 3, 2014, 12:43:07 PM1/3/14
to bott...@googlegroups.com
I like bottle because it's so lightweight, and I was looking into the easiest way to provide SSL support (without having to install other backends etc).

I've found a simple way to implement this based on the technique described here:

The idea is that you use a WSGIRefServer as before, but just wrap the socket with ssl prior to serving. I've uploaded an example to github if anyone's interested:


v+py...@g.nevcal.com

unread,
Apr 7, 2019, 1:47:13 PM4/7/19
to bottlepy
Hi Matt,

Thanks for your bottle_ssl.py.  Seems to work fine. Based on my experience with the technique you started from, Python's SimpleHTTPServer didn't have threading, and when Chrome accesses a server via SSL, it needs at least two threads (Firefox doesn't), so to get SimpleHTTPServer going, required two patches.

However, once I applied your patch to bottle, I was surprised Chrome also worked with it... until I discovered that wsgi-multithread was True, so the wsgi code must already implement multithreading, even though in the DEPLOYMENT section of the bottle docs it mentions only being a single threaded server... maybe wsgi wasn't threaded when that was written but is now? I don't know the history.

Anyway, it is working great, some 5 years after you wrote your patch.
Reply all
Reply to author
Forward
0 new messages