fix: 修复 _HTTP_MAX_BYTES 未定义导致的响应截断 NameError - #41
Open
moliyu1101 wants to merge 2 commits into
Open
Conversation
executor._read_limited_response 读取超大响应时会引用 _HTTP_MAX_BYTES 但全库无定义,导致 NameError 崩溃。补上常量定义(默认 1MB,可 WORKER_HTTP_MAX_BYTES 覆盖),兑现 .env.example 已声明的配置项。
断言常量已定义为正,并验证大响应被截断、小响应原样放行(覆盖曾崩溃的截断分支)。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景:app/tools/executor.py 在响应截断处引用了常量 _HTTP_MAX_BYTES,但该常量全库未定义(runtime NameError)。env.example 第106行本就声明了该变量,属代码漏实现。
修改:
验证:python -m unittest tests.test_executor_http_limit -v 通过。