cse-peter-account edited a comment on pull request #673:
URL: https://github.com/apache/jmeter/pull/673#issuecomment-939523346


   > I think, you misread the docs. The _porting_ does not mean the _port_ 
part, but the recompilation/adaption of the java source, when using the Java 
API with IPv6.
   > 
   > What I meant is, that currently we can give JMeter an IP address plus a 
port in one string ("1.2.3.4:80" for IPv4 1.2.3.4 with port 80), which as you 
found out is problematic, when you specify an IPv6 address (as it contains 
colons, which are used currently to separate ip and port). Your solution drops 
the port part completely, which is bad (in my opinion) and probably unneeded.
   > 
   > What I have seen is, that if you want to specify an IPv6 plus port 
combination, you wrap the IPv6 address in square brackets like this: 
"[0::1]:80". If we use this standard notation, the parsing will be simplified 
to looking at the first non space char. If it is a opening square bracket 
('['), we know, that the user wants to specify an IPv6 address. We can look for 
the closing bracket extract the IPv6 and are happy. (As a side effect, we can 
drop adding the new library and ask the normal Java API to confirm the validity 
of the IPv6 address)
   > 
   > What do you think of this patch:
   > 
   > ```diff
   > diff --git 
a/src/core/src/main/java/org/apache/jmeter/engine/ClientJMeterEngine.java 
b/src/core/src/main/java/org/apache/jmeter/engine/ClientJMeterEngine.java
   > index 508d13e7bf..44a8d51294 100644
   > --- 
a/src/core/src/main/java/org/apache/jmeter/engine/ClientJMeterEngine.java
   > +++ 
b/src/core/src/main/java/org/apache/jmeter/engine/ClientJMeterEngine.java
   > @@ -58,7 +58,8 @@ public class ClientJMeterEngine implements JMeterEngine {
   >          final String name = 
RemoteJMeterEngineImpl.JMETER_ENGINE_RMI_NAME; // $NON-NLS-1$ $NON-NLS-2$
   >          String host = hostAndPort;
   >          int port = RmiUtils.DEFAULT_RMI_PORT;
   > -        int indexOfSeparator = hostAndPort.indexOf(':');
   > +        int closingBracket = hostAndPort.indexOf(']');
   > +        int indexOfSeparator = hostAndPort.indexOf(':', closingBracket);
   >          if (indexOfSeparator >= 0) {
   >              host = hostAndPort.substring(0, indexOfSeparator);
   >              String portAsString = 
hostAndPort.substring(indexOfSeparator+1);
   > ```
   
   This patch looks good to me.  Thanks!


-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to