AsyncMiddleManServlet removes content-length header if the client doesn't send Expect: 100-Continue
- Dominant language
- Java
- Stars
- 4.1k
- Forks
- 2k
- Avg merge
- 3d 56m
- Merged PRs (30d)
- 48
Description
**Jetty version**
`10.0.15`
**Java version**
`17.0.3`
**Question**
Hi Jetty,
The [`AsyncMiddleManServlet.ProxyReader`](https://github.com/eclipse/jetty.project/blob/a138bfbe1ab41a422448a7a9d95d5fad3495a063/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AsyncMiddleManServlet.java#L388-L392) removes the content-length header and switches to chunked encoding when proxying.
I initially thought this was because you don't know the length of the transformed request, but I noticed that it only does this when the client doesn't send `Expect: 100-Continue` and otherwise keeps the content length header.
Do you know why this difference in behaviour exists? It would be possible to change the headers in `copyRequestHeaders` myself if the content length is unknown without enforcing it in the reader.
I can extend the `ProxyReader` impl to change this behaviour, but it's a significant amount of code that needs to be copied to make a very small behaviour change.
Contributor guide
Assessment
This issue has not been assessed yet.