diff options
| author | Miles Bader | 2006-10-15 02:54:13 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-10-15 02:54:13 +0000 |
| commit | bb9c4b4f8b3dcd1b5fc96d2d0275cc532832fbd6 (patch) | |
| tree | 8c4ae9640abcb8f33326e96e661f711417e5307c /lisp/url | |
| parent | 5be4d5336db8be316100a5b80ee8c5e428438b9e (diff) | |
| parent | 92edaeeda5c362acf2c7e7f72b3666ab7673699a (diff) | |
| download | emacs-bb9c4b4f8b3dcd1b5fc96d2d0275cc532832fbd6.tar.gz emacs-bb9c4b4f8b3dcd1b5fc96d2d0275cc532832fbd6.zip | |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 460-475)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 145-152)
- Merge from emacs--devo--0
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-118
Diffstat (limited to 'lisp/url')
| -rw-r--r-- | lisp/url/ChangeLog | 112 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 35 | ||||
| -rw-r--r-- | lisp/url/url-https.el | 56 | ||||
| -rw-r--r-- | lisp/url/url-parse.el | 49 |
4 files changed, 110 insertions, 142 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index a6afb0ba20f..2aa14af8983 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2006-10-12 Magnus Henoch <mange@freemail.hu> | ||
| 2 | |||
| 3 | * url-http.el (url-http-find-free-connection): Handle | ||
| 4 | url-open-stream returning nil. | ||
| 5 | |||
| 6 | 2006-10-11 Magnus Henoch <mange@freemail.hu> | ||
| 7 | |||
| 8 | * url-https.el: Remove (clashes with url-http on 8+3 systems). | ||
| 9 | |||
| 10 | * url-http.el: Move contents of url-https.el here. Add autoloads. | ||
| 11 | |||
| 12 | 2006-10-09 Magnus Henoch <mange@freemail.hu> | ||
| 13 | |||
| 14 | * url-parse.el (url-generic-parse-url): Handle URLs with empty | ||
| 15 | path component and non-empty query component. Untangle path, | ||
| 16 | query and fragment parsing code. Add references to RFC 3986 in | ||
| 17 | comments. | ||
| 18 | (url-recreate-url-attributes): Start query string with "?", not ";". | ||
| 19 | |||
| 1 | 2006-09-20 Stefan Monnier <monnier@iro.umontreal.ca> | 20 | 2006-09-20 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 21 | ||
| 3 | * url-dav.el (url-dav-file-attributes): Simplify. | 22 | * url-dav.el (url-dav-file-attributes): Simplify. |
| @@ -420,32 +439,19 @@ | |||
| 420 | 439 | ||
| 421 | 2004-10-10 Lars Hansen <larsh@math.ku.dk> | 440 | 2004-10-10 Lars Hansen <larsh@math.ku.dk> |
| 422 | 441 | ||
| 423 | * url-auth.el: Update header and footer. | 442 | * url-auth.el: |
| 424 | 443 | * url-cache.el: | |
| 425 | * url-cache.el: Update header and footer. | 444 | * url-cid.el: |
| 426 | 445 | * url-dired.el: | |
| 427 | * url-cid.el: Update header and footer. | 446 | * url-expand.el: |
| 428 | 447 | * url-ftp.el: | |
| 429 | * url-dired.el: Update header and footer. | 448 | * url-gw.el: |
| 430 | 449 | * url-imap.el: | |
| 431 | * url-expand.el: Update header and footer. | 450 | * url-irc.el: |
| 432 | 451 | * url-misc.el: | |
| 433 | * url-ftp.el: Update header and footer. | 452 | * url-news.el: |
| 434 | 453 | * url-ns.el: | |
| 435 | * url-gw.el: Update header and footer. | 454 | * url-privacy.el: |
| 436 | |||
| 437 | * url-imap.el: Update header and footer. | ||
| 438 | |||
| 439 | * url-irc.el: Update header and footer. | ||
| 440 | |||
| 441 | * url-misc.el: Update header and footer. | ||
| 442 | |||
| 443 | * url-news.el: Update header and footer. | ||
| 444 | |||
| 445 | * url-ns.el: Update header and footer. | ||
| 446 | |||
| 447 | * url-privacy.el: Update header and footer. | ||
| 448 | |||
| 449 | * url-proxy.el: Update header and footer. | 455 | * url-proxy.el: Update header and footer. |
| 450 | 456 | ||
| 451 | * url-vars.el: Update header. | 457 | * url-vars.el: Update header. |
| @@ -490,42 +496,24 @@ | |||
| 490 | 496 | ||
| 491 | 2004-10-10 Lars Hansen <larsh@math.ku.dk> | 497 | 2004-10-10 Lars Hansen <larsh@math.ku.dk> |
| 492 | 498 | ||
| 493 | * url-auth.el: Fix copyright notice. | 499 | * url-auth.el: |
| 494 | 500 | * url-cache.el: | |
| 495 | * url-cache.el: Fix copyright notice. | 501 | * url-cookie.el: |
| 496 | 502 | * url-dired.el: | |
| 497 | * url-cookie.el: Fix copyright notice. | 503 | * url-file.el: |
| 498 | 504 | * url-ftp.el: | |
| 499 | * url-dired.el: Fix copyright notice. | 505 | * url-handlers.el: |
| 500 | 506 | * url-history.el: | |
| 501 | * url-file.el: Fix copyright notice. | 507 | * url-irc.el: |
| 502 | 508 | * url-mailto.el: | |
| 503 | * url-ftp.el: Fix copyright notice. | 509 | * url-methods.el: |
| 504 | 510 | * url-misc.el: | |
| 505 | * url-handlers.el: Fix copyright notice. | 511 | * url-news.el: |
| 506 | 512 | * url-nfs.el: | |
| 507 | * url-history.el: Fix copyright notice. | 513 | * url-parse.el: |
| 508 | 514 | * url-privacy.el: | |
| 509 | * url-irc.el: Fix copyright notice. | 515 | * url-vars.el: |
| 510 | 516 | * url.el: | |
| 511 | * url-mailto.el: Fix copyright notice. | ||
| 512 | |||
| 513 | * url-methods.el: Fix copyright notice. | ||
| 514 | |||
| 515 | * url-misc.el: Fix copyright notice. | ||
| 516 | |||
| 517 | * url-news.el: Fix copyright notice. | ||
| 518 | |||
| 519 | * url-nfs.el: Fix copyright notice. | ||
| 520 | |||
| 521 | * url-parse.el: Fix copyright notice. | ||
| 522 | |||
| 523 | * url-privacy.el: Fix copyright notice. | ||
| 524 | |||
| 525 | * url-vars.el: Fix copyright notice. | ||
| 526 | |||
| 527 | * url.el: Fix copyright notice. | ||
| 528 | |||
| 529 | * url-util.el: Fix copyright notice. | 517 | * url-util.el: Fix copyright notice. |
| 530 | 518 | ||
| 531 | 2004-10-06 Stefan Monnier <monnier@iro.umontreal.ca> | 519 | 2004-10-06 Stefan Monnier <monnier@iro.umontreal.ca> |
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 1b8bc459f49..bf8069ded7e 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -123,8 +123,10 @@ request.") | |||
| 123 | ;; like authentication. But we use another buffer afterwards. | 123 | ;; like authentication. But we use another buffer afterwards. |
| 124 | (unwind-protect | 124 | (unwind-protect |
| 125 | (let ((proc (url-open-stream host buf host port))) | 125 | (let ((proc (url-open-stream host buf host port))) |
| 126 | ;; Drop the temp buffer link before killing the buffer. | 126 | ;; url-open-stream might return nil. |
| 127 | (set-process-buffer proc nil) | 127 | (when (processp proc) |
| 128 | ;; Drop the temp buffer link before killing the buffer. | ||
| 129 | (set-process-buffer proc nil)) | ||
| 128 | proc) | 130 | proc) |
| 129 | (kill-buffer buf))))))) | 131 | (kill-buffer buf))))))) |
| 130 | 132 | ||
| @@ -1245,6 +1247,35 @@ p3p | |||
| 1245 | (if buffer (kill-buffer buffer)) | 1247 | (if buffer (kill-buffer buffer)) |
| 1246 | options)) | 1248 | options)) |
| 1247 | 1249 | ||
| 1250 | ;; HTTPS. This used to be in url-https.el, but that file collides | ||
| 1251 | ;; with url-http.el on systems with 8-character file names. | ||
| 1252 | (require 'tls) | ||
| 1253 | |||
| 1254 | ;;;###autoload | ||
| 1255 | (defconst url-https-default-port 443 "Default HTTPS port.") | ||
| 1256 | ;;;###autoload | ||
| 1257 | (defconst url-https-asynchronous-p t "HTTPS retrievals are asynchronous.") | ||
| 1258 | ;;;###autoload | ||
| 1259 | (defalias 'url-https-expand-file-name 'url-http-expand-file-name) | ||
| 1260 | |||
| 1261 | (defmacro url-https-create-secure-wrapper (method args) | ||
| 1262 | `(defun ,(intern (format (if method "url-https-%s" "url-https") method)) ,args | ||
| 1263 | ,(format "HTTPS wrapper around `%s' call." (or method "url-http")) | ||
| 1264 | (let ((url-gateway-method (condition-case () | ||
| 1265 | (require 'ssl) | ||
| 1266 | (error 'tls)))) | ||
| 1267 | (,(intern (format (if method "url-http-%s" "url-http") method)) | ||
| 1268 | ,@(remove '&rest (remove '&optional args)))))) | ||
| 1269 | |||
| 1270 | ;;;###autoload (autoload 'url-https "url-http") | ||
| 1271 | (url-https-create-secure-wrapper nil (url callback cbargs)) | ||
| 1272 | ;;;###autoload (autoload 'url-https-file-exists-p "url-http") | ||
| 1273 | (url-https-create-secure-wrapper file-exists-p (url)) | ||
| 1274 | ;;;###autoload (autoload 'url-https-file-readable-p "url-http") | ||
| 1275 | (url-https-create-secure-wrapper file-readable-p (url)) | ||
| 1276 | ;;;###autoload (autoload 'url-https-file-attributes "url-http") | ||
| 1277 | (url-https-create-secure-wrapper file-attributes (url &optional id-format)) | ||
| 1278 | |||
| 1248 | (provide 'url-http) | 1279 | (provide 'url-http) |
| 1249 | 1280 | ||
| 1250 | ;; arch-tag: ba7c59ae-c0f4-4a31-9617-d85f221732ee | 1281 | ;; arch-tag: ba7c59ae-c0f4-4a31-9617-d85f221732ee |
diff --git a/lisp/url/url-https.el b/lisp/url/url-https.el deleted file mode 100644 index a7440a76535..00000000000 --- a/lisp/url/url-https.el +++ /dev/null | |||
| @@ -1,56 +0,0 @@ | |||
| 1 | ;;; url-https.el --- HTTP over SSL/TLS routines | ||
| 2 | |||
| 3 | ;; Copyright (C) 1999, 2004, 2005, 2006 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Keywords: comm, data, processes | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | ;; | ||
| 9 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 12 | ;; any later version. | ||
| 13 | ;; | ||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | ;; | ||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 21 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| 22 | ;; Boston, MA 02110-1301, USA. | ||
| 23 | |||
| 24 | ;;; Commentary: | ||
| 25 | |||
| 26 | ;;; Code: | ||
| 27 | |||
| 28 | (require 'url-gw) | ||
| 29 | (require 'url-util) | ||
| 30 | (require 'url-parse) | ||
| 31 | (require 'url-cookie) | ||
| 32 | (require 'url-http) | ||
| 33 | (require 'tls) | ||
| 34 | |||
| 35 | (defconst url-https-default-port 443 "Default HTTPS port.") | ||
| 36 | (defconst url-https-asynchronous-p t "HTTPS retrievals are asynchronous.") | ||
| 37 | (defalias 'url-https-expand-file-name 'url-http-expand-file-name) | ||
| 38 | |||
| 39 | (defmacro url-https-create-secure-wrapper (method args) | ||
| 40 | `(defun ,(intern (format (if method "url-https-%s" "url-https") method)) ,args | ||
| 41 | ,(format "HTTPS wrapper around `%s' call." (or method "url-http")) | ||
| 42 | (let ((url-gateway-method (condition-case () | ||
| 43 | (require 'ssl) | ||
| 44 | (error 'tls)))) | ||
| 45 | (,(intern (format (if method "url-http-%s" "url-http") method)) | ||
| 46 | ,@(remove '&rest (remove '&optional args)))))) | ||
| 47 | |||
| 48 | (url-https-create-secure-wrapper nil (url callback cbargs)) | ||
| 49 | (url-https-create-secure-wrapper file-exists-p (url)) | ||
| 50 | (url-https-create-secure-wrapper file-readable-p (url)) | ||
| 51 | (url-https-create-secure-wrapper file-attributes (url &optional id-format)) | ||
| 52 | |||
| 53 | (provide 'url-https) | ||
| 54 | |||
| 55 | ;; arch-tag: c3645ac5-c248-4d12-ad41-7c4b6f7b6d19 | ||
| 56 | ;;; url-https.el ends here | ||
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el index 1e4d93a861e..2e4fc8a9f27 100644 --- a/lisp/url/url-parse.el +++ b/lisp/url/url-parse.el | |||
| @@ -108,7 +108,7 @@ | |||
| 108 | (defun url-recreate-url-attributes (urlobj) | 108 | (defun url-recreate-url-attributes (urlobj) |
| 109 | "Recreate the attributes of an URL string from the parsed URLOBJ." | 109 | "Recreate the attributes of an URL string from the parsed URLOBJ." |
| 110 | (when (url-attributes urlobj) | 110 | (when (url-attributes urlobj) |
| 111 | (concat ";" | 111 | (concat "?" |
| 112 | (mapconcat (lambda (x) | 112 | (mapconcat (lambda (x) |
| 113 | (if (cdr x) | 113 | (if (cdr x) |
| 114 | (concat (car x) "=" (cdr x)) | 114 | (concat (car x) "=" (cdr x)) |
| @@ -120,11 +120,16 @@ | |||
| 120 | "Return a vector of the parts of URL. | 120 | "Return a vector of the parts of URL. |
| 121 | Format is: | 121 | Format is: |
| 122 | \[TYPE USER PASSWORD HOST PORT FILE TARGET ATTRIBUTES FULL\]" | 122 | \[TYPE USER PASSWORD HOST PORT FILE TARGET ATTRIBUTES FULL\]" |
| 123 | ;; See RFC 3986. | ||
| 123 | (cond | 124 | (cond |
| 124 | ((null url) | 125 | ((null url) |
| 125 | (make-vector 9 nil)) | 126 | (make-vector 9 nil)) |
| 126 | ((or (not (string-match url-nonrelative-link url)) | 127 | ((or (not (string-match url-nonrelative-link url)) |
| 127 | (= ?/ (string-to-char url))) | 128 | (= ?/ (string-to-char url))) |
| 129 | ;; This isn't correct, as a relative URL can be a fragment link | ||
| 130 | ;; (e.g. "#foo") and many other things (see section 4.2). | ||
| 131 | ;; However, let's not fix something that isn't broken, especially | ||
| 132 | ;; when close to a release. | ||
| 128 | (let ((retval (make-vector 9 nil))) | 133 | (let ((retval (make-vector 9 nil))) |
| 129 | (url-set-filename retval url) | 134 | (url-set-filename retval url) |
| 130 | (url-set-full retval nil) | 135 | (url-set-full retval nil) |
| @@ -148,6 +153,8 @@ Format is: | |||
| 148 | (insert url) | 153 | (insert url) |
| 149 | (goto-char (point-min)) | 154 | (goto-char (point-min)) |
| 150 | (setq save-pos (point)) | 155 | (setq save-pos (point)) |
| 156 | |||
| 157 | ;; 3.1. Scheme | ||
| 151 | (if (not (looking-at "//")) | 158 | (if (not (looking-at "//")) |
| 152 | (progn | 159 | (progn |
| 153 | (skip-chars-forward "a-zA-Z+.\\-") | 160 | (skip-chars-forward "a-zA-Z+.\\-") |
| @@ -156,13 +163,13 @@ Format is: | |||
| 156 | (skip-chars-forward ":") | 163 | (skip-chars-forward ":") |
| 157 | (setq save-pos (point)))) | 164 | (setq save-pos (point)))) |
| 158 | 165 | ||
| 159 | ;; We are doing a fully specified URL, with hostname and all | 166 | ;; 3.2. Authority |
| 160 | (if (looking-at "//") | 167 | (if (looking-at "//") |
| 161 | (progn | 168 | (progn |
| 162 | (setq full t) | 169 | (setq full t) |
| 163 | (forward-char 2) | 170 | (forward-char 2) |
| 164 | (setq save-pos (point)) | 171 | (setq save-pos (point)) |
| 165 | (skip-chars-forward "^/") | 172 | (skip-chars-forward "^/\\?#") |
| 166 | (setq host (buffer-substring save-pos (point))) | 173 | (setq host (buffer-substring save-pos (point))) |
| 167 | (if (string-match "^\\([^@]+\\)@" host) | 174 | (if (string-match "^\\([^@]+\\)@" host) |
| 168 | (setq user (match-string 1 host) | 175 | (setq user (match-string 1 host) |
| @@ -170,6 +177,7 @@ Format is: | |||
| 170 | (if (and user (string-match "\\([^:]+\\):\\(.*\\)" user)) | 177 | (if (and user (string-match "\\([^:]+\\):\\(.*\\)" user)) |
| 171 | (setq pass (match-string 2 user) | 178 | (setq pass (match-string 2 user) |
| 172 | user (match-string 1 user))) | 179 | user (match-string 1 user))) |
| 180 | ;; This gives wrong results for IPv6 literal addresses. | ||
| 173 | (if (string-match ":\\([0-9+]+\\)" host) | 181 | (if (string-match ":\\([0-9+]+\\)" host) |
| 174 | (setq port (string-to-number (match-string 1 host)) | 182 | (setq port (string-to-number (match-string 1 host)) |
| 175 | host (substring host 0 (match-beginning 0)))) | 183 | host (substring host 0 (match-beginning 0)))) |
| @@ -181,29 +189,26 @@ Format is: | |||
| 181 | (if (not port) | 189 | (if (not port) |
| 182 | (setq port (url-scheme-get-property prot 'default-port))) | 190 | (setq port (url-scheme-get-property prot 'default-port))) |
| 183 | 191 | ||
| 184 | ;; Gross hack to preserve ';' in data URLs | 192 | ;; 3.3. Path |
| 185 | |||
| 186 | (setq save-pos (point)) | 193 | (setq save-pos (point)) |
| 194 | (skip-chars-forward "^#?") | ||
| 195 | (setq file (buffer-substring save-pos (point))) | ||
| 187 | 196 | ||
| 188 | (if (string= "data" prot) | 197 | ;; 3.4. Query |
| 189 | (goto-char (point-max)) | 198 | (when (looking-at "\\?") |
| 190 | ;; Now check for references | 199 | (forward-char 1) |
| 200 | (setq save-pos (point)) | ||
| 191 | (skip-chars-forward "^#") | 201 | (skip-chars-forward "^#") |
| 192 | (if (eobp) | 202 | ;; RFC 3986 specifies no general way of parsing the query |
| 193 | nil | 203 | ;; string, but `url-parse-args' seems universal enough. |
| 194 | (delete-region | 204 | (setq attr (url-parse-args (buffer-substring save-pos (point)) t) |
| 195 | (point) | 205 | attr (nreverse attr))) |
| 196 | (progn | 206 | |
| 197 | (skip-chars-forward "#") | 207 | ;; 3.5. Fragment |
| 198 | (setq refs (buffer-substring (point) (point-max))) | 208 | (when (looking-at "#") |
| 199 | (point-max)))) | 209 | (forward-char 1) |
| 200 | (goto-char save-pos) | 210 | (setq refs (buffer-substring (point) (point-max)))) |
| 201 | (skip-chars-forward "^;") | ||
| 202 | (if (not (eobp)) | ||
| 203 | (setq attr (url-parse-args (buffer-substring (point) (point-max)) t) | ||
| 204 | attr (nreverse attr)))) | ||
| 205 | 211 | ||
| 206 | (setq file (buffer-substring save-pos (point))) | ||
| 207 | (if (and host (string-match "%[0-9][0-9]" host)) | 212 | (if (and host (string-match "%[0-9][0-9]" host)) |
| 208 | (setq host (url-unhex-string host))) | 213 | (setq host (url-unhex-string host))) |
| 209 | (vector prot user pass host port file refs attr full)))))) | 214 | (vector prot user pass host port file refs attr full)))))) |