Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-19 Thread Michael McMahon
Seems fine to me Xuelei. - Michael On 19/08/13 06:56, Xuelei Fan wrote: If no objections, I will push the change by COB Monday. Thanks, Xuelei On 8/13/2013 4:29 PM, Xuelei Fan wrote: Can I get an additional code review from networking team? Thanks, Xuelei On 8/12/2013 2:07 PM, Weijun Wang

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-18 Thread Xuelei Fan
If no objections, I will push the change by COB Monday. Thanks, Xuelei On 8/13/2013 4:29 PM, Xuelei Fan wrote: > Can I get an additional code review from networking team? > > Thanks, > Xuelei > > On 8/12/2013 2:07 PM, Weijun Wang wrote: >> new webrev: http://cr.openjdk.java.net/~xuelei/8020842/

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-15 Thread Matthew Hall
On Thu, Aug 15, 2013 at 10:08:35AM -0700, Mike Duigou wrote: > I've been confused through this discussion as to why a trailing dot would be > regarded as illegal. > > Historically a trailing dot has been frequently (though not universally) used > to denote a fully qualified domain name. > > htt

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-15 Thread Xuelei Fan
On Aug 16, 2013, at 1:08, Mike Duigou wrote: > I've been confused through this discussion as to why a trailing dot would be > regarded as illegal. > The discussion is too long to find the final decision easily. A IDN with trailing dot should be regarded as legal IDN. This update is trying to

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-15 Thread Mike Duigou
I've been confused through this discussion as to why a trailing dot would be regarded as illegal. Historically a trailing dot has been frequently (though not universally) used to denote a fully qualified domain name. https://en.wikipedia.org/wiki/Fully_qualified_domain_name Is this use now ill

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-13 Thread Xuelei Fan
Can I get an additional code review from networking team? Thanks, Xuelei On 8/12/2013 2:07 PM, Weijun Wang wrote: > new webrev: http://cr.openjdk.java.net/~xuelei/8020842/webrev.06/

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-11 Thread Weijun Wang
On 8/12/13 1:45 PM, Xuelei Fan wrote: new webrev: http://cr.openjdk.java.net/~xuelei/8020842/webrev.06/ Lines 280 and 333: How about we call them steps 8a and 8b? Step 8 is referring to the steps in RFC 3490. Let's use "step 8". You break the 1 <= len <= 63 check into two parts, that's w

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-11 Thread Xuelei Fan
new webrev: http://cr.openjdk.java.net/~xuelei/8020842/webrev.06/ > Lines 280 and 333: How about we call them steps 8a and 8b? Step 8 is referring to the steps in RFC 3490. Let's use "step 8". Thanks, Xuelei On 8/12/2013 11:11 AM, Weijun Wang wrote: > I think the fix is adequate and necessary.

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-11 Thread Weijun Wang
if (q < input.length()) { // Ah, a dot! out.append('.'); } p = q + 1; Using if (q != input.length()) should be even better. The searchDots method clearly specifies that "or if there is no dots, return the length of input string". --Max

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-11 Thread Weijun Wang
I think the fix is adequate and necessary. One problem: lines 367-373 adds a new IAE to ToUnicode but the method should not fail forever. And some small comments on styles etc. On 8/12/13 9:09 AM, Xuelei Fan wrote: new webrev: http://cr.openjdk.java.net/~xuelei/8020842/webrev.05/ Lines 123

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-11 Thread Xuelei Fan
new webrev: http://cr.openjdk.java.net/~xuelei/8020842/webrev.05/ Added a new test to test illegal hostname in SNIHostName. Xuelei On 8/10/2013 10:49 AM, Xuelei Fan wrote: > Hi Michael, > > It is pretty hard to get the issue solved in SNIHostName in a good > sharp. Here is my try to state why

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-09 Thread Xuelei Fan
Hi Michael, It is pretty hard to get the issue solved in SNIHostName in a good sharp. Here is my try to state why we should fix the issue in IDN. In SNIHostName, the following hostname are not accepted as valid hostname: 1. empty hostname 2. hostname ends with a trailing dot 3. hostname does not

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-09 Thread Xuelei Fan
Hi Michael, I plan to address this issue in SNIHostName. I have filled another two the potential bugs in IDN. Thank you, and other people, for the feedback. Thanks, Xuelei On 8/9/2013 11:25 PM, Xuelei Fan wrote: > On 8/9/2013 7:31 PM, Michael McMahon wrote: >> I don't see how this fixes the or

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-09 Thread Xuelei Fan
On 8/9/2013 7:31 PM, Michael McMahon wrote: > I don't see how this fixes the original problem as the SNIHostName spec > still doesn't like hostnames with a trailing '.' > The bug description did not reflect the IDN specification correctly. If "com." is a valid IDN, SNIHostName should accept it an

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-09 Thread Michael McMahon
I don't see how this fixes the original problem as the SNIHostName spec still doesn't like hostnames with a trailing '.' I'd prefer to check first where that requirement is coming from, if it is actually necessary, and if not consider removing it from SNIHostName. If it is necessary, then the che

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-09 Thread Xuelei Fan
On Aug 9, 2013, at 14:08, Dmitry Samersoff wrote: > Xuelei, > > 119 p = q + 1; > 120 if (p < input.length() || q == (input.length() - 1)) { > > Could be simplified to: > > q <= input.length()-1 > It's cool! Xuelei > -Dmitry > > On 2013-08-09 04:41, Xuelei Fan wrote:

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Dmitry Samersoff
Xuelei, 119 p = q + 1; 120 if (p < input.length() || q == (input.length() - 1)) { Could be simplified to: q <= input.length()-1 -Dmitry On 2013-08-09 04:41, Xuelei Fan wrote: > Ping. > > Thanks, > Xuelei > > On 8/7/2013 11:17 PM, Xuelei Fan wrote: >> Please review t

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Xuelei Fan
Thanks for your feedback and suggestions. Here is the new webrev: http://cr.openjdk.java.net/~xuelei/8020842/webrev.02/ "." is regarded as valid IDN in this update. Thanks, Xuelei On 8/9/2013 10:50 AM, Xuelei Fan wrote: > On 8/9/2013 10:14 AM, Weijun Wang wrote: >> >> >> On 8/9/13 9:37 AM, X

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Xuelei Fan
On 8/9/2013 11:24 AM, Matthew Hall wrote: > But, DNS considers "." as the valid root zone... > Good! Looks like that IDN.toASCII(".") should returns ".", so that a general domain name can always use IDN.toASCII() conversion instead of throwing runtime exception. Xuelei

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Matthew Hall
But, DNS considers "." as the valid root zone... -- Sent from my mobile device. Xuelei Fan wrote: >On 8/9/2013 10:14 AM, Weijun Wang wrote: >> >> >> On 8/9/13 9:37 AM, Xuelei Fan wrote: >>> On 8/9/2013 9:22 AM, Weijun Wang wrote: I tried nslookup. Those with ".." inside are illegal,

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Xuelei Fan
On 8/9/2013 10:14 AM, Weijun Wang wrote: > > > On 8/9/13 9:37 AM, Xuelei Fan wrote: >> On 8/9/2013 9:22 AM, Weijun Wang wrote: >>> I tried nslookup. Those with ".." inside are illegal, >>> >>> $ nslookup com.. >>> nslookup: 'com..' is not a legal name (empty label) >>> >>> but >>> >>> $ nslookup

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Weijun Wang
On 8/9/13 9:37 AM, Xuelei Fan wrote: On 8/9/2013 9:22 AM, Weijun Wang wrote: I tried nslookup. Those with ".." inside are illegal, $ nslookup com.. nslookup: 'com..' is not a legal name (empty label) but $ nslookup . Server:192.168.10.1 Address:192.168.10.1#53 Non-authoritative

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Xuelei Fan
On 8/9/2013 9:22 AM, Weijun Wang wrote: > I tried nslookup. Those with ".." inside are illegal, > > $ nslookup com.. > nslookup: 'com..' is not a legal name (empty label) > > but > > $ nslookup . > Server:192.168.10.1 > Address:192.168.10.1#53 > > Non-authoritative answer: > *** Can

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Weijun Wang
I tried nslookup. Those with ".." inside are illegal, $ nslookup com.. nslookup: 'com..' is not a legal name (empty label) but $ nslookup . Server: 192.168.10.1 Address:192.168.10.1#53 Non-authoritative answer: *** Can't find .: No answer Also, since this bug was originally ab

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-08 Thread Xuelei Fan
Ping. Thanks, Xuelei On 8/7/2013 11:17 PM, Xuelei Fan wrote: > Please review the new update: > > http://cr.openjdk.java.net./~xuelei/8020842/webrev.01/ > > With this update, "com." is valid (return "com."); "." and > "example..com" are invalid. And IAE will be thrown for invalid IDN. > > Than

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-07 Thread Xuelei Fan
Please review the new update: http://cr.openjdk.java.net./~xuelei/8020842/webrev.01/ With this update, "com." is valid (return "com."); "." and "example..com" are invalid. And IAE will be thrown for invalid IDN. Thanks, Xuelei On 8/7/2013 10:18 PM, Michael McMahon wrote: > On 07/08/13 15:13, X

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-07 Thread Michael McMahon
On 07/08/13 15:13, Xuelei Fan wrote: On 8/7/2013 10:05 PM, Michael McMahon wrote: Resolvers seem to accept queries using trailing dots. eg nslookup www.oracle.com. or InetAddress.getByName("www.oracle.com."); The part of RFC3490 quoted below seems to me to be saying that the empty label impli

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-07 Thread Xuelei Fan
On 8/7/2013 10:05 PM, Michael McMahon wrote: > Resolvers seem to accept queries using trailing dots. > > eg nslookup www.oracle.com. > > or InetAddress.getByName("www.oracle.com."); > > The part of RFC3490 quoted below seems to me to be saying > that the empty label implied by the trailing dot i

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-07 Thread Michael McMahon
Resolvers seem to accept queries using trailing dots. eg nslookup www.oracle.com. or InetAddress.getByName("www.oracle.com."); The part of RFC3490 quoted below seems to me to be saying that the empty label implied by the trailing dot is not regarded as a label so that you don't end up calling t

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-07 Thread Dmitry Samersoff
Xuelei, root label is an empty label[1], dot is a label separator, so in printed form domain names is dot-terminated. Please see also below inline. [1] RFC rfc1034.txt: Internally, programs that manipulate domain names should represent them as sequences of labels, where each label is a length o

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-07 Thread Xuelei Fan
On 8/7/2013 12:06 AM, Matthew Hall wrote: > Trailing dots are allowed in plain DNS (thus almost surely in IDN), > and the single dot represents the root zone. So you have to be > careful making this sort of change to check the DNS RFCs first. That's the first question we need to answer, whether ID

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-06 Thread Michael McMahon
I don't really understand the reason for the restriction in SNIHostName But, I guess that is where it should be enforced if it is required. Michael. On 06/08/13 17:43, Dmitry Samersoff wrote: Xuelei, . (dot) is perfectly valid domain name and it means root domain so com. is valid domain name a

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-06 Thread Dmitry Samersoff
Xuelei, . (dot) is perfectly valid domain name and it means root domain so com. is valid domain name as well. It thinks to me that in context of methods your change we should ignore trailing dots, rather than throw exception. -Dmitry On 2013-08-06 15:44, Xuelei Fan wrote: > Hi, > > Please re

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-06 Thread Matthew Hall
Take a look here for more clarity: http://en.wikipedia.org/wiki/Fully_qualified_domain_name -- Sent from my mobile device. Matthew Hall wrote: >Trailing dots are allowed in plain DNS (thus almost surely in IDN), and >the single dot represents the root zone. So you have to be careful >making thi

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-06 Thread Matthew Hall
Trailing dots are allowed in plain DNS (thus almost surely in IDN), and the single dot represents the root zone. So you have to be careful making this sort of change to check the DNS RFCs first. Matthew. -- Sent from my mobile device. Weijun Wang wrote: >I am not sure if IDN.java is the corre

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-06 Thread Xuelei Fan
On Aug 6, 2013, at 23:08, Weijun Wang wrote: > I am not sure if IDN.java is the correct place to change. At least I've seen > trailing dots in DNS entries. So maybe it's not so illegal. > Per RFC 1034, a domain name cannot end with dot. I will check other related specifications. What's the c

Re: Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-06 Thread Weijun Wang
I am not sure if IDN.java is the correct place to change. At least I've seen trailing dots in DNS entries. So maybe it's not so illegal. --Max On 8/6/13 7:44 PM, Xuelei Fan wrote: Hi, Please review the bug fix to strict the illegal input checking in IDN. webrev: http://cr.openjdk.java.net./~

Code review request, 8020842 IDN do not throw IAE when hostname ends with a trailing dot

2013-08-06 Thread Xuelei Fan
Hi, Please review the bug fix to strict the illegal input checking in IDN. webrev: http://cr.openjdk.java.net./~xuelei/8020842/webrev.00/ Here is two test cases, which are expected to get IAE. Case 1: String host = IDN.toASCII(".", IDN.USE_STD3_ASCII_RULES); Exception in thread "main" java.lang