Skip to content

Http2 bug workaround#1060

Merged
l-trotta merged 2 commits intomainfrom
http2-issue-fix
Aug 25, 2025
Merged

Http2 bug workaround#1060
l-trotta merged 2 commits intomainfrom
http2-issue-fix

Conversation

@l-trotta
Copy link
Contributor

This provides a workaround for a bug which affects empty body requests when sent with the Rest5Client configured to support http2.
The issue was introduced server side by elastic/elasticsearch#129302 and results in empty body requests causing the following exception: Invalid media-type value on headers [Accept, Content-Type].

(bonus: log fixes for Rest5Client)

Copy link
Contributor

@swallez swallez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, once the explanation comment has been added.


List<ByteBuffer> bodyBuffers = null;
HeaderMap headers = DefaultHeaders;
HeaderMap headers = JsonContentTypeHeaders;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a note here explaining why we set the content-type even for requests with no body. It will be useful for our future selves!

@swallez
Copy link
Contributor

swallez commented Aug 22, 2025

Elasticsearch issue that required this fix: elastic/elasticsearch#133408

@l-trotta l-trotta merged commit 9d7e0cf into main Aug 25, 2025
11 checks passed
@l-trotta l-trotta deleted the http2-issue-fix branch August 25, 2025 08:06
github-actions bot pushed a commit that referenced this pull request Aug 25, 2025
* http2 issue workaround

* adding comment
github-actions bot pushed a commit that referenced this pull request Aug 25, 2025
* http2 issue workaround

* adding comment
l-trotta added a commit that referenced this pull request Aug 25, 2025
* http2 issue workaround

* adding comment

Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
l-trotta added a commit that referenced this pull request Aug 25, 2025
* http2 issue workaround

* adding comment

Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment