Commit 0aa5691d authored by Ted Zlatanov's avatar Ted Zlatanov
Browse files

(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.
parent 0d68d78e
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> 2008-02-25 John Wiegley <johnw@newartisans.com>
* url-auth.el (url-digest-auth): If the 'opaque' argument is not * url-auth.el (url-digest-auth): If the 'opaque' argument is not
......
...@@ -185,33 +185,10 @@ Will not do anything if `url-show-status' is nil." ...@@ -185,33 +185,10 @@ Will not do anything if `url-show-status' is nil."
;;;###autoload ;;;###autoload
(defun url-get-normalized-date (&optional specified-time) (defun url-get-normalized-date (&optional specified-time)
"Return a 'real' date string that most HTTP servers can understand." "Return a 'real' date string that most HTTP servers can understand."
(require 'timezone) (let ((system-time-locale "C"))
(let* ((raw (if specified-time (current-time-string specified-time) (format-time-string "%a, %d %b %Y %T GMT"
(current-time-string))) (or specified-time (current-time)) t)))
(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))
"]")))))
;;;###autoload ;;;###autoload
(defun url-eat-trailing-space (x) (defun url-eat-trailing-space (x)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment