diff options
| author | Magnus Henoch | 2006-11-01 15:16:22 +0000 |
|---|---|---|
| committer | Magnus Henoch | 2006-11-01 15:16:22 +0000 |
| commit | 8ea882655e0cbf9022835df3c2cf1634be895057 (patch) | |
| tree | 8883d3559b7e5ef504297876a50276d9911eb63c | |
| parent | 5c79f850e1a1d90b1b3aa96ce3d523d7fa80774a (diff) | |
| download | emacs-8ea882655e0cbf9022835df3c2cf1634be895057.tar.gz emacs-8ea882655e0cbf9022835df3c2cf1634be895057.zip | |
(url-http-create-request): Use buffer-locale equivalents of
dynamically bound variables.
| -rw-r--r-- | lisp/url/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 24 |
2 files changed, 18 insertions, 11 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index e63759f216a..1d4c4aa24fc 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2006-11-01 Magnus Henoch <mange@freemail.hu> | ||
| 2 | |||
| 3 | * url-http.el (url-http-create-request): Use buffer-local | ||
| 4 | equivalents of dynamically bound variables. | ||
| 5 | |||
| 1 | 2006-10-29 Magnus Henoch <mange@freemail.hu> | 6 | 2006-10-29 Magnus Henoch <mange@freemail.hu> |
| 2 | 7 | ||
| 3 | * url-gw.el (url-open-stream): Really use asynchronous | 8 | * url-gw.el (url-open-stream): Really use asynchronous |
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 181a4b8db9a..6b6ec7d6b22 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -151,13 +151,15 @@ request.") | |||
| 151 | 151 | ||
| 152 | (defun url-http-create-request (url &optional ref-url) | 152 | (defun url-http-create-request (url &optional ref-url) |
| 153 | "Create an HTTP request for URL, referred to by REF-URL." | 153 | "Create an HTTP request for URL, referred to by REF-URL." |
| 154 | (declare (special proxy-object proxy-info)) | 154 | (declare (special proxy-object proxy-info |
| 155 | url-http-method url-http-data | ||
| 156 | url-http-extra-headers)) | ||
| 155 | (let* ((extra-headers) | 157 | (let* ((extra-headers) |
| 156 | (request nil) | 158 | (request nil) |
| 157 | (no-cache (cdr-safe (assoc "Pragma" url-request-extra-headers))) | 159 | (no-cache (cdr-safe (assoc "Pragma" url-http-extra-headers))) |
| 158 | (proxy-obj (and (boundp 'proxy-object) proxy-object)) | 160 | (proxy-obj (and (boundp 'proxy-object) proxy-object)) |
| 159 | (proxy-auth (if (or (cdr-safe (assoc "Proxy-Authorization" | 161 | (proxy-auth (if (or (cdr-safe (assoc "Proxy-Authorization" |
| 160 | url-request-extra-headers)) | 162 | url-http-extra-headers)) |
| 161 | (not proxy-obj)) | 163 | (not proxy-obj)) |
| 162 | nil | 164 | nil |
| 163 | (let ((url-basic-auth-storage | 165 | (let ((url-basic-auth-storage |
| @@ -166,7 +168,7 @@ request.") | |||
| 166 | (real-fname (concat (url-filename (or proxy-obj url)) | 168 | (real-fname (concat (url-filename (or proxy-obj url)) |
| 167 | (url-recreate-url-attributes (or proxy-obj url)))) | 169 | (url-recreate-url-attributes (or proxy-obj url)))) |
| 168 | (host (url-host (or proxy-obj url))) | 170 | (host (url-host (or proxy-obj url))) |
| 169 | (auth (if (cdr-safe (assoc "Authorization" url-request-extra-headers)) | 171 | (auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers)) |
| 170 | nil | 172 | nil |
| 171 | (url-get-authentication (or | 173 | (url-get-authentication (or |
| 172 | (and (boundp 'proxy-info) | 174 | (and (boundp 'proxy-info) |
| @@ -191,12 +193,12 @@ request.") | |||
| 191 | (memq 'lastloc url-privacy-level))) | 193 | (memq 'lastloc url-privacy-level))) |
| 192 | (setq ref-url nil)) | 194 | (setq ref-url nil)) |
| 193 | 195 | ||
| 194 | ;; url-request-extra-headers contains an assoc-list of | 196 | ;; url-http-extra-headers contains an assoc-list of |
| 195 | ;; header/value pairs that we need to put into the request. | 197 | ;; header/value pairs that we need to put into the request. |
| 196 | (setq extra-headers (mapconcat | 198 | (setq extra-headers (mapconcat |
| 197 | (lambda (x) | 199 | (lambda (x) |
| 198 | (concat (car x) ": " (cdr x))) | 200 | (concat (car x) ": " (cdr x))) |
| 199 | url-request-extra-headers "\r\n")) | 201 | url-http-extra-headers "\r\n")) |
| 200 | (if (not (equal extra-headers "")) | 202 | (if (not (equal extra-headers "")) |
| 201 | (setq extra-headers (concat extra-headers "\r\n"))) | 203 | (setq extra-headers (concat extra-headers "\r\n"))) |
| 202 | 204 | ||
| @@ -219,7 +221,7 @@ request.") | |||
| 219 | (delq nil | 221 | (delq nil |
| 220 | (list | 222 | (list |
| 221 | ;; The request | 223 | ;; The request |
| 222 | (or url-request-method "GET") " " | 224 | (or url-http-method "GET") " " |
| 223 | (if proxy-obj (url-recreate-url proxy-obj) real-fname) | 225 | (if proxy-obj (url-recreate-url proxy-obj) real-fname) |
| 224 | " HTTP/" url-http-version "\r\n" | 226 | " HTTP/" url-http-version "\r\n" |
| 225 | ;; Version of MIME we speak | 227 | ;; Version of MIME we speak |
| @@ -267,7 +269,7 @@ request.") | |||
| 267 | (equal "https" (url-type url))) | 269 | (equal "https" (url-type url))) |
| 268 | ;; If-modified-since | 270 | ;; If-modified-since |
| 269 | (if (and (not no-cache) | 271 | (if (and (not no-cache) |
| 270 | (member url-request-method '("GET" nil))) | 272 | (member url-http-method '("GET" nil))) |
| 271 | (let ((tm (url-is-cached (or proxy-obj url)))) | 273 | (let ((tm (url-is-cached (or proxy-obj url)))) |
| 272 | (if tm | 274 | (if tm |
| 273 | (concat "If-modified-since: " | 275 | (concat "If-modified-since: " |
| @@ -277,15 +279,15 @@ request.") | |||
| 277 | "Referer: " ref-url "\r\n")) | 279 | "Referer: " ref-url "\r\n")) |
| 278 | extra-headers | 280 | extra-headers |
| 279 | ;; Length of data | 281 | ;; Length of data |
| 280 | (if url-request-data | 282 | (if url-http-data |
| 281 | (concat | 283 | (concat |
| 282 | "Content-length: " (number-to-string | 284 | "Content-length: " (number-to-string |
| 283 | (length url-request-data)) | 285 | (length url-http-data)) |
| 284 | "\r\n")) | 286 | "\r\n")) |
| 285 | ;; End request | 287 | ;; End request |
| 286 | "\r\n" | 288 | "\r\n" |
| 287 | ;; Any data | 289 | ;; Any data |
| 288 | url-request-data)) | 290 | url-http-data)) |
| 289 | "")) | 291 | "")) |
| 290 | (url-http-debug "Request is: \n%s" request) | 292 | (url-http-debug "Request is: \n%s" request) |
| 291 | request)) | 293 | request)) |