Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
python https server
SUBMITTED BY:
Guest
DATE:
Dec. 12, 2013, 8:21 a.m.
FORMAT:
Python
SIZE:
532 Bytes
Raw
Download
Tweet
HITS:
1064
Go to comments
Report
import
SimpleHTTPServer
import
BaseHTTPServer
import
ssl
class
MyRequestHandler
(
SimpleHTTPServer
.
SimpleHTTPRequestHandler
):
def
do_GET
(
self
):
if
self
.
path
==
'/'
:
self
.
path
=
'test.html'
return
SimpleHTTPServer
.
SimpleHTTPRequestHandler
.
do_GET
(
self
)
Handler
=
MyRequestHandler
server
=
BaseHTTPServer
.
HTTPServer
((
'localhost'
,
8080
),
Handler
)
server
.
socket
=
ssl
.
wrap_socket
(
server
.
socket
,
certfile
=
'server.pem'
,
server_side
=
True
)
server
.
serve_forever
()
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus