-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8353662: Add test for non-local file URL fallback to FTP #24418
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
Conversation
👋 Welcome back eirbjo! A progress list of the required criteria for merging this PR into |
@eirbjo 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:
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 271 new commits pushed to the
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 |
461f1c3
to
f235d79
Compare
Webrevs
|
/label remove core-libs |
@AlanBateman |
@Test | ||
public void verifyNonLocalFtpFallback() throws Exception { | ||
URL localURL = file.toUri().toURL(); | ||
URL nonLocalURL = new URL("file", "127.0.0.1", localURL.getFile()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The URL should not assume that the loopback is an IPv4 address. Or is this handled by the proxy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The URL should not assume that the loopback is an IPv4 address. Or is this handled by the proxy?
Right. The following returns "127.0.0.1" for me, would that be the correct API to use?
InetAddress.getLoopbackAddress().getHostAddress()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - I see that 127.0.0.1 should not be directly used. Would it work if we replaced that with a fake host name then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - I see that 127.0.0.1 should not be directly used. Would it work if we replaced that with a fake host name then?
Yeah, you're right, the FTP request never materializes (our proxy just swallows it). So we only use it to assert against what was requested from the proxy, we can use a fake host name.
Any preference/precedence for fake host names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good. "127.0.0.1" rings alarm bells because we're trying to make our tests independent of the IP versions supported by the machine they run on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good.
Does this mean you think the PR is good for approval now that the IP version aspect has been taken care of?
Or would you like more time/people to review this test-only enhancement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - thanks for pinging me.
I tested the change in our CI and the new test seem stable. Approved.
@dfuch Tagnential observation: Looking at the How is |
Interesting. That looks like a bug to me. stop() should probably look at |
Let's see if this captures the essence: https://bugs.openjdk.org/browse/JDK-8353720 EDIT: There was already a bug filed for this: https://bugs.openjdk.org/browse/JDK-8304065 |
Thanks you Daniel for running this through CI and for the review. /integrate |
Going to push as commit cae7a20.
Your commit was automatically rebased without conflicts. |
Please review this test-only PR which introduces testing of the unspecified but long-standing fallback to FTP for non-local files in the 'file' URL scheme.
This in preparation for the upcoming proposal to disable the feature by default in JDK-8353440.
Since we cannot reliably bind an FTP server to port 21, the test instead uses an HTTP proxy, binding to an ephemeral port. This menas we don't test non-proxy code paths. We still test that the FTP fallback is used, which is the key point here. (We aim to test file URL connections, not FTP URL connection internals)
An alternative here could be to just verify that the returned URLConnection is an instance of FtpURLConnection. However, I opted for an end-to-end test here, since the amount of extra code seems reasonable.
By temporarly moving this test to tier1, I was able to confirm this test runs green also on Windows GHA.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24418/head:pull/24418
$ git checkout pull/24418
Update a local copy of the PR:
$ git checkout pull/24418
$ git pull https://git.openjdk.org/jdk.git pull/24418/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24418
View PR using the GUI difftool:
$ git pr show -t 24418
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24418.diff
Using Webrev
Link to Webrev Comment