Skip to content

httpClient write h2 buffer failed #5708

@wang007

Description

@wang007

Version

4.x and 5.x

Context

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.

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.

Image

Steps to reproduce

No response

Do you have a reproducer?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions