[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107169: Allow specifying whether to
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107169: Allow specifying whether to inhibit cookies on a per-URL basis |
Date: |
Wed, 08 Feb 2012 01:04:42 +0100 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107169
committer: Lars Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2012-02-08 01:04:42 +0100
message:
Allow specifying whether to inhibit cookies on a per-URL basis
* url-http.el (url-http-create-request): Don't send cookies unless
requested.
(url-http-parse-headers): Don't store cookies unless requested.
* url.el (url-retrieve): Ditto
* url-queue.el (url-queue-retrieve): Take an optional
`inhibit-cookies' parameter.
* url-parse.el (url): Add the `use-cookies' slot to the URL struct
to be able to keep track of whether to do cookies or not on a
per-URL basis.
modified:
lisp/url/ChangeLog
lisp/url/url-http.el
lisp/url/url-parse.el
lisp/url/url-queue.el
lisp/url/url.el
=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog 2012-02-06 21:37:56 +0000
+++ b/lisp/url/ChangeLog 2012-02-08 00:04:42 +0000
@@ -1,3 +1,18 @@
+2012-02-08 Lars Ingebrigtsen <address@hidden>
+
+ * url-parse.el (url): Add the `use-cookies' slot to the URL struct
+ to be able to keep track of whether to do cookies or not on a
+ per-URL basis.
+
+ * url-queue.el (url-queue-retrieve): Take an optional
+ `inhibit-cookies' parameter.
+
+ * url.el (url-retrieve): Ditto
+
+ * url-http.el (url-http-create-request): Don't send cookies unless
+ requested.
+ (url-http-parse-headers): Don't store cookies unless requested.
+
2012-02-06 Lars Ingebrigtsen <address@hidden>
* url-cache.el (url-cache-prune-cache): New function.
=== modified file 'lisp/url/url-http.el'
--- a/lisp/url/url-http.el 2012-01-19 07:21:25 +0000
+++ b/lisp/url/url-http.el 2012-02-08 00:04:42 +0000
@@ -320,8 +320,10 @@
;; Authorization
auth
;; Cookies
- (url-cookie-generate-header-lines host real-fname
- (equal "https" (url-type
url-http-target-url)))
+ (when (url-use-cookies url-http-target-url)
+ (url-cookie-generate-header-lines
+ host real-fname
+ (equal "https" (url-type url-http-target-url))))
;; If-modified-since
(if (and (not no-cache)
(member url-http-method '("GET" nil)))
@@ -498,7 +500,8 @@
(file-name-handler-alist nil))
(setq class (/ url-http-response-status 100))
(url-http-debug "Parsed HTTP headers: class=%d status=%d" class
url-http-response-status)
- (url-http-handle-cookies)
+ (when (url-use-cookies url-http-target-url)
+ (url-http-handle-cookies))
(case class
;; Classes of response codes
=== modified file 'lisp/url/url-parse.el'
--- a/lisp/url/url-parse.el 2012-01-19 07:21:25 +0000
+++ b/lisp/url/url-parse.el 2012-02-08 00:04:42 +0000
@@ -35,7 +35,8 @@
(&optional type user password host portspec filename
target attributes fullness))
(:copier nil))
- type user password host portspec filename target attributes fullness silent)
+ type user password host portspec filename target attributes fullness
+ silent (use-cookies t))
(defsubst url-port (urlobj)
(or (url-portspec urlobj)
=== modified file 'lisp/url/url-queue.el'
--- a/lisp/url/url-queue.el 2012-02-06 01:13:24 +0000
+++ b/lisp/url/url-queue.el 2012-02-08 00:04:42 +0000
@@ -50,10 +50,11 @@
(defstruct url-queue
url callback cbargs silentp
- buffer start-time pre-triggered)
+ buffer start-time pre-triggered
+ inhibit-cookiesp)
;;;###autoload
-(defun url-queue-retrieve (url callback &optional cbargs silent)
+(defun url-queue-retrieve (url callback &optional cbargs silent
inhibit-cookies)
"Retrieve URL asynchronously and call CALLBACK with CBARGS when finished.
Like `url-retrieve' (which see for details of the arguments), but
controls the level of parallelism via the
@@ -63,7 +64,8 @@
(list (make-url-queue :url url
:callback callback
:cbargs cbargs
- :silentp silent))))
+ :silentp silent
+ :inhibit-cookiesp inhibit-cookies))))
(url-queue-setup-runners))
;; To ensure asynch behaviour, we start the required number of queue
@@ -131,7 +133,8 @@
(ignore-errors
(url-retrieve (url-queue-url job)
#'url-queue-callback-function (list job)
- (url-queue-silentp job)))))
+ (url-queue-silentp job)
+ (url-queue-inhibit-cookiesp job)))))
(defun url-queue-prune-old-entries ()
(let (dead-jobs)
=== modified file 'lisp/url/url.el'
--- a/lisp/url/url.el 2012-02-06 21:06:15 +0000
+++ b/lisp/url/url.el 2012-02-08 00:04:42 +0000
@@ -123,7 +123,7 @@
(autoload 'url-cache-prune-cache "url-cache")
;;;###autoload
-(defun url-retrieve (url callback &optional cbargs silent)
+(defun url-retrieve (url callback &optional cbargs silent inhibit-cookies)
"Retrieve URL asynchronously and call CALLBACK with CBARGS when finished.
URL is either a string or a parsed URL.
@@ -147,7 +147,9 @@
request; dynamic binding of other variables doesn't necessarily
take effect.
-If SILENT, then don't message progress reports and the like."
+If SILENT, then don't message progress reports and the like.
+If INHIBIT-COOKIES, cookies will neither be stored nor sent to
+the server."
;;; XXX: There is code in Emacs that does dynamic binding
;;; of the following variables around url-retrieve:
;;; url-standalone-mode, url-gateway-unplugged, w3-honor-stylesheets,
@@ -158,14 +160,18 @@
;;; webmail.el; the latter should be updated. Is
;;; url-cookie-multiple-line needed anymore? The other url-cookie-*
;;; are (for now) only used in synchronous retrievals.
- (url-retrieve-internal url callback (cons nil cbargs) silent))
+ (url-retrieve-internal url callback (cons nil cbargs) silent
+ inhibit-cookies))
-(defun url-retrieve-internal (url callback cbargs &optional silent)
+(defun url-retrieve-internal (url callback cbargs &optional silent
+ inhibit-cookies)
"Internal function; external interface is `url-retrieve'.
CBARGS is what the callback will actually receive - the first item is
the list of events, as described in the docstring of `url-retrieve'.
-If SILENT, don't message progress reports and the like."
+If SILENT, don't message progress reports and the like.
+If INHIBIT-COOKIES, cookies will neither be stored nor sent to
+the server."
(url-do-setup)
(url-gc-dead-buffers)
(if (stringp url)
@@ -177,6 +183,7 @@
(unless (url-type url)
(error "Bad url: %s" (url-recreate-url url)))
(setf (url-silent url) silent)
+ (setf (url-use-cookies url) (not inhibit-cookies))
;; Once in a while, remove old entries from the URL cache.
(when (zerop (% url-retrieve-number-of-calls 1000))
(url-cache-prune-cache))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107169: Allow specifying whether to inhibit cookies on a per-URL basis,
Lars Ingebrigtsen <=