Fwknop2
Fwknop2 copied to clipboard
Can't set IP resolver URL if it contains a path
- Tap the 3 dots in the main menu and go to Configure.
- Enter a URL containing a path (eg. https://example.com/ip).
- Click Save Settings.
You'll get an error "URL must be in the form of http://whatismyip.akamai.com or https://api.ipify.org".
There are two issues here:
- The error message text is incorrect. Fwknop2 does support custom URLs. I suggest changing the text to be something like "Please enter a valid URL".
- Validation fails if the URL contains a path component.
Here's the relevant code: https://github.com/jp-bennett/Fwknop2/blob/c15b66dc7b7f1c43f1cd917f3001eabcaf7dddd7/app/src/main/java/biz/incomsystems/fwknop2/GeneralConfigActivity.java#L55
The string being passed to the DomainValidator is just everything to the right of ://
. It likely needs to be split again on /
so it only gives the hostname to the DomainValidator. Actually, it should also check for a custom port by splitting on a colon if it exists. Come to think of it, perhaps this DomainValidator should be dropped in favour of a general URL validation library.
Yeah, Valid points. I'll get this fixed up.