eclipse-vertx / eclipse-vertx/vert.x
httpClient write h2 buffer failed
- Dominant language
- Java
- Stars
- 14.7k
- Forks
- 2.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 28
Description
### Version
4.x and 5.x
### Context
1.
I used http proxy to forward grpc requests, but I encountered a bug
```
java.lang.IllegalStateException: You must set the Content-Length header to be the total size of the message body BEFORE sending any data if you are not using HTTP chunked encoding.
at io.vertx.core.http.impl.HttpClientRequestImpl.write(HttpClientRequestImpl.java:488)
at io.vertx.core.http.impl.HttpClientRequestImpl.write(HttpClientRequestImpl.java:464)
at io.vertx.core.http.impl.HttpClientRequestImpl.write(HttpClientRequestImpl.java:41)
at io.vertx.core.streams.impl.PipeImpl.lambda$to$1(PipeImpl.java:78)
at io.vertx.core.impl.ContextBase.emit(ContextBase.java:82)
...
```
I found that in HttpClientRequestImpl#requiresContentLength, there was no judgment on the situation where h2 does not need to be chunked.
2.
At the same time, when this error occurred, the request still did not end. Should the proxiedRequest be closed when an exception occurs in the http proxy write.
### Steps to reproduce
_No response_
### Do you have a reproducer?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.