Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
tornadoweb
Tornado
提交
9c927ffb
Tornado
项目概览
镜像
/
tornadoweb
/
Tornado
10 个月 前同步成功
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Tornado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9c927ffb
编写于
9月 08, 2019
作者:
B
Bulat Khasanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix extra data sending at HEAD response with Transfer-Encoding: Chunked
上级
ff985fe5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
1 deletion
+21
-1
tornado/http1connection.py
tornado/http1connection.py
+4
-1
tornado/test/httpserver_test.py
tornado/test/httpserver_test.py
+17
-0
未找到文件。
tornado/http1connection.py
浏览文件 @
9c927ffb
...
...
@@ -511,7 +511,10 @@ class HTTP1Connection(httputil.HTTPConnection):
%
self
.
_expected_content_remaining
)
if
self
.
_chunking_output
:
if
not
self
.
stream
.
closed
():
assert
self
.
_request_start_line
if
not
self
.
stream
.
closed
()
and
(
self
.
is_client
or
self
.
_request_start_line
.
method
!=
"HEAD"
):
self
.
_pending_write
=
self
.
stream
.
write
(
b
"0
\r\n\r\n
"
)
self
.
_pending_write
.
add_done_callback
(
self
.
_on_write_complete
)
self
.
_write_finished
=
True
...
...
tornado/test/httpserver_test.py
浏览文件 @
9c927ffb
...
...
@@ -770,6 +770,12 @@ class KeepAliveTest(AsyncHTTPTestCase):
# be written out in chunks.
self
.
write
(
""
.
join
(
chr
(
i
%
256
)
*
1024
for
i
in
range
(
512
)))
class
TransferEncodingChunkedHandler
(
RequestHandler
):
@
gen
.
coroutine
def
head
(
self
):
self
.
write
(
"Hello world"
)
yield
self
.
flush
()
class
FinishOnCloseHandler
(
RequestHandler
):
def
initialize
(
self
,
cleanup_event
):
self
.
cleanup_event
=
cleanup_event
...
...
@@ -790,6 +796,7 @@ class KeepAliveTest(AsyncHTTPTestCase):
[
(
"/"
,
HelloHandler
),
(
"/large"
,
LargeHandler
),
(
"/chunked"
,
TransferEncodingChunkedHandler
),
(
"/finish_on_close"
,
FinishOnCloseHandler
,
...
...
@@ -943,6 +950,16 @@ class KeepAliveTest(AsyncHTTPTestCase):
self
.
assertEqual
(
self
.
headers
[
"Connection"
],
"Keep-Alive"
)
self
.
close
()
@
gen_test
def
test_keepalive_chunked_head_no_body
(
self
):
yield
self
.
connect
()
self
.
stream
.
write
(
b
"HEAD /chunked HTTP/1.1
\r\n\r\n
"
)
yield
self
.
read_headers
()
self
.
stream
.
write
(
b
"HEAD /chunked HTTP/1.1
\r\n\r\n
"
)
yield
self
.
read_headers
()
self
.
close
()
class
GzipBaseTest
(
object
):
def
get_app
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录