ok2c commented on a change in pull request #282:
URL: 
https://github.com/apache/httpcomponents-core/pull/282#discussion_r611218097



##########
File path: httpcore5/src/main/java/org/apache/hc/core5/net/URIAuthority.java
##########
@@ -87,23 +64,8 @@ static URIAuthority parse(final CharSequence s, final 
Tokenizer.Cursor cursor) t
             //Rewind
             cursor.updatePos(initPos);
         }
-        final String hostName = tokenizer.parseContent(s, cursor, 
PORT_SEPARATORS);
-        String portText = null;
-        if (!cursor.atEnd() && s.charAt(cursor.getPos()) == ':') {
-            cursor.updatePos(cursor.getPos() + 1);
-            portText = tokenizer.parseContent(s, cursor, TERMINATORS);
-        }
-        final int port;
-        if (!TextUtils.isBlank(portText)) {
-            try {
-                port = Integer.parseInt(portText);
-            } catch (final NumberFormatException ex) {
-                throw createException(s, cursor, "Authority port is invalid");
-            }
-        } else {
-            port = -1;
-        }
-        return new URIAuthority(userInfo, hostName.toLowerCase(Locale.ROOT), 
port, true);
+        final Host host = Host.parse(s, cursor);
+        return new URIAuthority(userInfo, host.getHostName(), host.getPort());

Review comment:
       @michael-o I am not sure I understand what you mean. Why does not 
`URIAuthority` extend `Host`? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to