bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13187: 24.2; lisp/url/url-http.el


From: Devon Sean McCullough
Subject: bug#13187: 24.2; lisp/url/url-http.el
Date: Fri, 14 Dec 2012 22:41:54 -0500

* url-http documentation string omits essential info.
* url-https source cannot be found by Help nor etags.
* url-https definition cannot be found by text search
        as it omits the defined and defining function names.
Here's a fix:

--- url-http.el.~1~     2012-08-23 01:33:42.000000000 -0400
+++ url-http.el 2012-12-14 21:28:51.000000000 -0500
@@ -1177,10 +1177,12 @@
   "Retrieve URL via HTTP asynchronously.
 URL must be a parsed URL.  See `url-generic-parse-url' for details.
 When retrieval is completed, the function CALLBACK is executed with
-CBARGS as the arguments.
+CBARGS as the arguments and the retrieval buffer as current.
 
 Optional arg RETRY-BUFFER, if non-nil, specifies the buffer of a
-previous `url-http' call, which is being re-attempted."
+previous `url-http' call, which is being re-attempted.
+
+Return the retrieval buffer."
   (check-type url vector "Need a pre-parsed URL.")
   (declare (special url-current-object
                    url-http-end-of-headers
@@ -1213,45 +1215,27 @@
        (mm-disable-multibyte)
        (setq url-current-object url
              mode-line-format "%b [%s]")
-
-       (dolist (var '(url-http-end-of-headers
-                      url-http-content-type
-                      url-http-content-length
-                      url-http-transfer-encoding
-                      url-http-after-change-function
-                      url-http-response-version
-                      url-http-response-status
-                      url-http-chunked-length
-                      url-http-chunked-counter
-                      url-http-chunked-start
-                      url-callback-function
-                      url-callback-arguments
-                      url-show-status
-                      url-http-process
-                      url-http-method
-                      url-http-extra-headers
-                      url-http-data
-                      url-http-target-url
-                      url-http-no-retry
-                      url-http-connection-opened
-                      url-http-proxy))
-         (set (make-local-variable var) nil))
-
-       (setq url-http-method (or url-request-method "GET")
-             url-http-extra-headers url-request-extra-headers
-             url-http-data url-request-data
-             url-http-process connection
-             url-http-chunked-length nil
-             url-http-chunked-start nil
-             url-http-chunked-counter 0
-             url-callback-function callback
-             url-callback-arguments cbargs
-             url-http-after-change-function 
'url-http-wait-for-headers-change-function
-             url-http-target-url url-current-object
-             url-http-no-retry retry-buffer
-             url-http-connection-opened nil
-             url-http-proxy url-using-proxy)
-
+       (set (make-local-variable 'url-http-method) (or url-request-method 
"GET"))
+       (set (make-local-variable 'url-http-extra-headers) 
url-request-extra-headers)
+       (set (make-local-variable 'url-http-data) url-request-data)
+       (set (make-local-variable 'url-http-process) connection)
+       (set (make-local-variable 'url-http-chunked-length) nil)
+       (set (make-local-variable 'url-http-chunked-start) nil)
+       (set (make-local-variable 'url-http-chunked-counter) 0)
+       (set (make-local-variable 'url-callback-function) callback)
+       (set (make-local-variable 'url-callback-arguments) cbargs)
+       (set (make-local-variable 'url-http-after-change-function) 
'url-http-wait-for-headers-change-function)
+       (set (make-local-variable 'url-http-target-url) url-current-object)
+       (set (make-local-variable 'url-http-no-retry) retry-buffer)
+       (set (make-local-variable 'url-http-connection-opened) nil)
+       (set (make-local-variable 'url-http-proxy) url-using-proxy)
+       (set (make-local-variable 'url-http-content-length) ())
+       (set (make-local-variable 'url-http-content-type) ())
+       (set (make-local-variable 'url-http-end-of-headers) ())
+       (set (make-local-variable 'url-http-response-status) ())
+       (set (make-local-variable 'url-http-response-version) ())
+       (set (make-local-variable 'url-http-transfer-encoding) ())
+       (set (make-local-variable 'url-show-status) ())
        (set-process-buffer connection buffer)
        (set-process-filter connection 'url-http-generic-filter)
        (let ((status (process-status connection)))
@@ -1465,21 +1449,25 @@
 ;;;###autoload
 (defalias 'url-https-expand-file-name 'url-default-expander)
 
-(defmacro url-https-create-secure-wrapper (method args)
-  `(defun ,(intern (format (if method "url-https-%s" "url-https") method)) 
,args
-    ,(format "HTTPS wrapper around `%s' call." (or method "url-http"))
+(defmacro define-url-https-secure-wrapper (name insecure-name)
+  (let* ((arglist (progn (require 'help-fns)
+                        (help-function-arglist insecure-name 'preserve-names)))
+        (arguments (remove '&rest
+                           (remove '&optional
+                                   arglist))))
+  `(defun ,name ,arglist
+    ,(format "Https wrapper around `%s' call." insecure-name)
     (let ((url-gateway-method 'tls))
-      (,(intern (format (if method "url-http-%s" "url-http") method))
-       ,@(remove '&rest (remove '&optional args))))))
+      (,insecure-name .,arguments)))))
 
 ;;;###autoload (autoload 'url-https "url-http")
-(url-https-create-secure-wrapper nil (url callback cbargs))
+(define-url-https-secure-wrapper url-https url-http)
 ;;;###autoload (autoload 'url-https-file-exists-p "url-http")
-(url-https-create-secure-wrapper file-exists-p (url))
+(define-url-https-secure-wrapper url-https-file-exists-p 
url-http-file-exists-p)
 ;;;###autoload (autoload 'url-https-file-readable-p "url-http")
-(url-https-create-secure-wrapper file-readable-p (url))
+(define-url-https-secure-wrapper url-https-file-readable-p 
url-http-file-readable-p)
 ;;;###autoload (autoload 'url-https-file-attributes "url-http")
-(url-https-create-secure-wrapper file-attributes (url &optional id-format))
+(define-url-https-secure-wrapper url-https-file-attributes 
url-http-file-attributes)
 
 (provide 'url-http)
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]