The simplest code fragment I found was this:
- Code: Select all
import BaseHTTPServer, SimpleHTTPServer
httpd = BaseHTTPServer.HTTPServer(('', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket, certfile='path/to/server.pem', server_side=True)
where server.pem is a pem file we've been using with another web server we're running. The Python code launches and runs without apparent errors but when I try to connect to the server using https://<server-ip>:4443 the browser prints the message "This webpage is not available." The Python code does not report any errors, and I can't even tell if the connection made it all the way through. I've tried various other versions of this code that I've come across but none of them work.
I have a Jersey-based web server running on another system that uses this same pem file and that works fine, but we want a small and light web server on this particular system, not a full blown web server like Jersey. As a test though I did setup Jersey on this system and it runs as expected, so I assume there is something wrong with my Python code. Can anyone explain what the problem might be?