MyFSIO v0.4.0 Release #33
@@ -47,7 +47,6 @@ _request_counter = itertools.count(1)
|
|||||||
|
|
||||||
|
|
||||||
class _ChunkedTransferMiddleware:
|
class _ChunkedTransferMiddleware:
|
||||||
_logger = logging.getLogger("chunked_middleware")
|
|
||||||
|
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
self.app = app
|
self.app = app
|
||||||
@@ -72,6 +71,13 @@ class _ChunkedTransferMiddleware:
|
|||||||
if not is_streaming:
|
if not is_streaming:
|
||||||
return self.app(environ, start_response)
|
return self.app(environ, start_response)
|
||||||
|
|
||||||
|
raw = environ.get("wsgi.input")
|
||||||
|
if raw and hasattr(raw, "seek"):
|
||||||
|
try:
|
||||||
|
raw.seek(0)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
cl_int = 0
|
cl_int = 0
|
||||||
try:
|
try:
|
||||||
cl_int = int(content_length) if content_length else 0
|
cl_int = int(content_length) if content_length else 0
|
||||||
@@ -80,8 +86,7 @@ class _ChunkedTransferMiddleware:
|
|||||||
|
|
||||||
if cl_int <= 0:
|
if cl_int <= 0:
|
||||||
try:
|
try:
|
||||||
raw = environ["wsgi.input"]
|
body = raw.read() if raw else b""
|
||||||
body = raw.read()
|
|
||||||
except Exception:
|
except Exception:
|
||||||
body = b""
|
body = b""
|
||||||
if body:
|
if body:
|
||||||
|
|||||||
@@ -1006,6 +1006,32 @@ def debug_upload():
|
|||||||
"request.content_length": request.content_length,
|
"request.content_length": request.content_length,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
raw = env.get("wsgi.input")
|
||||||
|
if raw:
|
||||||
|
try:
|
||||||
|
info["wsgi_input_pos"] = raw.tell() if hasattr(raw, "tell") else "N/A"
|
||||||
|
except Exception:
|
||||||
|
info["wsgi_input_pos"] = "error"
|
||||||
|
if hasattr(raw, "getvalue"):
|
||||||
|
try:
|
||||||
|
full = raw.getvalue()
|
||||||
|
info["wsgi_input_getvalue_len"] = len(full)
|
||||||
|
if full:
|
||||||
|
info["wsgi_input_getvalue_hex"] = full[:200].hex()
|
||||||
|
except Exception as e:
|
||||||
|
info["wsgi_input_getvalue_error"] = str(e)
|
||||||
|
try:
|
||||||
|
if hasattr(raw, "seek"):
|
||||||
|
raw.seek(0)
|
||||||
|
seek_body = raw.read()
|
||||||
|
info["wsgi_input_after_seek0_len"] = len(seek_body)
|
||||||
|
if seek_body:
|
||||||
|
info["wsgi_input_after_seek0_hex"] = seek_body[:200].hex()
|
||||||
|
if hasattr(raw, "seek"):
|
||||||
|
raw.seek(0)
|
||||||
|
except Exception as e:
|
||||||
|
info["wsgi_input_seek_read_error"] = str(e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
body = request.get_data(cache=False)
|
body = request.get_data(cache=False)
|
||||||
info["body_length"] = len(body)
|
info["body_length"] = len(body)
|
||||||
|
|||||||
Reference in New Issue
Block a user