diff options
| author | Teodor Zlatanov | 2008-02-28 19:41:44 +0000 |
|---|---|---|
| committer | Teodor Zlatanov | 2008-02-28 19:41:44 +0000 |
| commit | 0aa5691d5ef20e6fcc5ce40d0e85e596c92162ab (patch) | |
| tree | d29c3e8b8de28b5fdffa37d29efba64d21b6940d | |
| parent | 0d68d78e486763ad4e5722cf56894f2bde31d2b1 (diff) | |
| download | emacs-0aa5691d5ef20e6fcc5ce40d0e85e596c92162ab.tar.gz emacs-0aa5691d5ef20e6fcc5ce40d0e85e596c92162ab.zip | |
(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.
| -rw-r--r-- | lisp/url/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/url/url-util.el | 31 |
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 @@ | |||
| 1 | 2008-02-28 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * url-util.el (url-get-normalized-date): Simplify | ||
| 4 | to use `format-time-string'. Always generate date in UTC, but | ||
| 5 | call it GMT for full compatibility with the RFCs. | ||
| 6 | |||
| 1 | 2008-02-25 John Wiegley <johnw@newartisans.com> | 7 | 2008-02-25 John Wiegley <johnw@newartisans.com> |
| 2 | 8 | ||
| 3 | * url-auth.el (url-digest-auth): If the 'opaque' argument is not | 9 | * 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." | |||
| 185 | 185 | ||
| 186 | ;;;###autoload | 186 | ;;;###autoload |
| 187 | (defun url-get-normalized-date (&optional specified-time) | 187 | (defun url-get-normalized-date (&optional specified-time) |
| 188 | "Return a 'real' date string that most HTTP servers can understand." | 188 | "Return a 'real' date string that most HTTP servers can understand." |
| 189 | (require 'timezone) | 189 | (let ((system-time-locale "C")) |
| 190 | (let* ((raw (if specified-time (current-time-string specified-time) | 190 | (format-time-string "%a, %d %b %Y %T GMT" |
| 191 | (current-time-string))) | 191 | (or specified-time (current-time)) t))) |
| 192 | (gmt (timezone-make-date-arpa-standard raw | ||
| 193 | (current-time-zone) | ||
| 194 | "GMT")) | ||
| 195 | (parsed (timezone-parse-date gmt)) | ||
| 196 | (day (cdr-safe (assoc (substring raw 0 3) url-weekday-alist))) | ||
| 197 | (year nil) | ||
| 198 | (month (car | ||
| 199 | (rassoc | ||
| 200 | (string-to-number (aref parsed 1)) url-monthabbrev-alist))) | ||
| 201 | ) | ||
| 202 | (setq day (or (car-safe (rassoc day url-weekday-alist)) | ||
| 203 | (substring raw 0 3)) | ||
| 204 | year (aref parsed 0)) | ||
| 205 | ;; This is needed for plexus servers, or the server will hang trying to | ||
| 206 | ;; parse the if-modified-since header. Hopefully, I can take this out | ||
| 207 | ;; soon. | ||
| 208 | (if (and year (> (length year) 2)) | ||
| 209 | (setq year (substring year -2 nil))) | ||
| 210 | |||
| 211 | (concat day ", " (aref parsed 2) "-" month "-" year " " | ||
| 212 | (aref parsed 3) " " (or (aref parsed 4) | ||
| 213 | (concat "[" (nth 1 (current-time-zone)) | ||
| 214 | "]"))))) | ||
| 215 | 192 | ||
| 216 | ;;;###autoload | 193 | ;;;###autoload |
| 217 | (defun url-eat-trailing-space (x) | 194 | (defun url-eat-trailing-space (x) |