-
Notifications
You must be signed in to change notification settings - Fork 0
Built in HTTP server
The built-in mini HTTP server is light and simple.
It provides a low-delay access to the latest data, as a JavaScript object or as a JSON object.
As it does not provide access to any file on your computer, there should be no safety issue by design.
It should be compliant enough with HTTP/1.0.
No virtual hosts are used. The specified host name in your browser does not matter to the HTTP server.
It is the address you want to bind the HTTP server to.
You can enter the IP address of an interface or special values local
(IPv4 loopback 127.0.0.1
), local6
(IPv6 loopback ::1
) and any
(all interfaces in IPv4 and IPv6).
Leaving this field empty is equivalent to any
.
That is the port number. If you have a conflict, you can change it.
Check the box if you want the HTTP server to start when the program starts.
For every GPSD client in the program, you can set:
This is the URI without the /
prefix and without extension.
Of course, make sure that it is not duplicated with that of another GPSD client.
Examples:
-
default
=>http://localhost:42317/default.js
orhttp://localhost/default.json
-
gps1/data
=>http://localhost:42317/gps1/data.js
orhttp://localhost/gps1/data.json
This is the delay before unrefreshed data become obsolete.
After this delay, the HTTP server will return a 504 Gateway Time-out
status.
You can set it to 0.0 so that data never expire.
If you do not want the JavaScript object alone, you can enter the name of the function to be called with the JavaScript object as an argument.
The HTTP status indicates what happened while treating a request.
The built-in HTTP server has a limited set of statuses. It should be complete enough though.
-
200 OK
- We have a success here! -
400 Bad Request
- There is no way that the received request was a valid HTTP request. -
404 Not Found
- The requested address is not valid, wrong path or wrong extension. -
405 Method Not Allowed
- Only GET HTTP requests are accepted, sorry. -
503 Service Unavailable
- The matching GPSD client is stopped. -
504 Gateway Time-out
- Latest information has expired, or no information is available yet.
Well, running an HTTP server still suggests some recommendations:
- Avoid giving public access to it, especially because output contains your location and because the program can crash!
- Minimize the program in tray. This reduces the CPU usage.
- Do not bind to all interfaces if you know that the loopback interface is enough.
- Do not consider the built-in HTTP server as super strong, even though it is not weak.