HTTP-Shortcuts icon indicating copy to clipboard operation
HTTP-Shortcuts copied to clipboard

[BUG] IPv6 and port syntax does not work

Open sredna opened this issue 3 years ago • 3 comments

Steps To Reproduce

  1. Set Url of a shortcut to http://[fe80:12:34::1]:8080/whatever
  2. Execute shortcut

Expected behavior Request sent to fe80:12:34::1 on port 8080

Actual behavior Unable to parse RFC2732 Url and fails to connect.

Chrome on my phone cannot access the Url either so it might be a deeper Android issue. Chrome at least gives an error that makes sense instead of parts of a failed Url parse attempt.

Context:

  • Android OS Version: 9
  • App Version 2.21.1
  • Only tested on Wi-Fi and the phone has IPv4&6 addresses according to Wi-Fi settings but the IPv6 address is a fe80:... address (link-local)
  • Computers on the same LAN can access the test computer by IPv6 successfully

sredna avatar Aug 29 '22 00:08 sredna

Could you post a screenshot of how this error manifests for you in the app?

Waboodoo avatar Aug 29 '22 20:08 Waboodoo

Given http://[fe80:12...89]:8080/whatever it says:

SHORTCUTNAME failed: Failed to connect to /fe80:12...89:8080

(I replaced parts of the IP with .... The app added the slash at the front)

sredna avatar Aug 30 '22 02:08 sredna

It appears that this is due to a bug in the underlying android.net.Uri class, which makes it unable to parse the host of an IPv6 address correctly. This bug was fixed in Android SDK version 29, i.e., Android 10, which would explain why you are still experiencing this bug on Android 9. I suspect Chrome might be having a similar issue on your device then, as it likely uses the same code under the hood.

To fix this for older versions of Android would require quite some workarounds in the app's code, and there'd be no guarantee that it would work, as some of the libraries in use might also be affected by this bug. As such, I'll leave this as it is for now, unless I find a better solution somehow.

Waboodoo avatar Aug 30 '22 15:08 Waboodoo

I can no longer reproduce this issue now and will therefore close it.

Waboodoo avatar Aug 25 '23 18:08 Waboodoo