Closed Bug 85210 Opened 23 years ago Closed 23 years ago

Cookies are not stored when viewing pages on loopback address

Categories

(Core :: Networking: Cookies, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 83625

People

(Reporter: hinayani, Assigned: morse)

References

()

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.1) Gecko/20010607
BuildID:    2001060703

Trying to save variables in cookies using PHP will not work if you are testing
your scripts on localhost (i.e. http://127.0.0.1/foo.php). Using sessions will
also not work very well since PHP tries to save some information in a cookie.

When uploading the scripts to the remote server, or when filling in your own IP
explicitly (instead of 127.0.0.1), the cookies get saved without any problems.

Reproducible: Always
Steps to Reproduce:
1. Create a file cookie1.php with this code:
   <?
      setcookie("TestCookie", "SomeContent", time()+3600);
   ?>
   This will store a cookie with the name TestCookie that will expire in one hour.

2. Create a file cookie2.php with this code:
   <?
   if (isset($TestCookie)) {
	print "cookie found";
   } else {
	print "cookie not found";
   }
   ?>

3. Visit http://127.0.0.1/foo/cookie1.php . This should normally store the
cookie, so you can use its value in another script.

4. Visit http://127.0.0.1/foo/cookie2.php. Normally, the script should be able
to find the content of the cookie. When using the localhost however, the cookie
is not stored.

5. Try your real IP, f.e. http://195.130.132.84/foo/cookie1.php and then
http://195.130.132.84/foo/cookie2.php and the second page should be able to read
the cookie.

Actual Results:  When you use the localhost, no cookie is set, and no cookie
will appear in the "Saved cookies list" in preferences-cookies.
When you use your real (or external) IP, the cookie is set, and appears in the
"Saved cookies list".

Expected Results:  The cookie should also be stored on the localhost.

It appears that a Mozilla 0.9 build of May 5 (2001050515) did store the cookie
correctly and did not produce this fault. The next build I had from Mozilla 0.9
was 2001052708. This version however did not store the cookie either.
Sounds like it might be a dup of bug 83625, based on the dates of when the 
reporter said it occurred (bug 83625 was due to a regression introduced on May 
11).  Marking it as a dup although I could be wrong.  Reporter, please retest 
with a build after today (I'll be checking in the fix today) and if problem 
still occurs, then reopen this report.

*** This bug has been marked as a duplicate of 83625 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
Summary: Cookies are not stored when viewing pages on localhost → Cookies are not stored when viewing pages on loopback address
V/dupe.
Status: RESOLVED → VERIFIED
QA Contact: tever → benc
You need to log in before you can comment on or make changes to this bug.