Skip to content

Commit 26ff5ca

Browse files
committedSep 23, 2021
fix: Fix bugs(upstream)
1 parent 08244d0 commit 26ff5ca

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed
 

‎src/endpoint.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def _context(handler):
7474
if "___" in os.path.normpath(file).split(os.path.sep):
7575
raise IsADirectoryError("Path-argument like directory found.")
7676
ep_dir = os.path.dirname(file)
77-
if file.endswith("___.py") and\
78-
len([name for name in os.listdir(ep_dir) if os.path.isfile(ep_dir + "/" + name)]) >= 2:
77+
if file.endswith("___.py") and \
78+
len([name for name in os.listdir(ep_dir) if os.path.isfile(ep_dir + "/" + name)]) >= 2:
7979
raise FileExistsError("Endpoint conflict")
8080

8181
for base in loader.known_source:
@@ -211,6 +211,8 @@ def validate(self, param_dict: dict) -> int:
211211
if self.ignore_check_expect100:
212212
return 0
213213
return -1
214+
else:
215+
return 0
214216

215217
value = param_dict[name]
216218

@@ -304,6 +306,7 @@ def validate_arg(self, handler, params: dict, queries: dict, path_param: dict) -
304306

305307
if code == -1:
306308
missing.append(arg.name)
309+
continue
307310
elif code == 1:
308311
if "bool" in arg.type:
309312
quick_invalid(handler, arg.name, "[" + ", ".join(("true", "false") + arg.must_be) + "]")

‎src/server/handler.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def __init__(self, request, client_address, server):
2323
self.instance = server.instance
2424
self.config = self.instance.config
2525
self.request = None
26+
self.verbose = self.instance.verbose
2627
super().__init__(request, client_address, server)
2728

2829
def handle_request(self):
@@ -190,8 +191,7 @@ def handle_switch(self):
190191

191192
self.call_handler(path.path, args, queries)
192193
else:
193-
route.post_error(self, route.Cause.MISSING_FIELD, "Content-Type header is required.")
194-
return
194+
self.call_handler(path.path, {}, queries)
195195
except Exception:
196196
self.logger.warn(get_log_name(), get_stack_trace("server", *sys.exc_info()))
197197

‎src/server/handler_base.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from socket import socket
22
from typing import Optional, BinaryIO
33
from socketserver import StreamRequestHandler
4-
from sys import exc_info
5-
6-
from utils import stacktrace
4+
from utils.stacktrace import get_stack_trace
5+
from utils.logging import get_log_name
76
from utils.header_parse import HeaderSet
7+
import sys
8+
89

910
responses = {
1011
100: "Continue",
@@ -248,7 +249,7 @@ def _read_line(self) -> Optional[bytes]:
248249
except Exception as e:
249250
if type(e) is ParseException:
250251
raise e
251-
stacktrace.get_stack_trace("server", *exc_info())
252+
print(get_log_name(), get_stack_trace("server", *sys.exc_info()))
252253
return
253254

254255
def parse(self) -> Optional[HTTPRequest]:

0 commit comments

Comments
 (0)
Please sign in to comment.