Skip to content

Conversation

@cstamas
Copy link
Member

@cstamas cstamas commented Jun 8, 2025

But this does not work for HEAD() that is 18+.

Moreover, builder method(String, BodyPublisher) enforces body publisher as non-null, while the logic to stop emitting Content-Length: 0 on GET and HEAD expects null body publisher.

This fixes:

  • GET as it uses dedicated GET() method on builder that will use null body publisher (and JDK bugfix will work)
  • PUT as it uses dedicated PUT() method on builder
  • but does not fix HEAD (and as I see, it will be still emitted with Content-Length: 0, but may be wrong). Fixing HEAD is not possible, as dedicated HEAD() method was added in java 18, while the existing method(String, BodyPublisher) enforces non-null publisher.

Fixes #739

But this does not work for HEAD() that is 18+.
Moreover, builder `method(String, BodyPublisher)`
enforces body publisher as non-null, while the logic
to stop emitting `Content-Length: 0` on GET and HEAD
expects `null` body publisher.

Fixes apache#739
@cstamas cstamas self-assigned this Jun 8, 2025
@cstamas cstamas added this to the 2.0.10 milestone Jun 8, 2025
@cstamas cstamas added bug Something isn't working java Pull requests that update Java code labels Jun 8, 2025
@cstamas cstamas marked this pull request as ready for review June 8, 2025 14:44
Copy link
Member

@slawekjaranowski slawekjaranowski left a comment

Choose a reason for hiding this comment

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

can we introduce a test for it? 😄

@cstamas
Copy link
Member Author

cstamas commented Jun 9, 2025

@slawekjaranowski like test "does JDK transport sends Content-Length: 0 with GET? As otherwise JDK transport (as all HTTP transports, apache and jetty) are quite well covered.

@cstamas cstamas merged commit fac1569 into apache:master Jun 11, 2025
8 checks passed
@cstamas cstamas deleted the issue-739 branch June 11, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JDK transport issue with jitpack.io

2 participants