From 8cfaba536a0987d9ce29c49f7b525604dbed8893 Mon Sep 17 00:00:00 2001
From: hniksic <devnull@localhost>
Date: Sat, 8 Nov 2003 14:32:52 -0800
Subject: [PATCH] [svn] Specify exact domain match on cookies that don't
 specify domain.

---
 src/ChangeLog | 5 +++++
 src/cookies.c | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 5c1613b3..b4ef0b10 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2003-11-08  Hrvoje Niksic  <hniksic@xemacs.org>
+
+	* cookies.c (cookie_handle_set_cookie): Specify exact match for
+	unspecified domains.
+
 2003-11-08  Hrvoje Niksic  <hniksic@xemacs.org>
 
 	* main.c (main): Removed one-letter options `-C', `-g', `-G', and
diff --git a/src/cookies.c b/src/cookies.c
index 599d2daa..a88aa2ad 100644
--- a/src/cookies.c
+++ b/src/cookies.c
@@ -848,8 +848,13 @@ cookie_handle_set_cookie (struct cookie_jar *jar,
   if (!cookie->domain)
     {
     copy_domain:
+      /* If the domain was not provided, we use the one we're talking
+	 to, and set exact match.  */
       cookie->domain = xstrdup (host);
-      cookie->port = port;
+      cookie->domain_exact = 1;
+      /* Set the port, but only if it's non-default. */
+      if (port != 80 && port != 443)
+	cookie->port = port;
     }
   else
     {