Skip to content

8308024: HttpClient (HTTP/1.1) sends an extraneous empty chunk if the BodyPublisher supplies an empty buffer #13988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

dfuch
Copy link
Member

@dfuch dfuch commented May 15, 2023

When using HTTP/1.1, if a BodyPublisher reports an unknown length (-1), the HttpClient will send the request body in Chunked mode. If the publisher publishes an empty byte buffer, the client will generate an empty chunk, which the server will interpret as the end of the request body. Sending an empty chunk can never be valid, unless it's the last body chunk and marks the end of the body.

A new subclass of AbstractNoBody.java NoBodyPartThree.java is created to check this scenario. While at it, the tests java/net/httpclient/NoBodyPartOne.java and java/net/httpclient/NoBodyPartTwo.java which create a lot of clients are also updated to make use of HttpClient::close.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8308024: HttpClient (HTTP/1.1) sends an extraneous empty chunk if the BodyPublisher supplies an empty buffer

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13988/head:pull/13988
$ git checkout pull/13988

Update a local copy of the PR:
$ git checkout pull/13988
$ git pull https://git.openjdk.org/jdk.git pull/13988/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13988

View PR using the GUI difftool:
$ git pr show -t 13988

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13988.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 15, 2023

👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 15, 2023

@dfuch The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label May 15, 2023
@dfuch dfuch changed the title No body parts 8308024 8308024: HttpClient (HTTP/1.1) sends an extraneous empty chunk if the BodyPublisher supplies an empty buffer May 15, 2023
@dfuch dfuch marked this pull request as ready for review May 15, 2023 16:16
@openjdk openjdk bot added the rfr Pull request is ready for review label May 15, 2023
@mlbridge
Copy link

mlbridge bot commented May 15, 2023

Webrevs

@openjdk
Copy link

openjdk bot commented May 15, 2023

@dfuch This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8308024: HttpClient (HTTP/1.1) sends an extraneous empty chunk if the BodyPublisher supplies an empty buffer

Reviewed-by: djelinski, michaelm

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 21 new commits pushed to the master branch:

  • 57e7a3f: 8307959: Remove explicit type casts from SerializeClosure::do_xxx() calls
  • 97b2ca3: 8307997: gtest:ZIndexDistributorTest fails on PPC64
  • ffab1ea: 8308086: GHA: x86_32 host configuration failing with unmet dependencies
  • ad348a8: 8303512: Race condition when computing is_loaded property of TypePtr::InterfaceSet
  • 911cc7c: 8305819: LogConfigurationTest intermittently fails on AArch64
  • 8d49ba9: 8308072: [BACKOUT] update for deprecated sprintf for src/utils
  • 0ee196b: 8307163: JLONG_FORMAT_SPECIFIER should be updated on Windows
  • 3709344: 8291550: RISC-V: jdk uses misaligned memory access when AvoidUnalignedAccess enabled
  • 646747f: 8307926: Support byte-sized atomic bitset operations
  • f030937: 8305670: Performance regression in LockSupport.unpark with lots of idle threads
  • ... and 11 more: https://git.openjdk.org/jdk/compare/7455bb23c1d18224e48e91aae4f11fe114d04fab...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 15, 2023
Copy link
Member

@Michael-Mc-Mahon Michael-Mc-Mahon left a comment

Choose a reason for hiding this comment

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

Looks fine

@dfuch
Copy link
Member Author

dfuch commented May 16, 2023

/integrate

@openjdk
Copy link

openjdk bot commented May 16, 2023

Going to push as commit 72294c5.
Since your change was applied there have been 33 commits pushed to the master branch:

  • c9b6bb5: 8308041: [JVMCI] WB_IsGCSupportedByJVMCICompiler must enter correct JVMCI env
  • 0790f70: 8306806: JMX agent with JDP enabled won't start when PerfData is disabled
  • c2ef302: 8307968: serviceability/jvmti/vthread/StopThreadTest/StopThreadTest.java timed out
  • d22bcc8: 8307403: java/util/zip/DeInflate.java timed out
  • 2210e06: 8306638: Open source some AWT tests related to datatransfer and Toolkit
  • 05b51c7: 8307567: Avoid relocating global roots to metaspaceObjs in CDS dump
  • 3168372: 8306597: Improve string formatting in EquivMapsGenerator.java
  • 7b0b9b5: 8308049: Refactor nested class declarations in FdLibm.java
  • cc80ada: 8306593: Fix nsk/jdi/stop/stop001 for virtual threads and remove from problem list
  • 43c8c65: 8307555: Reduce memory reads in x86 MD5 intrinsic
  • ... and 23 more: https://git.openjdk.org/jdk/compare/7455bb23c1d18224e48e91aae4f11fe114d04fab...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 16, 2023
@openjdk openjdk bot closed this May 16, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 16, 2023
@openjdk
Copy link

openjdk bot commented May 16, 2023

@dfuch Pushed as commit 72294c5.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants