Prepare splithttp changes for next release (#558)

Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
pull/565/head
mmmray 3 months ago committed by GitHub
parent ca6dea482a
commit 1a1372ed94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -6,7 +6,7 @@
可以通过不支持WebSocket的CDN上但仍有一些要求
- CDN必须支持HTTP分块传输且支持流式响应而不会缓冲核心将会发送 `X-Accel-Buffering: no` 以及 `Content-Type: text/event-stream` 以告知CDN但是需要CDN遵守此标头。如果中间盒不支持流式响应而导致连接被挂起,则该传输很可能无法工作。
- CDN必须支持HTTP分块传输且支持流式响应而不会缓冲核心将会发送各种信息以告知CDN但是需要CDN遵守。如果中间盒不支持流式响应而导致连接被挂起,则该传输很可能无法工作。
目的与V2fly Meek相同由于使用了流式响应处理下载下行速率更为优秀上行也经过优化但仍非常有限也因此对 HTTP 中间盒要求更高(见上)。
@ -26,7 +26,8 @@ The `SplitHttpObject` 对应传输配置的 `splithttpSettings` 项。
"scMaxEachPostBytes": 1000000,
"scMaxConcurrentPosts": 100,
"scMinPostsIntervalMs": 30,
"noSSEHeader": false
"noSSEHeader": false,
"xPaddingBytes": "100-1000"
}
```
@ -76,6 +77,12 @@ SplitHTTP 的HTTP请求中所发送的host默认值为空。若服务端值
仅服务端,不发送 `Content-Type: text/event-stream` 响应头,默认 `false` (即会发送)
> `xPaddingBytes` int/string
设置请求出站和响应入站的填充大小用于减少请求指纹。单位byte, 默认为 `"100-1000"` 每次会在该范围中随机选择一个数字。 也可以是单个数字 `"200"`/`200`
设置为 `-1` 将完全禁用填充
## HTTP 版本
### 客户端行为
@ -106,11 +113,18 @@ SplitHTTP 的HTTP请求中所发送的host默认值为空。若服务端值
1. 使用 `GET /<UUID>` 开始下载。服务器立即回复 `200 OK``Transfer Encoding:chunked` , 并立即发送一个两字节的有效负载以强制HTTP中间盒刷新标头。
现阶段服务器会发送以下标头
* `X-Accel-Buffering: no` 禁用缓冲
* `Content-Type: text/event-stream` 在部分中间盒中禁用缓冲,可以使用 `"noSSEHeader"` 选项关闭
* `Transfer-Encoding: chunked` 分块传输,仅在 HTTP/1.1 中使用
* `Cache-Control: no-store` to disable any potential response caching. 禁用CDN的缓存
2. 使用 `POST /<UUID>/<seq>` 开始发送上行数据. `seq` 作用类似于 TCP 序列号从0开始数据包可以被同时发送服务端必须按序列号将数据重组。序列号不应重置。
客户端可以以任意决定打开上行与下行请求的顺序任何一种都可以启动会话但是必须要在30秒内打开 `GET` 连接,否则会话将被终止。
4. `GET` 请求将一直保持在打开状态直到连接被终止服务端和客户端都可以关闭连接。具体行为取决于HTTP版本。
3. `GET` 请求将一直保持在打开状态直到连接被终止服务端和客户端都可以关闭连接。具体行为取决于HTTP版本。
建议:

@ -29,7 +29,8 @@ The `SplitHttpObject` corresponds to the `splithttpSettings` section under trans
"scMaxEachPostBytes": 1000000,
"scMaxConcurrentPosts": 100,
"scMinPostsIntervalMs": 30,
"noSSEHeader": false
"noSSEHeader": false,
"xPaddingBytes": "100-1000"
}
```
@ -51,8 +52,7 @@ Customized HTTP headers defined in key-value pairs. Defaults to empty.
> `scMaxEachPostBytes`: int/string
The maximum size of upload chunks, in bytes. The client defaults to 1MB and the
server defaults to 2MB.
The maximum size of upload chunks, in bytes. Defaults to 1MB.
The size set by the client must be lower than this value, otherwise when the
POST request is sent larger than the value set by the server, the request will
@ -90,6 +90,19 @@ select a value within the range each time to reduce fingerprints.
(Server-only) Do not send the `Content-Type: text/event-stream` response
header. Defaults to false (the header will be sent)
> `xPaddingBytes`
*Added in 1.8.24*
Control the padding of requests and responses. Defaults to `"100-1000"`,
meaning that each GET and POST will be padded with a random amount of bytes in
that range.
A value of `-1` disables padding entirely.
You can lower this to save bandwidth or increase it to improve censorship
resistance. Too much padding may cause the CDN to reject traffic.
## HTTP versions
*Added in 1.8.21: HTTP/3 support*
@ -138,9 +151,13 @@ compatible:
(arbitrary length, such as `ooook`) to force HTTP middleboxes into flushing
headers.
The server will send the `X-Accel-Buffering: no` and `Content-Type:
text/event-stream` headers to force CDN into not buffering the response
body. In HTTP/1.1 it may also send `Transfer-Encoding: chunked`.
The server will send these headers:
* `X-Accel-Buffering: no` to prevent response buffering in nginx and CDN
* `Content-Type: text/event-stream` to prevent response buffering in some
CDN, can be disabled with `noSSEHeader`
* `Transfer-Encoding: chunked` in HTTP/1.1 only
* `Cache-Control: no-store` to disable any potential response caching.
2. Client uploads using `POST /<UUID>/<seq>`. `seq` starts at `0` and can be
used like TCP seq number, and multiple "packets" may be sent concurrently.

Loading…
Cancel
Save