Good questions.

> What if the device is behind a wireless network hub? Would the HOST reflect the external IP, and the gethostbyaddr the internal?

`HTTP_HOST` would be either the external IP, or the hostname/domain name. Basically, whatever was showing in the browser's address bar, I believe. And `REMOTE_ADDR` is the browser's IP address.

`gethostbyaddr` is just the way I found to resolve the hostname into an IP address, which might still be the external IP address. In general, this is fine, since if it's being accessed through a router, then it's not a loopback connection anyway, and that's what will be returned here. However, in checking into it further now, it looks like if the external IP is on a different subnet, then `gethostbyaddr` can actually fail, so I should put some try/except logic in here. Or I could just simplify it (especially since `gethostbyaddr` can take some time to resolve) and just assume that users won't be accessing their own machine (from itself) via a domain name (and just hardcode "localhost" as another reference).

> Also, is it possible for devices to have multiple connections (multiple ethernet, ethernet and wireless, etc)?

Yes, but for loopback connections (from my testing) it seems to put whatever IP address is used in the `HTTP_HOST` as the `REMOTE_ADDR` as well (so if the user enters 127.0.0.1 into the address bar, it will show 127.0.0.1 for `REMOTE_ADDR`, and if they instead access it, still locally, from the external IP address, then it will show that external IP for `REMOTE_ADDR` as well, which is what allows line 85 to work).