Skip to content

Request with Transfer-Encoding chunked instead of Content-Length #1526

Open
@olivier4576

Description

@olivier4576

Which version of Elastic are you using?

[X] elastic.v7 (for Elasticsearch 7.x)
[ ] elastic.v6 (for Elasticsearch 6.x)
[ ] elastic.v5 (for Elasticsearch 5.x)
[ ] elastic.v3 (for Elasticsearch 2.x)
[ ] elastic.v2 (for Elasticsearch 1.x)

Please describe the expected behavior

ELK search sends an HTTP request with a "Content-Length: nnn" header.

Please describe the actual behavior

ELK search sends an HTTP request with a "Transfer-Encoding: chunked" header.
Transfer-Encoding chunked can be used in a HTTP request but is rarely used and this can cause problems to other tools.

Any steps to reproduce the behavior?

Reproduced in any search request.

The problem is in request.go, in func setBodyHeader(). When called in setBodyJson() or setBodyGzip(), the body is a bytes.Reader, then it must be converted to a bytes.Reader and not a bytes.Buffer to get the ContentLength.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions