aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/url
diff options
context:
space:
mode:
authorPaul Eggert2012-04-09 15:54:59 -0700
committerPaul Eggert2012-04-09 15:54:59 -0700
commit45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193 (patch)
tree5bc87a8b5a3c754b8eb44a612cc6c03561d6b968 /lisp/url
parent9d6b4d53469a9ffd67bd770fabc6fe254e35c21d (diff)
parent05920a43fc18e696b464387e781e7cfdcea5b5af (diff)
downloademacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.tar.gz
emacs-45e9f7da84c1bd3fc0d36d05c5708ed3b2d3a193.zip
Merge from trunk.
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/ChangeLog21
-rw-r--r--lisp/url/url-dav.el2
-rw-r--r--lisp/url/url-handlers.el2
-rw-r--r--lisp/url/url-http.el83
-rw-r--r--lisp/url/url-ldap.el4
-rw-r--r--lisp/url/url-nfs.el2
-rw-r--r--lisp/url/url-queue.el18
-rw-r--r--lisp/url/url-vars.el8
8 files changed, 95 insertions, 45 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 55aa9194904..d6e25188c69 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,24 @@
12012-03-25 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * url-queue.el (url-queue-kill-job): Check whether the buffer has
4 been killed asynchronously before selecting it.
5
62012-03-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
7
8 * url-queue.el (url-queue-kill-job): Make sure that the callback
9 is always called, even if we have a timeout.
10
112012-03-11 Chong Yidong <cyd@gnu.org>
12
13 * url-http.el (url-http-end-of-document-sentinel): Handle
14 keepalive expiry by calling url-http again (Bug#10223).
15 (url-http): New arg, for the above.
16
172012-03-11 Devon Sean McCullough <emacs-hacker2012@jovi.net>
18
19 * url-http.el (url-http-find-free-connection): Don't pass a nil
20 argument to url-http-mark-connection-as-busy (bug#10891).
21
12012-02-20 Lars Ingebrigtsen <larsi@gnus.org> 222012-02-20 Lars Ingebrigtsen <larsi@gnus.org>
2 23
3 * url-queue.el (url-queue-kill-job): Delete the process sentinel 24 * url-queue.el (url-queue-kill-job): Delete the process sentinel
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el
index 03527bceee7..085785524b7 100644
--- a/lisp/url/url-dav.el
+++ b/lisp/url/url-dav.el
@@ -478,7 +478,7 @@ names (ie: DAV:resourcetype)."
478 478
479;;; Locking support 479;;; Locking support
480(defvar url-dav-lock-identifier (concat "mailto:" user-mail-address) 480(defvar url-dav-lock-identifier (concat "mailto:" user-mail-address)
481 "*URL used as contact information when creating locks in DAV. 481 "URL used as contact information when creating locks in DAV.
482This will be used as the contents of the DAV:owner/DAV:href tag to 482This will be used as the contents of the DAV:owner/DAV:href tag to
483identify the owner of a LOCK when requesting it. This will be shown 483identify the owner of a LOCK when requesting it. This will be shown
484to other users when the DAV:lockdiscovery property is requested, so 484to other users when the DAV:lockdiscovery property is requested, so
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 4bc5bd47488..d00a1174cdf 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -92,7 +92,7 @@
92 92
93(defvar url-handler-regexp 93(defvar url-handler-regexp
94 "\\`\\(https?\\|ftp\\|file\\|nfs\\)://" 94 "\\`\\(https?\\|ftp\\|file\\|nfs\\)://"
95 "*A regular expression for matching URLs handled by `file-name-handler-alist'. 95 "A regular expression for matching URLs handled by `file-name-handler-alist'.
96Some valid URL protocols just do not make sense to visit interactively 96Some valid URL protocols just do not make sense to visit interactively
97\(about, data, info, irc, mailto, etc\). This regular expression 97\(about, data, info, irc, mailto, etc\). This regular expression
98avoids conflicts with local files that look like URLs \(Gnus is 98avoids conflicts with local files that look like URLs \(Gnus is
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 0c911260ca5..a4726489814 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -27,6 +27,7 @@
27(eval-when-compile (require 'cl)) 27(eval-when-compile (require 'cl))
28(defvar url-http-extra-headers) 28(defvar url-http-extra-headers)
29(defvar url-http-target-url) 29(defvar url-http-target-url)
30(defvar url-http-no-retry)
30(defvar url-http-proxy) 31(defvar url-http-proxy)
31(defvar url-http-connection-opened) 32(defvar url-http-connection-opened)
32(require 'url-gw) 33(require 'url-gw)
@@ -153,38 +154,40 @@ request.")
153 154
154(defun url-http-find-free-connection (host port) 155(defun url-http-find-free-connection (host port)
155 (let ((conns (gethash (cons host port) url-http-open-connections)) 156 (let ((conns (gethash (cons host port) url-http-open-connections))
156 (found nil)) 157 (connection nil))
157 (while (and conns (not found)) 158 (while (and conns (not connection))
158 (if (not (memq (process-status (car conns)) '(run open connect))) 159 (if (not (memq (process-status (car conns)) '(run open connect)))
159 (progn 160 (progn
160 (url-http-debug "Cleaning up dead process: %s:%d %S" 161 (url-http-debug "Cleaning up dead process: %s:%d %S"
161 host port (car conns)) 162 host port (car conns))
162 (url-http-idle-sentinel (car conns) nil)) 163 (url-http-idle-sentinel (car conns) nil))
163 (setq found (car conns)) 164 (setq connection (car conns))
164 (url-http-debug "Found existing connection: %s:%d %S" host port found)) 165 (url-http-debug "Found existing connection: %s:%d %S" host port connection))
165 (pop conns)) 166 (pop conns))
166 (if found 167 (if connection
167 (url-http-debug "Reusing existing connection: %s:%d" host port) 168 (url-http-debug "Reusing existing connection: %s:%d" host port)
168 (url-http-debug "Contacting host: %s:%d" host port)) 169 (url-http-debug "Contacting host: %s:%d" host port))
169 (url-lazy-message "Contacting host: %s:%d" host port) 170 (url-lazy-message "Contacting host: %s:%d" host port)
170 (url-http-mark-connection-as-busy 171
171 host port 172 (unless connection
172 (or found 173 (let ((buf (generate-new-buffer " *url-http-temp*")))
173 (let ((buf (generate-new-buffer " *url-http-temp*"))) 174 ;; `url-open-stream' needs a buffer in which to do things
174 ;; `url-open-stream' needs a buffer in which to do things 175 ;; like authentication. But we use another buffer afterwards.
175 ;; like authentication. But we use another buffer afterwards. 176 (unwind-protect
176 (unwind-protect 177 (let ((proc (url-open-stream host buf host port)))
177 (let ((proc (url-open-stream host buf host port))) 178 ;; url-open-stream might return nil.
178 ;; url-open-stream might return nil. 179 (when (processp proc)
179 (when (processp proc) 180 ;; Drop the temp buffer link before killing the buffer.
180 ;; Drop the temp buffer link before killing the buffer. 181 (set-process-buffer proc nil)
181 (set-process-buffer proc nil)) 182 (setq connection proc)))
182 proc) 183 ;; If there was an error on connect, make sure we don't
183 ;; If there was an error on connect, make sure we don't 184 ;; get queried.
184 ;; get queried. 185 (when (get-buffer-process buf)
185 (when (get-buffer-process buf) 186 (set-process-query-on-exit-flag (get-buffer-process buf) nil))
186 (set-process-query-on-exit-flag (get-buffer-process buf) nil)) 187 (kill-buffer buf))))
187 (kill-buffer buf))))))) 188
189 (if connection
190 (url-http-mark-connection-as-busy host port connection))))
188 191
189;; Building an HTTP request 192;; Building an HTTP request
190(defun url-http-user-agent-string () 193(defun url-http-user-agent-string ()
@@ -873,19 +876,26 @@ should be shown to the user."
873 url-http-open-connections)) 876 url-http-open-connections))
874 877
875(defun url-http-end-of-document-sentinel (proc why) 878(defun url-http-end-of-document-sentinel (proc why)
876 ;; Sentinel used for old HTTP/0.9 or connections we know are going 879 ;; Sentinel used to handle (i) terminated old HTTP/0.9 connections,
877 ;; to die as the 'end of document' notifier. 880 ;; and (ii) closed connection due to reusing a HTTP connection which
881 ;; we believed was still alive, but which the server closed on us.
882 ;; We handle case (ii) by calling `url-http' again.
878 (url-http-debug "url-http-end-of-document-sentinel in buffer (%s)" 883 (url-http-debug "url-http-end-of-document-sentinel in buffer (%s)"
879 (process-buffer proc)) 884 (process-buffer proc))
880 (url-http-idle-sentinel proc why) 885 (url-http-idle-sentinel proc why)
881 (when (buffer-name (process-buffer proc)) 886 (when (buffer-name (process-buffer proc))
882 (with-current-buffer (process-buffer proc) 887 (with-current-buffer (process-buffer proc)
883 (goto-char (point-min)) 888 (goto-char (point-min))
884 (if (not (looking-at "HTTP/")) 889 (cond ((not (looking-at "HTTP/"))
885 ;; HTTP/0.9 just gets passed back no matter what 890 (if url-http-no-retry
886 (url-http-activate-callback) 891 ;; HTTP/0.9 just gets passed back no matter what
887 (if (url-http-parse-headers) 892 (url-http-activate-callback)
888 (url-http-activate-callback)))))) 893 ;; Call `url-http' again if our connection expired.
894 (erase-buffer)
895 (url-http url-current-object url-callback-function
896 url-callback-arguments (current-buffer))))
897 ((url-http-parse-headers)
898 (url-http-activate-callback))))))
889 899
890(defun url-http-simple-after-change-function (st nd length) 900(defun url-http-simple-after-change-function (st nd length)
891 ;; Function used when we do NOT know how long the document is going to be 901 ;; Function used when we do NOT know how long the document is going to be
@@ -1163,11 +1173,14 @@ the end of the document."
1163 (goto-char (point-max))))) 1173 (goto-char (point-max)))))
1164 1174
1165;;;###autoload 1175;;;###autoload
1166(defun url-http (url callback cbargs) 1176(defun url-http (url callback cbargs &optional retry-buffer)
1167 "Retrieve URL via HTTP asynchronously. 1177 "Retrieve URL via HTTP asynchronously.
1168URL must be a parsed URL. See `url-generic-parse-url' for details. 1178URL must be a parsed URL. See `url-generic-parse-url' for details.
1169When retrieval is completed, the function CALLBACK is executed with 1179When retrieval is completed, the function CALLBACK is executed with
1170CBARGS as the arguments." 1180CBARGS as the arguments.
1181
1182Optional arg RETRY-BUFFER, if non-nil, specifies the buffer of a
1183previous `url-http' call, which is being re-attempted."
1171 (check-type url vector "Need a pre-parsed URL.") 1184 (check-type url vector "Need a pre-parsed URL.")
1172 (declare (special url-current-object 1185 (declare (special url-current-object
1173 url-http-end-of-headers 1186 url-http-end-of-headers
@@ -1188,7 +1201,8 @@ CBARGS as the arguments."
1188 (let* ((host (url-host (or url-using-proxy url))) 1201 (let* ((host (url-host (or url-using-proxy url)))
1189 (port (url-port (or url-using-proxy url))) 1202 (port (url-port (or url-using-proxy url)))
1190 (connection (url-http-find-free-connection host port)) 1203 (connection (url-http-find-free-connection host port))
1191 (buffer (generate-new-buffer (format " *http %s:%d*" host port)))) 1204 (buffer (or retry-buffer
1205 (generate-new-buffer (format " *http %s:%d*" host port)))))
1192 (if (not connection) 1206 (if (not connection)
1193 ;; Failed to open the connection for some reason 1207 ;; Failed to open the connection for some reason
1194 (progn 1208 (progn
@@ -1218,6 +1232,7 @@ CBARGS as the arguments."
1218 url-http-extra-headers 1232 url-http-extra-headers
1219 url-http-data 1233 url-http-data
1220 url-http-target-url 1234 url-http-target-url
1235 url-http-no-retry
1221 url-http-connection-opened 1236 url-http-connection-opened
1222 url-http-proxy)) 1237 url-http-proxy))
1223 (set (make-local-variable var) nil)) 1238 (set (make-local-variable var) nil))
@@ -1233,6 +1248,7 @@ CBARGS as the arguments."
1233 url-callback-arguments cbargs 1248 url-callback-arguments cbargs
1234 url-http-after-change-function 'url-http-wait-for-headers-change-function 1249 url-http-after-change-function 'url-http-wait-for-headers-change-function
1235 url-http-target-url url-current-object 1250 url-http-target-url url-current-object
1251 url-http-no-retry retry-buffer
1236 url-http-connection-opened nil 1252 url-http-connection-opened nil
1237 url-http-proxy url-using-proxy) 1253 url-http-proxy url-using-proxy)
1238 1254
@@ -1259,6 +1275,7 @@ CBARGS as the arguments."
1259 (with-current-buffer (process-buffer proc) 1275 (with-current-buffer (process-buffer proc)
1260 (cond 1276 (cond
1261 (url-http-connection-opened 1277 (url-http-connection-opened
1278 (setq url-http-no-retry t)
1262 (url-http-end-of-document-sentinel proc why)) 1279 (url-http-end-of-document-sentinel proc why))
1263 ((string= (substring why 0 4) "open") 1280 ((string= (substring why 0 4) "open")
1264 (setq url-http-connection-opened t) 1281 (setq url-http-connection-opened t)
diff --git a/lisp/url/url-ldap.el b/lisp/url/url-ldap.el
index 7c988f9b119..0ea98cb06c9 100644
--- a/lisp/url/url-ldap.el
+++ b/lisp/url/url-ldap.el
@@ -64,7 +64,7 @@
64 ("facsimiletelephonenumber" . "Fax") 64 ("facsimiletelephonenumber" . "Fax")
65 ("postaladdress" . "Mailing Address") 65 ("postaladdress" . "Mailing Address")
66 ("description" . "Notes")) 66 ("description" . "Notes"))
67 "*An assoc list mapping LDAP attribute names to pretty descriptions of them.") 67 "An assoc list mapping LDAP attribute names to pretty descriptions of them.")
68 68
69(defvar url-ldap-attribute-formatters 69(defvar url-ldap-attribute-formatters
70 '(("mail" . (lambda (x) (format "<a href='mailto:%s'>%s</a>" x x))) 70 '(("mail" . (lambda (x) (format "<a href='mailto:%s'>%s</a>" x x)))
@@ -76,7 +76,7 @@
76 ("namingcontexts" . url-ldap-dn-formatter) 76 ("namingcontexts" . url-ldap-dn-formatter)
77 ("defaultnamingcontext" . url-ldap-dn-formatter) 77 ("defaultnamingcontext" . url-ldap-dn-formatter)
78 ("member" . url-ldap-dn-formatter)) 78 ("member" . url-ldap-dn-formatter))
79 "*An assoc list mapping LDAP attribute names to pretty formatters for them.") 79 "An assoc list mapping LDAP attribute names to pretty formatters for them.")
80 80
81(defsubst url-ldap-attribute-pretty-name (n) 81(defsubst url-ldap-attribute-pretty-name (n)
82 (or (cdr-safe (assoc (downcase n) url-ldap-pretty-names)) n)) 82 (or (cdr-safe (assoc (downcase n) url-ldap-pretty-names)) n))
diff --git a/lisp/url/url-nfs.el b/lisp/url/url-nfs.el
index a22d105b1a1..bfab147f267 100644
--- a/lisp/url/url-nfs.el
+++ b/lisp/url/url-nfs.el
@@ -29,7 +29,7 @@
29 29
30(defvar url-nfs-automounter-directory-spec 30(defvar url-nfs-automounter-directory-spec
31 "file:/net/%h%f" 31 "file:/net/%h%f"
32 "*How to invoke the NFS automounter. Certain % sequences are recognized. 32 "How to invoke the NFS automounter. Certain % sequences are recognized.
33 33
34%h -- the hostname of the NFS server 34%h -- the hostname of the NFS server
35%n -- the port # of the NFS server 35%n -- the port # of the NFS server
diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el
index 6e4cedddaf3..917c787df29 100644
--- a/lisp/url/url-queue.el
+++ b/lisp/url/url-queue.el
@@ -156,9 +156,21 @@ The variable `url-queue-timeout' sets a timeout."
156 (while (setq process (get-buffer-process (url-queue-buffer job))) 156 (while (setq process (get-buffer-process (url-queue-buffer job)))
157 (set-process-sentinel process 'ignore) 157 (set-process-sentinel process 'ignore)
158 (ignore-errors 158 (ignore-errors
159 (delete-process process)))) 159 (delete-process process)))))
160 (ignore-errors 160 ;; Call the callback with an error message to ensure that the caller
161 (kill-buffer (url-queue-buffer job))))) 161 ;; is notified that the job has failed.
162 (with-current-buffer
163 (if (and (bufferp (url-queue-buffer job))
164 (buffer-live-p (url-queue-buffer job)))
165 ;; Use the (partially filled) process buffer it it exists.
166 (url-queue-buffer job)
167 ;; If not, just create a new buffer, which will probably be
168 ;; killed again by the caller.
169 (generate-new-buffer " *temp*"))
170 (apply (url-queue-callback job)
171 (cons (list :error (list 'error 'url-queue-timeout
172 "Queue timeout exceeded"))
173 (url-queue-cbargs job)))))
162 174
163(provide 'url-queue) 175(provide 'url-queue)
164 176
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el
index a56eb4cc810..ff18049e97b 100644
--- a/lisp/url/url-vars.el
+++ b/lisp/url/url-vars.el
@@ -212,7 +212,7 @@ Should be an assoc list of headers/contents.")
212 212
213;; FIXME!! (RFC 2616 gives examples like `compress, gzip'.) 213;; FIXME!! (RFC 2616 gives examples like `compress, gzip'.)
214(defvar url-mime-encoding-string nil 214(defvar url-mime-encoding-string nil
215 "*String to send in the Accept-encoding: field in HTTP requests.") 215 "String to send in the Accept-encoding: field in HTTP requests.")
216 216
217;; Perhaps the first few should actually be given decreasing `q's and 217;; Perhaps the first few should actually be given decreasing `q's and
218;; the list should be trimmed significantly. 218;; the list should be trimmed significantly.
@@ -233,7 +233,7 @@ Generated according to current coding system priorities."
233 ";q=0.5")))) 233 ";q=0.5"))))
234 234
235(defvar url-mime-charset-string nil 235(defvar url-mime-charset-string nil
236 "*String to send in the Accept-charset: field in HTTP requests. 236 "String to send in the Accept-charset: field in HTTP requests.
237The MIME charset corresponding to the most preferred coding system is 237The MIME charset corresponding to the most preferred coding system is
238given priority 1 and the rest are given priority 0.5.") 238given priority 1 and the rest are given priority 0.5.")
239 239
@@ -364,7 +364,7 @@ Currently supported methods:
364 364
365(defvar url-parse-syntax-table 365(defvar url-parse-syntax-table
366 (copy-syntax-table emacs-lisp-mode-syntax-table) 366 (copy-syntax-table emacs-lisp-mode-syntax-table)
367 "*A syntax table for parsing URLs.") 367 "A syntax table for parsing URLs.")
368 368
369(modify-syntax-entry ?' "\"" url-parse-syntax-table) 369(modify-syntax-entry ?' "\"" url-parse-syntax-table)
370(modify-syntax-entry ?` "\"" url-parse-syntax-table) 370(modify-syntax-entry ?` "\"" url-parse-syntax-table)
@@ -373,7 +373,7 @@ Currently supported methods:
373(modify-syntax-entry ?/ " " url-parse-syntax-table) 373(modify-syntax-entry ?/ " " url-parse-syntax-table)
374 374
375(defvar url-load-hook nil 375(defvar url-load-hook nil
376 "*Hooks to be run after initializing the URL library.") 376 "Hooks to be run after initializing the URL library.")
377 377
378;;; Make OS/2 happy - yeeks 378;;; Make OS/2 happy - yeeks
379;; (defvar tcp-binary-process-input-services nil 379;; (defvar tcp-binary-process-input-services nil