huace-aigc-auth-client 1.1.26__tar.gz → 1.1.28__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {huace_aigc_auth_client-1.1.26/huace_aigc_auth_client.egg-info → huace_aigc_auth_client-1.1.28}/PKG-INFO +1 -1
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/__init__.py +1 -1
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/sdk.py +9 -20
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28/huace_aigc_auth_client.egg-info}/PKG-INFO +1 -1
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/pyproject.toml +1 -1
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/LICENSE +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/MANIFEST.in +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/QUICK_START.txt +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/README.md +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/api_stats_collector.py +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/legacy_adapter.py +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/user_context.py +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/webhook.py +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/webhook_flask.py +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client.egg-info/SOURCES.txt +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client.egg-info/dependency_links.txt +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client.egg-info/requires.txt +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client.egg-info/top_level.txt +0 -0
- {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/setup.cfg +0 -0
{huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/sdk.py
RENAMED
|
@@ -672,6 +672,14 @@ class AuthMiddleware:
|
|
|
672
672
|
|
|
673
673
|
# 获取请求体(使用白名单方式,只处理已知安全的内容类型)
|
|
674
674
|
content_type = request.headers.get("content-type", "").lower()
|
|
675
|
+
# 读取请求体(需要特殊处理以避免消耗流)
|
|
676
|
+
body = b""
|
|
677
|
+
if request.method in ["POST", "PUT", "PATCH"]:
|
|
678
|
+
try:
|
|
679
|
+
body = await request.body()
|
|
680
|
+
except:
|
|
681
|
+
pass
|
|
682
|
+
params["request_body"] = body.decode('utf-8', errors='ignore')
|
|
675
683
|
|
|
676
684
|
if "application/json" in content_type:
|
|
677
685
|
try:
|
|
@@ -686,26 +694,7 @@ class AuthMiddleware:
|
|
|
686
694
|
pass
|
|
687
695
|
elif "multipart/form-data" in content_type:
|
|
688
696
|
# 文件上传请求,不读取 body,避免损坏文件流
|
|
689
|
-
|
|
690
|
-
try:
|
|
691
|
-
form = await request.form()
|
|
692
|
-
form_params = {}
|
|
693
|
-
for k, v in form.items():
|
|
694
|
-
if hasattr(v, "filename"):
|
|
695
|
-
# 跳过文件字段
|
|
696
|
-
continue
|
|
697
|
-
form_params[k] = v
|
|
698
|
-
params["form_params"] = form_params
|
|
699
|
-
except Exception:
|
|
700
|
-
pass
|
|
701
|
-
elif content_type.startswith('text/'):
|
|
702
|
-
# 只读取文本类型的请求体,且限制大小避免内存问题
|
|
703
|
-
try:
|
|
704
|
-
body = await request.body()
|
|
705
|
-
if body and len(body) < 10240: # 限制10KB避免内存问题
|
|
706
|
-
params["request_body"] = body.decode('utf-8')
|
|
707
|
-
except Exception:
|
|
708
|
-
pass
|
|
697
|
+
params["form_params"] = {"skipped_multipart": True}
|
|
709
698
|
# 其他类型(如 application/octet-stream 等二进制流)直接跳过,不读取
|
|
710
699
|
|
|
711
700
|
return params
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/webhook.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|