huace-aigc-auth-client 1.1.26__py3-none-any.whl → 1.1.27__py3-none-any.whl
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/__init__.py +1 -1
- huace_aigc_auth_client/sdk.py +8 -8
- {huace_aigc_auth_client-1.1.26.dist-info → huace_aigc_auth_client-1.1.27.dist-info}/METADATA +1 -1
- {huace_aigc_auth_client-1.1.26.dist-info → huace_aigc_auth_client-1.1.27.dist-info}/RECORD +7 -7
- {huace_aigc_auth_client-1.1.26.dist-info → huace_aigc_auth_client-1.1.27.dist-info}/WHEEL +0 -0
- {huace_aigc_auth_client-1.1.26.dist-info → huace_aigc_auth_client-1.1.27.dist-info}/licenses/LICENSE +0 -0
- {huace_aigc_auth_client-1.1.26.dist-info → huace_aigc_auth_client-1.1.27.dist-info}/top_level.txt +0 -0
huace_aigc_auth_client/sdk.py
CHANGED
|
@@ -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:
|
|
@@ -698,14 +706,6 @@ class AuthMiddleware:
|
|
|
698
706
|
params["form_params"] = form_params
|
|
699
707
|
except Exception:
|
|
700
708
|
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
|
|
709
709
|
# 其他类型(如 application/octet-stream 等二进制流)直接跳过,不读取
|
|
710
710
|
|
|
711
711
|
return params
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
huace_aigc_auth_client/__init__.py,sha256=
|
|
1
|
+
huace_aigc_auth_client/__init__.py,sha256=XkPDfVkTRYhsWlUaPfeaXqNTIKyDQlEa-TefQedlu0g,4630
|
|
2
2
|
huace_aigc_auth_client/api_stats_collector.py,sha256=UCUu2CHWsJyiAM58-XLQtfxWK0fjZ8TTdw90gv_Gx04,10347
|
|
3
3
|
huace_aigc_auth_client/legacy_adapter.py,sha256=TVCBAKejE2z2HQFsEwDW8LMiaIkXNfz3Mxv6_E-UJFY,24102
|
|
4
|
-
huace_aigc_auth_client/sdk.py,sha256=
|
|
4
|
+
huace_aigc_auth_client/sdk.py,sha256=cRwOQ-AzrthNUprj2Q5WvQ1GIeDxY-AgdMciw0Ous90,37182
|
|
5
5
|
huace_aigc_auth_client/user_context.py,sha256=KzevYLsLv1hv8rlvRw83FT-HugeoBJSJ1Pi56iLWyTE,5592
|
|
6
6
|
huace_aigc_auth_client/webhook.py,sha256=XQZYEbMoqIdqZWCGSTcedeDKJpDbUVSq5g08g-6Qucg,4124
|
|
7
7
|
huace_aigc_auth_client/webhook_flask.py,sha256=Iosu4dBtRhQZM_ytn-bn82MpVsyOiV28FBnt7Tfh31U,7225
|
|
8
|
-
huace_aigc_auth_client-1.1.
|
|
9
|
-
huace_aigc_auth_client-1.1.
|
|
10
|
-
huace_aigc_auth_client-1.1.
|
|
11
|
-
huace_aigc_auth_client-1.1.
|
|
12
|
-
huace_aigc_auth_client-1.1.
|
|
8
|
+
huace_aigc_auth_client-1.1.27.dist-info/licenses/LICENSE,sha256=z7dgC7KljhBLNvKjN15391nMj3aLt0gbud8-Yf1F8EQ,1063
|
|
9
|
+
huace_aigc_auth_client-1.1.27.dist-info/METADATA,sha256=wi4IFWXXPgBBUKOO98ept8GxuCkYpT-VUVih_mbYLbk,23629
|
|
10
|
+
huace_aigc_auth_client-1.1.27.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
11
|
+
huace_aigc_auth_client-1.1.27.dist-info/top_level.txt,sha256=kbv0nQ6PQ0JVneWPH7O2AbtlJnP7AjvFJ6JjM6ZEBxo,23
|
|
12
|
+
huace_aigc_auth_client-1.1.27.dist-info/RECORD,,
|
|
File without changes
|
{huace_aigc_auth_client-1.1.26.dist-info → huace_aigc_auth_client-1.1.27.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{huace_aigc_auth_client-1.1.26.dist-info → huace_aigc_auth_client-1.1.27.dist-info}/top_level.txt
RENAMED
|
File without changes
|