replace string split with shlex; show dir listing for /; naming
This commit is contained in:
10
pier.py
10
pier.py
@ -26,17 +26,23 @@ from io import StringIO
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shlex
|
||||
import http.server
|
||||
import socketserver
|
||||
|
||||
|
||||
HTML_SPACE = "%20"
|
||||
URL_SPACE = "%20"
|
||||
|
||||
|
||||
class ScriptServer(http.server.SimpleHTTPRequestHandler):
|
||||
|
||||
def do_GET(self):
|
||||
args = self.path.lstrip("/").split(HTML_SPACE)
|
||||
args = self.path.lstrip("/").replace(URL_SPACE, " ")
|
||||
args = shlex.split(args)
|
||||
|
||||
if not args:
|
||||
super().do_GET()
|
||||
|
||||
scr = args[0]
|
||||
|
||||
if not scr.endswith(".py"):
|
||||
|
Reference in New Issue
Block a user