Skip to content

8287134: HttpURLConnection chunked streaming mode doesn't enforce specified size #12137

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 2 commits into from

Conversation

c-cleary
Copy link
Contributor

@c-cleary c-cleary commented Jan 23, 2023

Description

When using HttpURLConnection::setChunkedStreamingMode(), the current documentation does not make it clear that the chunklen parameter refers to the amount of bytes sent on the wire per HTTP/1.1 chunk and not the payload length per chunk. The chunklen parameter takes into account the bytes used for the chunk size header, two CRLF characters and the possible payload length inclusively.

Summary of Changes & Justification

The API text has been updated to reflect the actual behavior of the method as described above to avoid a similar bug being submitted in the future and to make it clear what the chunklen parameter specifies.

This change will require a csr.


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
  • Change requires CSR request JDK-8300848 to be approved

Issues

  • JDK-8287134: HttpURLConnection chunked streaming mode doesn't enforce specified size
  • JDK-8300848: HttpURLConnection chunked streaming mode doesn't enforce specified size (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12137

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

Using diff file

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

@c-cleary c-cleary marked this pull request as ready for review January 23, 2023 09:06
@c-cleary
Copy link
Contributor Author

/csr needed

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 23, 2023

👋 Welcome back ccleary! 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.

@c-cleary
Copy link
Contributor Author

A CSR will be required to be submitted for this change. I will create this and allow for a review period of this PR before finalizing it.

@openjdk openjdk bot added rfr Pull request is ready for review csr Pull request needs approved CSR before integration labels Jan 23, 2023
@openjdk
Copy link

openjdk bot commented Jan 23, 2023

@c-cleary this pull request will not be integrated until the CSR request JDK-8300848 for issue JDK-8287134 has been approved.

@openjdk
Copy link

openjdk bot commented Jan 23, 2023

@c-cleary 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 Jan 23, 2023
@mlbridge
Copy link

mlbridge bot commented Jan 23, 2023

Webrevs

@c-cleary
Copy link
Contributor Author

A related CSR has been created here: https://bugs.openjdk.org/browse/JDK-8300848

Seeking review on that as well before moving forward.

* each chunk. This includes a chunk size header given as a
* hexidecimal string (minimum of 1 byte), two CRLF's (4 bytes)
* and a minimum payload length of 1 byte. If chunklen is less
* than or equal to 5, a default value will be used.
*
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest something like this:

chunklen The number of bytes to be written in
each chunk, including the chunk header as a
hexadecimal string (minimum of 1 byte), two CRLF's (4 bytes)
and a minimum payload length of 1 byte. If chunklen is less
than or equal to 5, a higher default value will be used.

Copy link
Contributor Author

@c-cleary c-cleary Jan 23, 2023

Choose a reason for hiding this comment

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

Thanks @Michael-Mc-Mahon, I updated the text with respect to your suggestion there (which was definitely a bit more clear than mine) and corrected my spelling of hexadecimal in my most recent changes just now.

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

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

The new text looks good to me.

@c-cleary
Copy link
Contributor Author

Thanks Daniel! The related CSR has now been updated to reflect the new text.

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.

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Jan 26, 2023
@openjdk
Copy link

openjdk bot commented Jan 26, 2023

@c-cleary 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:

8287134: HttpURLConnection chunked streaming mode doesn't enforce specified size

Reviewed-by: dfuchs, 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 171 new commits pushed to the master branch:

  • b5a4744: 8300857: State return value for Types.asElement(NoType) explicitly
  • 7e951f4: 8301092: Add benchmark for CRC32
  • adcfd25: 8301098: Remove dead code FileMapInfo::stop_sharing_and_unmap()
  • 9f0887e: 8296661: Typo Found In CSSParser.java
  • ccf2f58: 8300806: Update googletest to v1.13.0
  • edf1e1a: 8300592: ASan build does not correctly propagate options to some test launchers
  • e80b5ea: 8299635: Hotspot update for deprecated sprintf in Xcode 14
  • f279c75: 8300805: Update autoconf build-aux files with latest from 2022-09-17
  • a23ff63: 8301086: jdk/internal/util/ByteArray/ReadWriteValues.java fails with CompilationError
  • 61775c8: 8300997: Add curl support to createJMHBundle.sh
  • ... and 161 more: https://git.openjdk.org/jdk/compare/85d70acc6e5b9f394d446c270f15bb3793916e63...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 Jan 26, 2023
@c-cleary
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 26, 2023

Going to push as commit 48152ef.
Since your change was applied there have been 173 commits pushed to the master branch:

  • 4b0e656: 8298118: split-if optimization causes empty loop to temporarily have more than one phi
  • 252621d: 8301063: Remove dead code from GrowableArray
  • b5a4744: 8300857: State return value for Types.asElement(NoType) explicitly
  • 7e951f4: 8301092: Add benchmark for CRC32
  • adcfd25: 8301098: Remove dead code FileMapInfo::stop_sharing_and_unmap()
  • 9f0887e: 8296661: Typo Found In CSSParser.java
  • ccf2f58: 8300806: Update googletest to v1.13.0
  • edf1e1a: 8300592: ASan build does not correctly propagate options to some test launchers
  • e80b5ea: 8299635: Hotspot update for deprecated sprintf in Xcode 14
  • f279c75: 8300805: Update autoconf build-aux files with latest from 2022-09-17
  • ... and 163 more: https://git.openjdk.org/jdk/compare/85d70acc6e5b9f394d446c270f15bb3793916e63...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 26, 2023

@c-cleary Pushed as commit 48152ef.

💡 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