Commit 8fd39482 authored by augustin_s's avatar augustin_s 🐍
Browse files

replace string split with shlex; show dir listing for /; naming

parent 7cd9383e
......@@ -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"):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment