Closed Bug 195823 Opened 21 years ago Closed 21 years ago

DNS: (Mac OS) ignores /etc/hosts when disconnected

Categories

(Core :: Networking, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 194476

People

(Reporter: danial, Assigned: dougt)

References

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3b) Gecko/20030212
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3b) Gecko/20030212

If I put www.foo.dev in my hosts file, and unplug from the network, mozilla
seems to ignore the fact that the site should be considered local.

It does seem weird that it works fine if I am plugged into the network and have
a valid IP returned by the DHCP server.

It seems to work fine in *cough* explorer.

Reproducible: Always

Steps to Reproduce:
1. Put www.foo.dev in your hosts file
2. Unlplug from any networks you might be on
3. Change your location to an automatic setting, so that your IP is released
4. ping www.foo.dev from the command line, just to make sure it works
5. Turn proxies off in mozilla and in system preferences
6. Restart mozilla
7. Try to view www.foo.dev
Actual Results:  
Could not contact host www.foo.dev

Expected Results:  
Should have been able to resolve www.foo.dev as 127.0.0.1

I am using a Powerbook G4

Initial thought was bug might be related to bug #160091, but after more testing,
I am pretty sure it has nothing to do with proxy settings.
May be a duplicate bug, check #186453
Danial, do any other browsers such as Safari, Opera, or IE behave differently?
Summary: Not honouring /etc/hosts when unplugged form network → Not honouring /etc/hosts when unplugged from network
Other browser behave correctly.

IE works fine, Safari works fine, lynx works fine. I don't have Opera installed.

Would you like me to confirm if it is a bug on earlier versions? eg: 1.2 beta or
something?

I'm downloading the nightly build now to see if it's still an issue. It's gonna
take half hour or so though, currently experiencing some traffic shaping issues :(
Just tested on current nightly build for Mac OS X. It's still a problem.
Summary: Not honouring /etc/hosts when unplugged from network → DNS: Not honouring /etc/hosts when unplugged from network
Mozilla never reads /etc/hosts, it just uses the OS-routines to look up a name.
/etc/hosts is just one of the many locations that has to be checked (DNS,
Netinfo, ...). There's also an internal cache in Mozilla (see bug 162871), but
restarting Mozilla should have cleared that.
*** Bug 204955 has been marked as a duplicate of this bug. ***
*** Bug 215641 has been marked as a duplicate of this bug. ***
*** Bug 186453 has been marked as a duplicate of this bug. ***
Confirming because of dupes.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: MacOS X → All
Hardware: Macintosh → All
User Agent:  Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/
20030916
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/
20030916

Still present in v1.5rc running on OS X v10.2.6

I made up my own TopLevelDomain called .site and made an httpd.conf VirtualHost for 
each so I can develop fully locally.
Example: a website that publicly sits at http://specialprojects.nucdc.org also runs locally 
on my machine for development purposes as http://specialprojects.nucdc.site

Safari 1.0 (v85), and IE 5.2.2 (5010.1) work fine.
With these browsers, if I disconnect from the network (all networks, even dial-up) and 
have a machine completely local, I launch a web-browser and point it at any of the sites 
I've defined in my httpd.conf file as legitimate VirtualHosts. I even tried helping Mozilla 
v1.5 by making an entry in my /etc/hosts file as follows
127.0.0.1  specialprojects.nucdc.site
(with no discernable improvement).

Mozilla should be made to query the NetInfo /machines for address values before 
querying the web. Incorrect? If the last above entry on this bug is a final answer, then why 
are the other browsers still working fine?
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5; MultiZilla
v1.5.0.3a) Gecko/20030925

Workaround :
you can get sites served by localhost to work by doing this:
open just one of your locally served sites in Mozilla and !then! disconnect from
the net.

Further comments:
It's suffcient to just load http://localhost - then all of the locally served
virtual hosts will work.
It's sufficent to have loaded http://localhost just once during the session -
you can close all windows showing locally served virtual sites and then open
them again after having disconnected.
It's not sufficient to start Moz with an active connection - you !must! load the
locally served page before disconnecting.
(I've looked at all the related bugs before making this change)

*** This bug has been marked as a duplicate of 194476 ***
Status: NEW → RESOLVED
Closed: 21 years ago
Keywords: verifyme
OS: All → MacOS X
Hardware: All → Macintosh
Resolution: --- → DUPLICATE
Summary: DNS: Not honouring /etc/hosts when unplugged from network → DNS: (Mac OS) ignores /etc/hosts when disconnected
verified.
Status: RESOLVED → VERIFIED
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.