aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/url/ChangeLog15
-rw-r--r--lisp/url/url-http.el9
-rw-r--r--lisp/url/url-parse.el3
-rw-r--r--lisp/url/url-queue.el11
-rw-r--r--lisp/url/url.el17
5 files changed, 42 insertions, 13 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index f4cca618b49..179148a089d 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,18 @@
12012-02-08 Lars Ingebrigtsen <larsi@gnus.org>
2
3 * url-parse.el (url): Add the `use-cookies' slot to the URL struct
4 to be able to keep track of whether to do cookies or not on a
5 per-URL basis.
6
7 * url-queue.el (url-queue-retrieve): Take an optional
8 `inhibit-cookies' parameter.
9
10 * url.el (url-retrieve): Ditto
11
12 * url-http.el (url-http-create-request): Don't send cookies unless
13 requested.
14 (url-http-parse-headers): Don't store cookies unless requested.
15
12012-02-06 Lars Ingebrigtsen <larsi@gnus.org> 162012-02-06 Lars Ingebrigtsen <larsi@gnus.org>
2 17
3 * url-cache.el (url-cache-prune-cache): New function. 18 * url-cache.el (url-cache-prune-cache): New function.
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index b43ed7617ad..b2f93f093e6 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -320,8 +320,10 @@ request.")
320 ;; Authorization 320 ;; Authorization
321 auth 321 auth
322 ;; Cookies 322 ;; Cookies
323 (url-cookie-generate-header-lines host real-fname 323 (when (url-use-cookies url-http-target-url)
324 (equal "https" (url-type url-http-target-url))) 324 (url-cookie-generate-header-lines
325 host real-fname
326 (equal "https" (url-type url-http-target-url))))
325 ;; If-modified-since 327 ;; If-modified-since
326 (if (and (not no-cache) 328 (if (and (not no-cache)
327 (member url-http-method '("GET" nil))) 329 (member url-http-method '("GET" nil)))
@@ -498,7 +500,8 @@ should be shown to the user."
498 (file-name-handler-alist nil)) 500 (file-name-handler-alist nil))
499 (setq class (/ url-http-response-status 100)) 501 (setq class (/ url-http-response-status 100))
500 (url-http-debug "Parsed HTTP headers: class=%d status=%d" class url-http-response-status) 502 (url-http-debug "Parsed HTTP headers: class=%d status=%d" class url-http-response-status)
501 (url-http-handle-cookies) 503 (when (url-use-cookies url-http-target-url)
504 (url-http-handle-cookies))
502 505
503 (case class 506 (case class
504 ;; Classes of response codes 507 ;; Classes of response codes
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el
index ef09622b0a9..b91c85c0c3d 100644
--- a/lisp/url/url-parse.el
+++ b/lisp/url/url-parse.el
@@ -35,7 +35,8 @@
35 (&optional type user password host portspec filename 35 (&optional type user password host portspec filename
36 target attributes fullness)) 36 target attributes fullness))
37 (:copier nil)) 37 (:copier nil))
38 type user password host portspec filename target attributes fullness silent) 38 type user password host portspec filename target attributes fullness
39 silent (use-cookies t))
39 40
40(defsubst url-port (urlobj) 41(defsubst url-port (urlobj)
41 (or (url-portspec urlobj) 42 (or (url-portspec urlobj)
diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el
index 976a26635cd..c9c6c4fe69e 100644
--- a/lisp/url/url-queue.el
+++ b/lisp/url/url-queue.el
@@ -50,10 +50,11 @@
50 50
51(defstruct url-queue 51(defstruct url-queue
52 url callback cbargs silentp 52 url callback cbargs silentp
53 buffer start-time pre-triggered) 53 buffer start-time pre-triggered
54 inhibit-cookiesp)
54 55
55;;;###autoload 56;;;###autoload
56(defun url-queue-retrieve (url callback &optional cbargs silent) 57(defun url-queue-retrieve (url callback &optional cbargs silent inhibit-cookies)
57 "Retrieve URL asynchronously and call CALLBACK with CBARGS when finished. 58 "Retrieve URL asynchronously and call CALLBACK with CBARGS when finished.
58Like `url-retrieve' (which see for details of the arguments), but 59Like `url-retrieve' (which see for details of the arguments), but
59controls the level of parallelism via the 60controls the level of parallelism via the
@@ -63,7 +64,8 @@ controls the level of parallelism via the
63 (list (make-url-queue :url url 64 (list (make-url-queue :url url
64 :callback callback 65 :callback callback
65 :cbargs cbargs 66 :cbargs cbargs
66 :silentp silent)))) 67 :silentp silent
68 :inhibit-cookiesp inhibit-cookies))))
67 (url-queue-setup-runners)) 69 (url-queue-setup-runners))
68 70
69;; To ensure asynch behaviour, we start the required number of queue 71;; To ensure asynch behaviour, we start the required number of queue
@@ -131,7 +133,8 @@ controls the level of parallelism via the
131 (ignore-errors 133 (ignore-errors
132 (url-retrieve (url-queue-url job) 134 (url-retrieve (url-queue-url job)
133 #'url-queue-callback-function (list job) 135 #'url-queue-callback-function (list job)
134 (url-queue-silentp job))))) 136 (url-queue-silentp job)
137 (url-queue-inhibit-cookiesp job)))))
135 138
136(defun url-queue-prune-old-entries () 139(defun url-queue-prune-old-entries ()
137 (let (dead-jobs) 140 (let (dead-jobs)
diff --git a/lisp/url/url.el b/lisp/url/url.el
index 03b66b15232..933bceb2e6f 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -123,7 +123,7 @@ variable in the original buffer as a forwarding pointer.")
123(autoload 'url-cache-prune-cache "url-cache") 123(autoload 'url-cache-prune-cache "url-cache")
124 124
125;;;###autoload 125;;;###autoload
126(defun url-retrieve (url callback &optional cbargs silent) 126(defun url-retrieve (url callback &optional cbargs silent inhibit-cookies)
127 "Retrieve URL asynchronously and call CALLBACK with CBARGS when finished. 127 "Retrieve URL asynchronously and call CALLBACK with CBARGS when finished.
128URL is either a string or a parsed URL. 128URL is either a string or a parsed URL.
129 129
@@ -147,7 +147,9 @@ The variables `url-request-data', `url-request-method' and
147request; dynamic binding of other variables doesn't necessarily 147request; dynamic binding of other variables doesn't necessarily
148take effect. 148take effect.
149 149
150If SILENT, then don't message progress reports and the like." 150If SILENT, then don't message progress reports and the like.
151If INHIBIT-COOKIES, cookies will neither be stored nor sent to
152the server."
151;;; XXX: There is code in Emacs that does dynamic binding 153;;; XXX: There is code in Emacs that does dynamic binding
152;;; of the following variables around url-retrieve: 154;;; of the following variables around url-retrieve:
153;;; url-standalone-mode, url-gateway-unplugged, w3-honor-stylesheets, 155;;; url-standalone-mode, url-gateway-unplugged, w3-honor-stylesheets,
@@ -158,14 +160,18 @@ If SILENT, then don't message progress reports and the like."
158;;; webmail.el; the latter should be updated. Is 160;;; webmail.el; the latter should be updated. Is
159;;; url-cookie-multiple-line needed anymore? The other url-cookie-* 161;;; url-cookie-multiple-line needed anymore? The other url-cookie-*
160;;; are (for now) only used in synchronous retrievals. 162;;; are (for now) only used in synchronous retrievals.
161 (url-retrieve-internal url callback (cons nil cbargs) silent)) 163 (url-retrieve-internal url callback (cons nil cbargs) silent
164 inhibit-cookies))
162 165
163(defun url-retrieve-internal (url callback cbargs &optional silent) 166(defun url-retrieve-internal (url callback cbargs &optional silent
167 inhibit-cookies)
164 "Internal function; external interface is `url-retrieve'. 168 "Internal function; external interface is `url-retrieve'.
165CBARGS is what the callback will actually receive - the first item is 169CBARGS is what the callback will actually receive - the first item is
166the list of events, as described in the docstring of `url-retrieve'. 170the list of events, as described in the docstring of `url-retrieve'.
167 171
168If SILENT, don't message progress reports and the like." 172If SILENT, don't message progress reports and the like.
173If INHIBIT-COOKIES, cookies will neither be stored nor sent to
174the server."
169 (url-do-setup) 175 (url-do-setup)
170 (url-gc-dead-buffers) 176 (url-gc-dead-buffers)
171 (if (stringp url) 177 (if (stringp url)
@@ -177,6 +183,7 @@ If SILENT, don't message progress reports and the like."
177 (unless (url-type url) 183 (unless (url-type url)
178 (error "Bad url: %s" (url-recreate-url url))) 184 (error "Bad url: %s" (url-recreate-url url)))
179 (setf (url-silent url) silent) 185 (setf (url-silent url) silent)
186 (setf (url-use-cookies url) (not inhibit-cookies))
180 ;; Once in a while, remove old entries from the URL cache. 187 ;; Once in a while, remove old entries from the URL cache.
181 (when (zerop (% url-retrieve-number-of-calls 1000)) 188 (when (zerop (% url-retrieve-number-of-calls 1000))
182 (url-cache-prune-cache)) 189 (url-cache-prune-cache))