summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorTeodor Zlatanov <tzz@lifelogs.com>2008-02-28 19:41:44 +0000
committerTeodor Zlatanov <tzz@lifelogs.com>2008-02-28 19:41:44 +0000
commit0aa5691d5ef20e6fcc5ce40d0e85e596c92162ab (patch)
treed29c3e8b8de28b5fdffa37d29efba64d21b6940d /lisp
parent0d68d78e486763ad4e5722cf56894f2bde31d2b1 (diff)
downloademacs-0aa5691d5ef20e6fcc5ce40d0e85e596c92162ab.tar.gz
(url-get-normalized-date): Simplify
to use `format-time-string'. Always generate date in UTC, but call it GMT for full compatibility with the RFCs.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/url/ChangeLog6
-rw-r--r--lisp/url/url-util.el31
2 files changed, 10 insertions, 27 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index c7d0de58c81..d2c32afc204 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-28 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * url-util.el (url-get-normalized-date): Simplify
+ to use `format-time-string'. Always generate date in UTC, but
+ call it GMT for full compatibility with the RFCs.
+
2008-02-25 John Wiegley <johnw@newartisans.com>
* url-auth.el (url-digest-auth): If the 'opaque' argument is not
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index a1b68099e89..612d7445215 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -185,33 +185,10 @@ Will not do anything if `url-show-status' is nil."
;;;###autoload
(defun url-get-normalized-date (&optional specified-time)
- "Return a 'real' date string that most HTTP servers can understand."
- (require 'timezone)
- (let* ((raw (if specified-time (current-time-string specified-time)
- (current-time-string)))
- (gmt (timezone-make-date-arpa-standard raw
- (current-time-zone)
- "GMT"))
- (parsed (timezone-parse-date gmt))
- (day (cdr-safe (assoc (substring raw 0 3) url-weekday-alist)))
- (year nil)
- (month (car
- (rassoc
- (string-to-number (aref parsed 1)) url-monthabbrev-alist)))
- )
- (setq day (or (car-safe (rassoc day url-weekday-alist))
- (substring raw 0 3))
- year (aref parsed 0))
- ;; This is needed for plexus servers, or the server will hang trying to
- ;; parse the if-modified-since header. Hopefully, I can take this out
- ;; soon.
- (if (and year (> (length year) 2))
- (setq year (substring year -2 nil)))
-
- (concat day ", " (aref parsed 2) "-" month "-" year " "
- (aref parsed 3) " " (or (aref parsed 4)
- (concat "[" (nth 1 (current-time-zone))
- "]")))))
+ "Return a 'real' date string that most HTTP servers can understand."
+ (let ((system-time-locale "C"))
+ (format-time-string "%a, %d %b %Y %T GMT"
+ (or specified-time (current-time)) t)))
;;;###autoload
(defun url-eat-trailing-space (x)