Waboodoo / HTTP-Shortcuts

Android app to create home screen shortcuts that trigger arbitrary HTTP requests
https://http-shortcuts.rmy.ch
MIT License
1.17k stars 113 forks source link

[BUG] IPv6 and port syntax does not work #291

Closed sredna closed 1 year ago

sredna commented 2 years ago

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:

Waboodoo commented 2 years ago

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

sredna commented 2 years ago

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)

Waboodoo commented 2 years ago

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 commented 1 year ago

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