Hello net-dev

I have been investigating an intermittent error with the following tests in 
jdk11u and 
identified fixes that could be back-ported:
 
   tests/jdk/sun/net/www/protocal/httponly.java
   tests/jdk/sun/net/www/protocal/nocache.java
 
The error was a malformed string being passed to the URI/URL constructor 
(that parses the given string) in the format  "http://0:0:0:0:1%1:65500/path";,
 the root cause being that InetAddress.getHostAddress in some cases returns 
an IPV6 literal string (e.g. "0:0:0:0:1%1"), this specific constructor
expects IPV6 literals to be enclosed in brackets e.g. 
"http://[0:0:0:0:1%1]:65500/path

The issue has been addressed in tip with following change 
https://hg.openjdk.java.net/jdk/jdk/rev/5302477c8285 in response 
to https://bugs.openjdk.java.net/browse/JDK-8224761
 
Has there been discussion about back-porting the fix to the tests to jdk11u?

I looked for other tests with the pattern that can result in malformed URLs 
and only found one case in:
 
        tests/jdk/sun/net/www/http/KeepAliveCache/B5045306.java
 
This has also been fixed in tip with a different change 
http://hg.openjdk.java.net/jdk/jdk/rev/3131927311ee
in response to https://bugs.openjdk.java.net/browse/JDK-8230858

However these two changes achieve the same results using two different 
solutions; 
the fix for B5045306.java and 12 other tests in tip use the following code 
pattern when
using the URI/URL constructor that takes a string to parse:
 
    String hostAddr = InetAddress.getLocalHost().getHostAddress();
    if (hostAddr.indexof(':') > -1) hostAddr = "[" + hostAddr + "]";
 
Whereas the fix for httponly.java and nocache.java use the test utility class  
test/lib/jdk/tests/lib/net/URIBuilder.java, which essentially boils down to 
using
the URI/URL constructor that constructs a hierarchical URI from the given 
components
 
Regardless of whether the fixes are back-ported to jdk11u, is there a shared 
view in 
this mailing list that we pick one pattern on tip for consistency, I'm happy to 
make
the changes if there is agreement
 
Thanks in advance
Mat Carter
Microsoft

Reply via email to