We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
0 parents commit ace61caCopy full SHA for ace61ca
.DS_Store
8 KB
HTTPS_Server.py
@@ -0,0 +1,29 @@
1
+import BaseHTTPServer,SimpleHTTPServer,SocketServer
2
+import logging
3
+import cgi
4
+import sys
5
+import socket
6
+import ssl
7
+
8
+PORT = int(sys.argv[1])
9
10
+def staticHttpServer(req):
11
+ logging.warning(req.headers)
12
+ SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(req)
13
14
+class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
15
16
+ def do_GET(self):
17
+ "do something for GET"
18
+ staticHttpServer(self)
19
+ def do_POST(self):
20
+ "do something for POST"
21
22
23
+Handler = ServerHandler
24
25
+httpd = BaseHTTPServer.HTTPServer(("", PORT),Handler)
26
+httpd.socket = ssl.wrap_socket (httpd.socket, certfile='./cert.pem', server_side=True)
27
+ip = socket.gethostbyname(socket.gethostname())
28
+print "Serving at: https://%(interface)s:%(port)s" % dict(interface=ip or "localhost", port=PORT)
29
+httpd.serve_forever()
HTTP_Server.py
@@ -0,0 +1,28 @@
+import SimpleHTTPServer
+import SocketServer
+httpd = SocketServer.TCPServer(("", PORT), Handler)
+print "Serving at: http://%(interface)s:%(port)s" % dict(interface=ip or "localhost", port=PORT)
build.sh
@@ -0,0 +1 @@
+openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout cert.pem -out cert.pem
clean.sh
+rm *.pem *.out
startHttpServer.sh
@@ -0,0 +1,2 @@
+pushd ./resource
+nohup python ../HTTP_Server.py 8001 &> ../nohup.out &
startHttpsServer.sh
+nohup python HTTPS_Server.py 8002 &
stopHttpServer.sh
+kill $(ps aux | grep '[H]TTP_Server' | awk '{print 2ドル}')
stopHttpsServer.sh
+kill $(ps aux | grep '[H]TTPS_Server' | awk '{print 2ドル}')
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments