unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13187: 24.2; lisp/url/url-http.el
@ 2012-12-15  3:41 Devon Sean McCullough
  2015-12-25 21:20 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Devon Sean McCullough @ 2012-12-15  3:41 UTC (permalink / raw)
  To: 13187

* 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)
 




^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#13187: 24.2; lisp/url/url-http.el
  2012-12-15  3:41 bug#13187: 24.2; lisp/url/url-http.el Devon Sean McCullough
@ 2015-12-25 21:20 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-25 21:20 UTC (permalink / raw)
  To: Devon Sean McCullough; +Cc: 13187

Devon Sean McCullough <Emacs-Hacker2012@jovi.net> writes:

> * url-http documentation string omits essential info.

I've applied your patch to the doc string (with some changes) to the
Emacs trunk.

> * 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:

That's true, but I'm not sure that's really worth fixing...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-25 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-15  3:41 bug#13187: 24.2; lisp/url/url-http.el Devon Sean McCullough
2015-12-25 21:20 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).