SAPI should not add charset to each text subtype
未关闭
还没有人认领这个 Issue。
Category: SAPI
Feature
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The built-in webserver will add ";charset=UTF-8" to the end of the Content-Type response header of the SSE response
The following code:
<?php
header('Content-Type: text/event-stream');
for ($i = 0; $i < 3; ++$i) {
echo 'data: ' . $i . "\n\n";
}
Run server:
php -S 127.0.0.1:8080 test.php
Test:
curl http://127.0.0.1:8080/ -vvv
Resulted in this output:
# curl http://127.0.0.1:8080/ -vvv
* Trying 127.0.0.1:8080...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Host: 127.0.0.1:8080
< Date: Fri, 28 Apr 2023 02:51:28 GMT
< Connection: close
< X-Powered-By: PHP/8.1.18
< Content-type: text/event-stream;charset=UTF-8
<
data: 0
data: 1
data: 2
* Closing connection 0
But I expected this output instead:
# curl http://127.0.0.1:8080/ -vvv
* Trying 127.0.0.1:8080...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:8080
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Host: 127.0.0.1:8080
< Date: Fri, 28 Apr 2023 02:51:28 GMT
< Connection: close
< X-Powered-By: PHP/8.1.18
< Content-type: text/event-stream
<
data: 0
data: 1
data: 2
* Closing connection 0
PHP Version
PHP 8.0.28, 8.1.18, 8.2.5
Operating System
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 issue 中所示的 PHP 脚本和 curl 命令重现内置 webserver 的响应,然后跟踪 SAPI 对 text/event-stream 的响应头处理。完成的标准是响应保留 Content-Type: text/event-stream,且不带自动追加的 charset,同时现有的 SSE body 仍然返回。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, php
- 领域
- backend, web-dev
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100