[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17242137#comment-17242137 ] Praveen Chaubey commented on VFS-524: - Hi! I am using commons-vfs2 version 2.6.0 and able to make connections over IPv6. IPv6 address has to be provided in square brackets. > The uri include ipv6 address can't be parsed out correctly > -- > > Key: VFS-524 > URL: https://issues.apache.org/jira/browse/VFS-524 > Project: Commons VFS > Issue Type: Bug >Affects Versions: 2.0 >Reporter: Alex >Priority: Major > Attachments: VFS-524-v2.patch, VFS-524-v3.patch > > > I am using apache commons vfs2 to read and download file in ipv6 enviroment, > but it seems can't parse out ipv6 address correctly > The URI is just like: > ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test > The error message: > Invalid absolute URI "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Caused by : Expecting / to follow the hostname in URI > "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Deep into the code, I found the root cause is that HostFileNameParser's > extractHostName can't parse out the host name correctly > {noformat} > /** > * Extracts the hostname from a URI. The scheme://userinfo@ part has > * been removed. > */ > protected String extractHostName(final StringBuilder name) > { > final int maxlen = name.length(); > int pos = 0; > for (; pos < maxlen; pos++) > { > final char ch = name.charAt(pos); > if (ch == '/' || ch == ';' || ch == '?' || ch == ':' > || ch == '@' || ch == '&' || ch == '=' || ch == '+' > || ch == '$' || ch == ',') > { > break; > } > } > if (pos == 0) > { > return null; > } > final String hostname = name.substring(0, pos); > name.delete(0, pos); > return hostname; > } > {noformat} > From the code, we are able to know it will parse out the host name by colon, > but for ipv6, it will get a wrong host name > There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16725698#comment-16725698 ] Jean Pierre Urkens commented on VFS-524: - Ok, checked the v2.2 code and the fix isn't yet present. > The uri include ipv6 address can't be parsed out correctly > -- > > Key: VFS-524 > URL: https://issues.apache.org/jira/browse/VFS-524 > Project: Commons VFS > Issue Type: Bug >Affects Versions: 2.0 >Reporter: Alex >Priority: Major > Attachments: VFS-524-v2.patch, VFS-524-v3.patch > > > I am using apache commons vfs2 to read and download file in ipv6 enviroment, > but it seems can't parse out ipv6 address correctly > The URI is just like: > ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test > The error message: > Invalid absolute URI "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Caused by : Expecting / to follow the hostname in URI > "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Deep into the code, I found the root cause is that HostFileNameParser's > extractHostName can't parse out the host name correctly > {noformat} > /** > * Extracts the hostname from a URI. The scheme://userinfo@ part has > * been removed. > */ > protected String extractHostName(final StringBuilder name) > { > final int maxlen = name.length(); > int pos = 0; > for (; pos < maxlen; pos++) > { > final char ch = name.charAt(pos); > if (ch == '/' || ch == ';' || ch == '?' || ch == ':' > || ch == '@' || ch == '&' || ch == '=' || ch == '+' > || ch == '$' || ch == ',') > { > break; > } > } > if (pos == 0) > { > return null; > } > final String hostname = name.substring(0, pos); > name.delete(0, pos); > return hostname; > } > {noformat} > From the code, we are able to know it will parse out the host name by colon, > but for ipv6, it will get a wrong host name > There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16725672#comment-16725672 ] Jean Pierre Urkens commented on VFS-524: - I am trying to setup an FTP connection to the IPv6 loopback address using commons-vfs2 version 2.2 and commons-net v3.6. I tried following URI'S: [ftp://[::1]|ftp://[:1]] and [ftp://[0:0:0:0:0:0:0:1]|ftp://[::1]/] but I am allways getting the error: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "[ftp://[0:0:0:0:0:0:0:1]|ftp://[::1]/] Isn't the fix present in v2.2 or am I missing something here? > The uri include ipv6 address can't be parsed out correctly > -- > > Key: VFS-524 > URL: https://issues.apache.org/jira/browse/VFS-524 > Project: Commons VFS > Issue Type: Bug >Affects Versions: 2.0 >Reporter: Alex >Priority: Major > Attachments: VFS-524-v2.patch, VFS-524-v3.patch > > > I am using apache commons vfs2 to read and download file in ipv6 enviroment, > but it seems can't parse out ipv6 address correctly > The URI is just like: > ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test > The error message: > Invalid absolute URI "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Caused by : Expecting / to follow the hostname in URI > "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Deep into the code, I found the root cause is that HostFileNameParser's > extractHostName can't parse out the host name correctly > {noformat} > /** > * Extracts the hostname from a URI. The scheme://userinfo@ part has > * been removed. > */ > protected String extractHostName(final StringBuilder name) > { > final int maxlen = name.length(); > int pos = 0; > for (; pos < maxlen; pos++) > { > final char ch = name.charAt(pos); > if (ch == '/' || ch == ';' || ch == '?' || ch == ':' > || ch == '@' || ch == '&' || ch == '=' || ch == '+' > || ch == '$' || ch == ',') > { > break; > } > } > if (pos == 0) > { > return null; > } > final String hostname = name.substring(0, pos); > name.delete(0, pos); > return hostname; > } > {noformat} > From the code, we are able to know it will parse out the host name by colon, > but for ipv6, it will get a wrong host name > There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197676#comment-16197676 ] Gary Gregory commented on VFS-524: -- I just need a fresh PR ;-) > The uri include ipv6 address can't be parsed out correctly > -- > > Key: VFS-524 > URL: https://issues.apache.org/jira/browse/VFS-524 > Project: Commons VFS > Issue Type: Bug >Affects Versions: 2.0 >Reporter: Alex > Attachments: VFS-524-v2.patch, VFS-524-v3.patch > > > I am using apache commons vfs2 to read and download file in ipv6 enviroment, > but it seems can't parse out ipv6 address correctly > The URI is just like: > ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test > The error message: > Invalid absolute URI "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Caused by : Expecting / to follow the hostname in URI > "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Deep into the code, I found the root cause is that HostFileNameParser's > extractHostName can't parse out the host name correctly > {noformat} > /** > * Extracts the hostname from a URI. The scheme://userinfo@ part has > * been removed. > */ > protected String extractHostName(final StringBuilder name) > { > final int maxlen = name.length(); > int pos = 0; > for (; pos < maxlen; pos++) > { > final char ch = name.charAt(pos); > if (ch == '/' || ch == ';' || ch == '?' || ch == ':' > || ch == '@' || ch == '&' || ch == '=' || ch == '+' > || ch == '$' || ch == ',') > { > break; > } > } > if (pos == 0) > { > return null; > } > final String hostname = name.substring(0, pos); > name.delete(0, pos); > return hostname; > } > {noformat} > From the code, we are able to know it will parse out the host name by colon, > but for ipv6, it will get a wrong host name > There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197650#comment-16197650 ] David So commented on VFS-524: -- (y) That will be great. > The uri include ipv6 address can't be parsed out correctly > -- > > Key: VFS-524 > URL: https://issues.apache.org/jira/browse/VFS-524 > Project: Commons VFS > Issue Type: Bug >Affects Versions: 2.0 >Reporter: Alex > Attachments: VFS-524-v2.patch, VFS-524-v3.patch > > > I am using apache commons vfs2 to read and download file in ipv6 enviroment, > but it seems can't parse out ipv6 address correctly > The URI is just like: > ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test > The error message: > Invalid absolute URI "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Caused by : Expecting / to follow the hostname in URI > "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Deep into the code, I found the root cause is that HostFileNameParser's > extractHostName can't parse out the host name correctly > {noformat} > /** > * Extracts the hostname from a URI. The scheme://userinfo@ part has > * been removed. > */ > protected String extractHostName(final StringBuilder name) > { > final int maxlen = name.length(); > int pos = 0; > for (; pos < maxlen; pos++) > { > final char ch = name.charAt(pos); > if (ch == '/' || ch == ';' || ch == '?' || ch == ':' > || ch == '@' || ch == '&' || ch == '=' || ch == '+' > || ch == '$' || ch == ',') > { > break; > } > } > if (pos == 0) > { > return null; > } > final String hostname = name.substring(0, pos); > name.delete(0, pos); > return hostname; > } > {noformat} > From the code, we are able to know it will parse out the host name by colon, > but for ipv6, it will get a wrong host name > There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16196179#comment-16196179 ] Gary Gregory commented on VFS-524: -- How about a fresh PR on Githubwith tests ;-) I just pushed out version 2.2 but there is no reason not to have a 2.2.1 around the corner. > The uri include ipv6 address can't be parsed out correctly > -- > > Key: VFS-524 > URL: https://issues.apache.org/jira/browse/VFS-524 > Project: Commons VFS > Issue Type: Bug >Affects Versions: 2.0 >Reporter: Alex > Attachments: VFS-524-v2.patch, VFS-524-v3.patch > > > I am using apache commons vfs2 to read and download file in ipv6 enviroment, > but it seems can't parse out ipv6 address correctly > The URI is just like: > ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test > The error message: > Invalid absolute URI "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Caused by : Expecting / to follow the hostname in URI > "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Deep into the code, I found the root cause is that HostFileNameParser's > extractHostName can't parse out the host name correctly > {noformat} > /** > * Extracts the hostname from a URI. The scheme://userinfo@ part has > * been removed. > */ > protected String extractHostName(final StringBuilder name) > { > final int maxlen = name.length(); > int pos = 0; > for (; pos < maxlen; pos++) > { > final char ch = name.charAt(pos); > if (ch == '/' || ch == ';' || ch == '?' || ch == ':' > || ch == '@' || ch == '&' || ch == '=' || ch == '+' > || ch == '$' || ch == ',') > { > break; > } > } > if (pos == 0) > { > return null; > } > final String hostname = name.substring(0, pos); > name.delete(0, pos); > return hostname; > } > {noformat} > From the code, we are able to know it will parse out the host name by colon, > but for ipv6, it will get a wrong host name > There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16195950#comment-16195950 ] David So commented on VFS-524: -- Hi. Version 2.2.1 & 2.2.2 did not list this issue as fixed in the readme. Is there an ETA? thanks > The uri include ipv6 address can't be parsed out correctly > -- > > Key: VFS-524 > URL: https://issues.apache.org/jira/browse/VFS-524 > Project: Commons VFS > Issue Type: Bug >Affects Versions: 2.0 >Reporter: Alex > Fix For: 2.2.1 > > Attachments: VFS-524-v2.patch, VFS-524-v3.patch > > > I am using apache commons vfs2 to read and download file in ipv6 enviroment, > but it seems can't parse out ipv6 address correctly > The URI is just like: > ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test > The error message: > Invalid absolute URI "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Caused by : Expecting / to follow the hostname in URI > "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Deep into the code, I found the root cause is that HostFileNameParser's > extractHostName can't parse out the host name correctly > {noformat} > /** > * Extracts the hostname from a URI. The scheme://userinfo@ part has > * been removed. > */ > protected String extractHostName(final StringBuilder name) > { > final int maxlen = name.length(); > int pos = 0; > for (; pos < maxlen; pos++) > { > final char ch = name.charAt(pos); > if (ch == '/' || ch == ';' || ch == '?' || ch == ':' > || ch == '@' || ch == '&' || ch == '=' || ch == '+' > || ch == '$' || ch == ',') > { > break; > } > } > if (pos == 0) > { > return null; > } > final String hostname = name.substring(0, pos); > name.delete(0, pos); > return hostname; > } > {noformat} > From the code, we are able to know it will parse out the host name by colon, > but for ipv6, it will get a wrong host name > There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14905278#comment-14905278 ] Bernd Eckenfels commented on VFS-524: - I think parsing is only half the work, the URLs should also be created with []. This testcase here should work (using a named interface scope and a non-default port): {code} name = (GenericFileName) urlParser.parseUri(null, null, "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330%em4]:/test;); assertEquals("2002:9ba:b4e:6:a052:5792:c0c9:2330%em4", name.getHostName()); assertEquals(, name.getPort()); assertEquals("ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330%em4]:/test;, name.getURI()); {code} getURI() could skip the brackets when it does not need port or scope, but I think adding it in all cases is better. I think it should not be returned by getHostName() (even when it makes the thing more complicated). > The uri include ipv6 address can't be parsed out correctly > -- > > Key: VFS-524 > URL: https://issues.apache.org/jira/browse/VFS-524 > Project: Commons VFS > Issue Type: Bug >Affects Versions: 2.0 >Reporter: Alex > Fix For: 2.1 > > Attachments: VFS-524-v2.patch > > > I am using apache commons vfs2 to read and download file in ipv6 enviroment, > but it seems can't parse out ipv6 address correctly > The URI is just like: > ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test > The error message: > Invalid absolute URI "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Caused by : Expecting / to follow the hostname in URI > "ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. > Deep into the code, I found the root cause is that HostFileNameParser's > extractHostName can't parse out the host name correctly > {noformat} > /** > * Extracts the hostname from a URI. The scheme://userinfo@ part has > * been removed. > */ > protected String extractHostName(final StringBuilder name) > { > final int maxlen = name.length(); > int pos = 0; > for (; pos < maxlen; pos++) > { > final char ch = name.charAt(pos); > if (ch == '/' || ch == ';' || ch == '?' || ch == ':' > || ch == '@' || ch == '&' || ch == '=' || ch == '+' > || ch == '$' || ch == ',') > { > break; > } > } > if (pos == 0) > { > return null; > } > final String hostname = name.substring(0, pos); > name.delete(0, pos); > return hostname; > } > {noformat} > From the code, we are able to know it will parse out the host name by colon, > but for ipv6, it will get a wrong host name > There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14494042#comment-14494042 ] Philipp Brügger commented on VFS-524: - The RFC 3986 [RFC 3986|http://tools.ietf.org/html/rfc3986] defines the usage of IPv6 adresses inside of brackets []. The following change of the method adds the extraction of IPv6 adresses: {code:title=HostFileNameParser.java|borderStyle=solid} protected String extractHostName(final StringBuilder name) { final int maxlen = name.length(); int startPos = 0; int endPos = 0; if(name.charAt(0) == '['){ //RFC-3986 IPv6address startPos = 1; for (; endPos maxlen; endPos++) { final char ch = name.charAt(endPos); if (ch == ']') { break; } } } else { for (; endPos maxlen; endPos++) { final char ch = name.charAt(endPos); if (ch == '/' || ch == ';' || ch == '?' || ch == ':' || ch == '@' || ch == '' || ch == '=' || ch == '+' || ch == '$' || ch == ',') { break; } } } if (endPos == 0) { return null; } final String hostname = name.substring(startPos, endPos); if(name.charAt(0) == '['){ //RFC-3986 IPv6address remove ']' at the end name.delete(0, endPos+1); } else { name.delete(0, endPos); } return hostname; } {code} Please add this feature of supporting IPv6 to the SVN or schedule this feature for a future release. The uri include ipv6 address can't be parsed out correctly -- Key: VFS-524 URL: https://issues.apache.org/jira/browse/VFS-524 Project: Commons VFS Issue Type: Bug Affects Versions: 2.0 Reporter: Alex Fix For: 2.1 I am using apache commons vfs2 to read and download file in ipv6 enviroment, but it seems can't parse out ipv6 address correctly The URI is just like: ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test The error message: Invalid absolute URI ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. Caused by : Expecting / to follow the hostname in URI ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. Deep into the code, I found the root cause is that HostFileNameParser's extractHostName can't parse out the host name correctly {noformat} /** * Extracts the hostname from a URI. The scheme://userinfo@ part has * been removed. */ protected String extractHostName(final StringBuilder name) { final int maxlen = name.length(); int pos = 0; for (; pos maxlen; pos++) { final char ch = name.charAt(pos); if (ch == '/' || ch == ';' || ch == '?' || ch == ':' || ch == '@' || ch == '' || ch == '=' || ch == '+' || ch == '$' || ch == ',') { break; } } if (pos == 0) { return null; } final String hostname = name.substring(0, pos); name.delete(0, pos); return hostname; } {noformat} From the code, we are able to know it will parse out the host name by colon, but for ipv6, it will get a wrong host name There is the same problem with the other protocol like sftp and cifs -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (VFS-524) The uri include ipv6 address can't be parsed out correctly
[ https://issues.apache.org/jira/browse/VFS-524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13991482#comment-13991482 ] Alex lee commented on VFS-524: -- I make some fix in order to the method into parse out ipv6, for ftp, it works well So could I fix FtpFileNameParser to overrides the extractHostName of HostFileNameParser? I am not sure whether it will bring in some problems else? Thanks a lot The uri include ipv6 address can't be parsed out correctly -- Key: VFS-524 URL: https://issues.apache.org/jira/browse/VFS-524 Project: Commons VFS Issue Type: Bug Affects Versions: 2.0 Reporter: Alex lee Fix For: 2.1 I am using apache commons vfs2 to read and download file in ipv6 enviroment, but it seems can't parse out ipv6 address correctly The URI is just like: ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test The error message: Invalid absolute URI ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. Caused by : Expecting / to follow the hostname in URI ftp://[2002:9ba:b4e:6:a052:5792:c0c9:2330]/test;. Deep into the code, I found the root cause is that HostFileNameParser's extractHostName can't parse out the host name correctly {noformat} /** * Extracts the hostname from a URI. The scheme://userinfo@ part has * been removed. */ protected String extractHostName(final StringBuilder name) { final int maxlen = name.length(); int pos = 0; for (; pos maxlen; pos++) { final char ch = name.charAt(pos); if (ch == '/' || ch == ';' || ch == '?' || ch == ':' || ch == '@' || ch == '' || ch == '=' || ch == '+' || ch == '$' || ch == ',') { break; } } if (pos == 0) { return null; } final String hostname = name.substring(0, pos); name.delete(0, pos); return hostname; } {noformat} From the code, we are able to know it will parse out the host name by colon, but for ipv6, it will get a wrong host name -- This message was sent by Atlassian JIRA (v6.2#6252)