[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: Forward: Bug#177243: w3m-el: cookies brokenfor Australian XEmacs users



Fumitoshi UKAI <ukai@debian.or.jp> さんは書きました:

> こういうbug reportがきたんですが、どうすればいいでしょうか?

I also had problems that the cookies always expired immediately
both with XEmacs 21.4.11 and Emacs 21.2.

I fixed it temporarily with the attached patch, but I'm not sure about
the best way to fix it.
diff -ru w3m_el-1.3.1.orig/w3m-cookie.el w3m_el-1.3.1/w3m-cookie.el
--- w3m_el-1.3.1.orig/w3m-cookie.el	2002-06-19 10:54:06.000000000 +0200
+++ w3m_el-1.3.1/w3m-cookie.el	2002-08-18 00:55:14.000000000 +0200
@@ -111,6 +111,17 @@
     (setf (w3m-cookie-ignore cookie)  (plist-get args :ignore))
     cookie))
 
+(defun w3m-cookie-expires-time-parse-string (string)
+  "Parse the time-string STRING and return its time as Emacs style."
+  (require 'parse-time)
+  (let* ((new-string (if (fboundp 'replace-in-string)
+			;; XEmacs
+			(replace-in-string string "-" " ")
+		      ;; Emacs
+		      (replace-regexp-in-string "-" " " string)))
+	(x (parse-time-string new-string)))
+    (encode-time (nth 0 x) (nth 1 x) (nth 2 x) (nth 3 x) (nth 4 x) (nth 5 x) 0)))
+
 (defun w3m-cookie-store (cookie)
   "Store COOKIE."
   (let (ignored)
@@ -147,7 +158,7 @@
     (dolist (c w3m-cookies)
       (if (and (w3m-cookie-expires c)
 	       (w3m-time-newer-p (current-time)
-				 (w3m-time-parse-string
+				 (w3m-cookie-expires-time-parse-string
 				  (w3m-cookie-expires c))))
 	  (push c expires)
 	(when (and (not (w3m-cookie-ignore c))
@@ -354,7 +365,7 @@
 	  ;; which is in the past.
 	  (when (and expires
 		     (w3m-time-newer-p (current-time)
-				       (w3m-time-parse-string expires)))
+				       (w3m-cookie-expires-time-parse-string expires)))
 	    (w3m-cookie-remove domain path (car elem)))
 	  (w3m-cookie-store
 	   (w3m-cookie-create :url url
@@ -410,7 +421,7 @@
   (let (cookies)
     (dolist (cookie w3m-cookies)
       (when (and (w3m-cookie-expires cookie)
-		 (w3m-time-newer-p (w3m-time-parse-string
+		 (w3m-time-newer-p (w3m-cookie-expires-time-parse-string
 				    (w3m-cookie-expires cookie))
 				   (current-time)))
 	(push cookie cookies)))
-- 
Mike Fabian   <mfabian@suse.de>   http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。