Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve indication of API server address #2216

Merged
merged 1 commit into from
Jul 21, 2024
Merged

Conversation

dforsi
Copy link
Contributor

@dforsi dforsi commented Jul 20, 2024

The API server is accepting commands on port 8091 of all interfaces but the about dialog shows only 127.0.0.1:8091 and it is labeled as the address of the documentation:
image
and the log messages print an empty string as address:

2024-07-20 20:57:50.191 (I) WebAPIServer::start: starting web API server at http://:8091
2024-07-20 20:59:07.028 (I) WebAPIServer::stop: stopped web API server at http://:8091

This PR tries to improve the information about the IP address in tha About dialog changing the label and using the address 0.0.0.0 as used in in httplistener.cpp and according to the documentation at https://doc.qt.io/qt-6/qhostaddress.html#toString which says that QHostAddress::Any is indicated with the address 0.0.0.0 even if it is listening on both IPv4 and IPv6.
image

2024-07-20 22:13:34.488 (I) WebAPIServer::start: starting web API server at http://0.0.0.0:8091
2024-07-20 22:14:06.499 (I) WebAPIServer::stop: stopped web API server at http://0.0.0.0:8091

The problem is that using 0.0.0.0 and [::] in Firefox and Chrome work in Linux but not in Windows.
On Linux all the following addresses open the pages of the API server:

  1. http://127.0.0.1:8091/

  2. http://[::1]:8091/

  3. http://0.0.0.0:8091/

  4. http://[::]:8091/

plus any other address assigned to wired, wireless or virtual interfaces.
On Windows # 3 and # 4 give ERR_ADDRESS_INVALID.

An alternative would be print 0.0.0.0 in the log and 127.0.0.0 in the About dialog but adding something like "and other interfaces", maybe only on Windows.

The API server is listening on all interfaces. This is indicated by Qt
with the address 0.0.0.0 even if it is listening on both IPv4 and IPv6
https://doc.qt.io/qt-6/qhostaddress.html#toString
So the following addresses are valid
 http://127.0.0.1:8091/
 http://[::1]:8091/
 http://0.0.0.0:8091/
 http://[::]:8091/
plus any other address assigned to wired, wireless or virtual interfaces.
@f4exb f4exb merged commit 568b244 into f4exb:master Jul 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants