Use entire, unprocessed (apart from stripping leading slashes) request path

main
Luca 3 years ago
parent 3464c58288
commit b9dbf443e5

@ -17,14 +17,13 @@
from http.server import BaseHTTPRequestHandler, HTTPServer
from icalendar import Calendar
from schichtleiter.schedule import calendar_to_xml
from urllib.parse import unquote, urlparse
import requests
import sys
def run_server(address, port, urls):
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
url = unquote(urlparse(self.path).path.lstrip('/'))
url = self.path.lstrip('/')
if url not in urls:
self.send_error(404)
return

Loading…
Cancel
Save