Skip to content
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

8349121: SSLParameters.setApplicationProtocols() ALPN example could be clarified #23379

Closed
wants to merge 4 commits into from

Conversation

bradfordwetmore
Copy link
Contributor

@bradfordwetmore bradfordwetmore commented Jan 31, 2025

Update and clarify the sample code.

Docs only, no additional testing other than verifying javadoc is correctly output.


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-8349121: SSLParameters.setApplicationProtocols() ALPN example could be clarified (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23379

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 31, 2025

👋 Welcome back wetmore! 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 Jan 31, 2025

@bradfordwetmore 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:

8349121: SSLParameters.setApplicationProtocols() ALPN example could be clarified

Reviewed-by: abarashev, jnimeh, dfuchs

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 45 new commits pushed to the master branch:

  • 7cd5cb2: 8349532: Refactor ./util/Pem/encoding.sh to run in java
  • 86cec4e: 8343782: G1: Use one G1CardSet instance for multiple old gen regions
  • 006ed5c: 8349375: Cleanup AIX special file build settings
  • 3989a19: 8344925: translet-name ignored when package-name is also set
  • 1eb54e4: 8346049: jdk/test/lib/security/timestamp/TsaServer.java warnings
  • a0c7f66: 8349508: runtime/cds/appcds/TestParallelGCWithCDS.java should not check for specific output
  • 1079147: 8348570: CTW: Expose the code hidden by uncommon traps
  • 1a74ee6: 8349092: File.getFreeSpace violates specification if quotas are in effect (win)
  • 0181030: 8349006: File.getCanonicalPath should remove "(on UNIX platforms)" from its specification
  • ed8945a: 8347377: Add validation checks for ICC_Profile header fields
  • ... and 35 more: https://git.openjdk.org/jdk/compare/bad39b6d8892ba9b86bc81bf01108a1df617defb...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 rfr Pull request is ready for review label Jan 31, 2025
@openjdk
Copy link

openjdk bot commented Jan 31, 2025

@bradfordwetmore The following labels will be automatically applied to this pull request:

  • net
  • security

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

@mlbridge
Copy link

mlbridge bot commented Jan 31, 2025

Webrevs

@bradfordwetmore bradfordwetmore changed the title 8349121: SSLParameters.setApplicationProtocols() ALPN example could be clarified. 8349121: SSLParameters.setApplicationProtocols() ALPN example could be clarified Jan 31, 2025
Comment on lines 665 to 668
* // Convert bytes into a ISO_8859_1 encoded string
* String encodedHukUnI =
* new String(bytes, StandardCharsets.ISO_8859_1);
*
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a better comment here would be:

    *      // Preserve bytes by using ISO_8859_1 encoding

because we're not converting anything into anything.

As far as I understand what you are trying to do is to shoe-horn a byte array into a string, so that you can retrieve the original array using String.getBytes(StandardCharsets.ISO_8859_1)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had a similar thought over the weekend.

Updated the comment to Preserve network byte order by using ISO_8859_1 encoding.

As far as I understand what you are trying to do...

Yes. The API was String[] (implemented with 7-bit ASCII), but it was pointed out that we didn't have any way to send some of the TLS GREASE (RFC 8701) values or use extended ASCII (8-bit) characters. (International Charsets was a bonus, but likely aren't used for ALPN.) This was a reasonable workaround.

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.

I had to convince myself (using jshell) that rfc8701Grease8A.getBytes("ISO_8859_1") would return the correct result - but I see that's OK, so this looks good to me. Maybe wait for a review from someone from security-libs before integrating.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 5, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Feb 6, 2025
Copy link
Contributor

@artur-oracle artur-oracle left a comment

Choose a reason for hiding this comment

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

LGTM

@jnimeh
Copy link
Member

jnimeh commented Feb 7, 2025

The comment changes look good to me also.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 7, 2025
@bradfordwetmore
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Feb 7, 2025

Going to push as commit 88a8483.
Since your change was applied there have been 46 commits pushed to the master branch:

  • fb847bb: 8349493: Replace sun.util.locale.ParseStatus usage with java.text.ParsePosition
  • 7cd5cb2: 8349532: Refactor ./util/Pem/encoding.sh to run in java
  • 86cec4e: 8343782: G1: Use one G1CardSet instance for multiple old gen regions
  • 006ed5c: 8349375: Cleanup AIX special file build settings
  • 3989a19: 8344925: translet-name ignored when package-name is also set
  • 1eb54e4: 8346049: jdk/test/lib/security/timestamp/TsaServer.java warnings
  • a0c7f66: 8349508: runtime/cds/appcds/TestParallelGCWithCDS.java should not check for specific output
  • 1079147: 8348570: CTW: Expose the code hidden by uncommon traps
  • 1a74ee6: 8349092: File.getFreeSpace violates specification if quotas are in effect (win)
  • 0181030: 8349006: File.getCanonicalPath should remove "(on UNIX platforms)" from its specification
  • ... and 36 more: https://git.openjdk.org/jdk/compare/bad39b6d8892ba9b86bc81bf01108a1df617defb...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Feb 7, 2025

@bradfordwetmore Pushed as commit 88a8483.

💡 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
Development

Successfully merging this pull request may close these issues.

4 participants