Browse Source

【修复】Lynx 兼容问题

PJ-568 2 years ago
parent
commit
30de7f6b61
1 changed files with 5 additions and 1 deletions
  1. 5 1
      server/server.py

+ 5 - 1
server/server.py

@@ -41,7 +41,11 @@ class ChatServer(http.server.BaseHTTPRequestHandler):
 
     def do_GET(self):
         try:
-            if self.path == '/' or self.path == '/index.html' or self.path.startswith('/?') or self.path.startswith('/index.html?'):
+            if self.path.startswith('/./'):
+                self.send_response(301)
+                self.send_header('Location', self.path[2:])
+                self.end_headers()
+            elif self.path == '/' or self.path == '/index.html' or self.path.startswith('/?') or self.path.startswith('/index.html?'):
                 query_string = urlparse(self.path).query
                 query_params = parse_qs(query_string)
                 nickname = query_params.get('nickname', [''])[0]