+2012-02-08 Lars Ingebrigtsen <larsi@gnus.org>
+
+ * 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 <larsi@gnus.org>
* url-cache.el (url-cache-prune-cache): New function.
;; 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)))
(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
(&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)
(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
(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
(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)
(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.
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,
;;; 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)
(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))