Skip to content

[bug] DELETE 请求被意外添加了 Transfer-Encoding 头 #573

@1574242600

Description

@1574242600

环境

whistle: v2.6.16

描述

所有 DELETE HTTP 1.1 请求 (代理,Composer),无论此前是否有 Transfer-Encoding 头,都被添加了 Transfer-Encoding 头(没有显示在 Inspectors)以及分块传输编码。

示例

原始的请求:
Screenshot_20210522_111253
whistle发出的请求:
Screenshot_20210522_111611

复现

使用任意方式通过 whistle 发送 DELETE HTTP 1.1 请求

可能相关的代码

var isDelete = options.method === 'DELETE' && optHeaders['content-length'] == null;
if (isDelete) {
delete optHeaders['transfer-encoding'];
}
if (proxyUrl) {
util.setClientId(optHeaders, req.enable, req.disable, req.clientIp, isInternalProxy);
} else {
var clientId = optHeaders[config.CLIENT_ID_HEADER];
if (clientId) {
if (!util.isEnable(req, 'keepClientId')) {
util.removeClientId(optHeaders);
}
req.setClientId && req.setClientId(clientId);
}
}
if (req.isH2 && (headers[config.HTTPS_FIELD] || options.isPlugin)) {
headers[config.ALPN_PROTOCOL_HEADER] = 'h2';
}
options.headers = optHeaders = formatHeaders(optHeaders, req.rawHeaderNames);
delete headers[config.WEBUI_HEAD];
if (headers[config.HTTPS_FIELD]) {
delete headers[config.HTTPS_FIELD];
delete headers[config.ALPN_PROTOCOL_HEADER];
}
if (isDelete) {
optHeaders['Transfer-Encoding'] = 'chunked';
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions