diff options
| author | Glenn Morris | 2007-09-03 19:28:23 +0000 |
|---|---|---|
| committer | Glenn Morris | 2007-09-03 19:28:23 +0000 |
| commit | 72f252993b9d1a68155f92fa5ebb74fc7180d7e5 (patch) | |
| tree | 8b83993eaaeffaa1f92ebb1fbdecfbbd6847de59 | |
| parent | b7185a731cf3b899cd001e35e886467cb1ee8318 (diff) | |
| download | emacs-72f252993b9d1a68155f92fa5ebb74fc7180d7e5.tar.gz emacs-72f252993b9d1a68155f92fa5ebb74fc7180d7e5.zip | |
Diane Murray <disumu at x3y2z1.net>
(url-http-parse-headers): Bind the current buffer rather than calling
`url-mark-buffer-as-dead' with `current-buffer', so that the correct
buffer is killed if `url-retrieve-synchronously' gets redirected to a
new URL.
| -rw-r--r-- | lisp/url/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 15 |
2 files changed, 15 insertions, 7 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 7c03877a161..2e44dbe2af7 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2007-09-03 Diane Murray <disumu@x3y2z1.net> | ||
| 2 | |||
| 3 | * url-http.el: (url-http-parse-headers): Bind the current buffer | ||
| 4 | rather than calling `url-mark-buffer-as-dead' with | ||
| 5 | `current-buffer', so that the correct buffer is killed if | ||
| 6 | `url-retrieve-synchronously' gets redirected to a new URL. | ||
| 7 | |||
| 1 | 2007-08-31 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2007-08-31 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * url-parse.el (url): Use defstruct rather than macros. | 10 | * url-parse.el (url): Use defstruct rather than macros. |
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 148449d41cf..c5931c7d877 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -429,7 +429,8 @@ should be shown to the user." | |||
| 429 | (when (and connection | 429 | (when (and connection |
| 430 | (string= (downcase connection) "close")) | 430 | (string= (downcase connection) "close")) |
| 431 | (delete-process url-http-process))))) | 431 | (delete-process url-http-process))))) |
| 432 | (let ((class nil) | 432 | (let ((buffer (current-buffer)) |
| 433 | (class nil) | ||
| 433 | (success nil)) | 434 | (success nil)) |
| 434 | (setq class (/ url-http-response-status 100)) | 435 | (setq class (/ url-http-response-status 100)) |
| 435 | (url-http-debug "Parsed HTTP headers: class=%d status=%d" class url-http-response-status) | 436 | (url-http-debug "Parsed HTTP headers: class=%d status=%d" class url-http-response-status) |
| @@ -447,7 +448,7 @@ should be shown to the user." | |||
| 447 | ;; 100 = Continue with request | 448 | ;; 100 = Continue with request |
| 448 | ;; 101 = Switching protocols | 449 | ;; 101 = Switching protocols |
| 449 | ;; 102 = Processing (Added by DAV) | 450 | ;; 102 = Processing (Added by DAV) |
| 450 | (url-mark-buffer-as-dead (current-buffer)) | 451 | (url-mark-buffer-as-dead buffer) |
| 451 | (error "HTTP responses in class 1xx not supported (%d)" url-http-response-status)) | 452 | (error "HTTP responses in class 1xx not supported (%d)" url-http-response-status)) |
| 452 | (2 ; Success | 453 | (2 ; Success |
| 453 | ;; 200 Ok | 454 | ;; 200 Ok |
| @@ -461,14 +462,14 @@ should be shown to the user." | |||
| 461 | (case url-http-response-status | 462 | (case url-http-response-status |
| 462 | ((204 205) | 463 | ((204 205) |
| 463 | ;; No new data, just stay at the same document | 464 | ;; No new data, just stay at the same document |
| 464 | (url-mark-buffer-as-dead (current-buffer)) | 465 | (url-mark-buffer-as-dead buffer) |
| 465 | (setq success t)) | 466 | (setq success t)) |
| 466 | (otherwise | 467 | (otherwise |
| 467 | ;; Generic success for all others. Store in the cache, and | 468 | ;; Generic success for all others. Store in the cache, and |
| 468 | ;; mark it as successful. | 469 | ;; mark it as successful. |
| 469 | (widen) | 470 | (widen) |
| 470 | (if (and url-automatic-caching (equal url-http-method "GET")) | 471 | (if (and url-automatic-caching (equal url-http-method "GET")) |
| 471 | (url-store-in-cache (current-buffer))) | 472 | (url-store-in-cache buffer)) |
| 472 | (setq success t)))) | 473 | (setq success t)))) |
| 473 | (3 ; Redirection | 474 | (3 ; Redirection |
| 474 | ;; 300 Multiple choices | 475 | ;; 300 Multiple choices |
| @@ -584,7 +585,7 @@ should be shown to the user." | |||
| 584 | (url-retrieve-internal | 585 | (url-retrieve-internal |
| 585 | redirect-uri url-callback-function | 586 | redirect-uri url-callback-function |
| 586 | url-callback-arguments)) | 587 | url-callback-arguments)) |
| 587 | (url-mark-buffer-as-dead (current-buffer))) | 588 | (url-mark-buffer-as-dead buffer)) |
| 588 | ;; We hit url-max-redirections, so issue an error and | 589 | ;; We hit url-max-redirections, so issue an error and |
| 589 | ;; stop redirecting. | 590 | ;; stop redirecting. |
| 590 | (url-http-debug "Maximum redirections reached") | 591 | (url-http-debug "Maximum redirections reached") |
| @@ -625,7 +626,7 @@ should be shown to the user." | |||
| 625 | (url-http-handle-authentication nil)) | 626 | (url-http-handle-authentication nil)) |
| 626 | (402 | 627 | (402 |
| 627 | ;; This code is reserved for future use | 628 | ;; This code is reserved for future use |
| 628 | (url-mark-buffer-as-dead (current-buffer)) | 629 | (url-mark-buffer-as-dead buffer) |
| 629 | (error "Somebody wants you to give them money")) | 630 | (error "Somebody wants you to give them money")) |
| 630 | (403 | 631 | (403 |
| 631 | ;; The server understood the request, but is refusing to | 632 | ;; The server understood the request, but is refusing to |
| @@ -780,7 +781,7 @@ should be shown to the user." | |||
| 780 | (error "Unknown class of HTTP response code: %d (%d)" | 781 | (error "Unknown class of HTTP response code: %d (%d)" |
| 781 | class url-http-response-status))) | 782 | class url-http-response-status))) |
| 782 | (if (not success) | 783 | (if (not success) |
| 783 | (url-mark-buffer-as-dead (current-buffer))) | 784 | (url-mark-buffer-as-dead buffer)) |
| 784 | (url-http-debug "Finished parsing HTTP headers: %S" success) | 785 | (url-http-debug "Finished parsing HTTP headers: %S" success) |
| 785 | (widen) | 786 | (widen) |
| 786 | success)) | 787 | success)) |