nsIDNSService::myHostName contains broken hostname

RESOLVED INVALID

Status

()

Core
Networking
RESOLVED INVALID
8 years ago
8 years ago

People

(Reporter: Toni Ruottu, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.25 Safari/534.3
Build Identifier: 

the hostname can not be resolved into an ip address

Reproducible: Always

Steps to Reproduce:
1. write a Firefox extension in javascript
2. resolve nsIDNSService::myHostName

Actual Results:  
resolving fails as the given hostname does not exist

Expected Results:  
resolving succeeds and returns a set of addresses for the local network interfaces
There is no guarantee that a machine's hostname can get translated to an IP address (although usually that works). Furthermore, even when it works, you normally get a single address, which can be 127.0.0.1.

As filed, this bug is invalid. I can see how it would be nice to provide an API to enumerate all IP addresses of the host, but that doesn't currently exist and is a different issue.

(Why does your machine not have an entry for your hostname in /etc/hosts?)
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → INVALID
The /etc/hosts question was assuming you're on Linux, though maybe that was wrong - the user-agent disagrees with the os field?
fwiw, Mac OS X also has (and uses) an /etc/hosts.
You need to log in before you can comment on or make changes to this bug.