[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117972: Do not set `url-gateway-method' in `url-htt
From: |
Ulf Jasper |
Subject: |
[Emacs-diffs] trunk r117972: Do not set `url-gateway-method' in `url-https'. (Bug#16543) |
Date: |
Mon, 29 Sep 2014 08:18:38 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117972 [merge]
revision-id: address@hidden
parent: address@hidden
parent: address@hidden
committer: Ulf Jasper <address@hidden>
branch nick: trunk
timestamp: Mon 2014-09-29 10:18:32 +0200
message:
Do not set `url-gateway-method' in `url-https'. (Bug#16543)
Currently, when `url-retrieve' is called for an https url it modifies
the variable `url-gateway-method'. This has been changed to
explicitly pass the requested gateway method to other functions.
When `url-retrieve' is being processed then (via
`accept-process-output') another `url-retrieve' call from a pending
timer can be started. The second call would always see the modified
`url-gateway-method' of the first one, which in general does not match
the url.
2014-09-28 Ulf Jasper <address@hidden>
* url-gw.el (url-open-stream): New optional parameter
`gateway-method'. If non-nil use it instead of global variable
`url-gateway-method'.
* url/url-http.el (url-http): New optional parameter
`gateway-method', pass it to `url-http-find-free-connection'.
(url-http-find-free-connection): New optional parameter
gateway-method, pass it to `url-open-stream'.
(url-https-create-secure-wrapper): Do not modify
`url-gateway-method' but explicitly provide 'tls as gateway-method
parameter to `url-https'.
modified:
lisp/url/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-3116
lisp/url/url-gw.el urlgw.el-20091113204419-o5vbwnq5f7feedwu-2986
lisp/url/url-http.el urlhttp.el-20091113204419-o5vbwnq5f7feedwu-2989
=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog 2014-09-22 19:20:45 +0000
+++ b/lisp/url/ChangeLog 2014-09-28 18:00:54 +0000
@@ -1,3 +1,17 @@
+2014-09-28 Ulf Jasper <address@hidden>
+
+ * url-gw.el (url-open-stream): New optional parameter
+ `gateway-method'. If non-nil use it instead of global variable
+ `url-gateway-method'.
+
+ * url/url-http.el (url-http): New optional parameter
+ `gateway-method', pass it to `url-http-find-free-connection'.
+ (url-http-find-free-connection): New optional parameter
+ gateway-method, pass it to `url-open-stream'.
+ (url-https-create-secure-wrapper): Do not modify
+ `url-gateway-method' but explicitly provide 'tls as gateway-method
+ parameter to `url-https'.
+
2014-09-22 Dmitry Gutov <address@hidden>
* url.el (url-retrieve-internal): Clarify the docstring.
=== modified file 'lisp/url/url-gw.el'
--- a/lisp/url/url-gw.el 2014-03-29 00:55:44 +0000
+++ b/lisp/url/url-gw.el 2014-09-28 18:00:54 +0000
@@ -203,20 +203,24 @@
proc)))
;;;###autoload
-(defun url-open-stream (name buffer host service)
+(defun url-open-stream (name buffer host service &optional gateway-method)
"Open a stream to HOST, possibly via a gateway.
Args per `open-network-stream'.
Will not make a connection if `url-gateway-unplugged' is non-nil.
-Might do a non-blocking connection; use `process-status' to check."
+Might do a non-blocking connection; use `process-status' to check.
+
+Optional arg GATEWAY-METHOD specifies the gateway to be used,
+overriding the value of `url-gateway-method'."
(unless url-gateway-unplugged
- (let ((gw-method (if (and url-gateway-local-host-regexp
- (not (eq 'tls url-gateway-method))
- (not (eq 'ssl url-gateway-method))
- (string-match
- url-gateway-local-host-regexp
- host))
- 'native
- url-gateway-method))
+ (let* ((gwm (or gateway-method url-gateway-method))
+ (gw-method (if (and url-gateway-local-host-regexp
+ (not (eq 'tls gwm))
+ (not (eq 'ssl gwm))
+ (string-match
+ url-gateway-local-host-regexp
+ host))
+ 'native
+ gwm))
;; An attempt to deal with denied connections, and attempt
;; to reconnect
(cur-retries 0)
=== modified file 'lisp/url/url-http.el'
--- a/lisp/url/url-http.el 2014-09-22 19:20:45 +0000
+++ b/lisp/url/url-http.el 2014-09-28 18:00:54 +0000
@@ -171,7 +171,7 @@
url-http-open-connections))
nil)
-(defun url-http-find-free-connection (host port)
+(defun url-http-find-free-connection (host port &optional gateway-method)
(let ((conns (gethash (cons host port) url-http-open-connections))
(connection nil))
(while (and conns (not connection))
@@ -193,7 +193,7 @@
;; `url-open-stream' needs a buffer in which to do things
;; like authentication. But we use another buffer afterwards.
(unwind-protect
- (let ((proc (url-open-stream host buf host port)))
+ (let ((proc (url-open-stream host buf host port gateway-method)))
;; url-open-stream might return nil.
(when (processp proc)
;; Drop the temp buffer link before killing the buffer.
@@ -1167,7 +1167,7 @@
(when (eq process-buffer (current-buffer))
(goto-char (point-max)))))
-(defun url-http (url callback cbargs &optional retry-buffer)
+(defun url-http (url callback cbargs &optional retry-buffer gateway-method)
"Retrieve URL via HTTP asynchronously.
URL must be a parsed URL. See `url-generic-parse-url' for details.
@@ -1178,11 +1178,14 @@
doubt, specify nil).
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.
+
+Optional arg GATEWAY-METHOD specifies the gateway to be used,
+overriding the value of `url-gateway-method'."
(cl-check-type url vector "Need a pre-parsed URL.")
(let* ((host (url-host (or url-using-proxy url)))
(port (url-port (or url-using-proxy url)))
- (connection (url-http-find-free-connection host port))
+ (connection (url-http-find-free-connection host port gateway-method))
(buffer (or retry-buffer
(generate-new-buffer
(format " *http %s:%d*" host port)))))
@@ -1440,9 +1443,8 @@
(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"))
- (let ((url-gateway-method 'tls))
- (,(intern (format (if method "url-http-%s" "url-http") method))
- ,@(remove '&rest (remove '&optional args))))))
+ (,(intern (format (if method "url-http-%s" "url-http") method))
+ ,@(remove '&rest (remove '&optional (append args (if method nil '(nil
'tls))))))))
;;;###autoload (autoload 'url-https "url-http")
(url-https-create-secure-wrapper nil (url callback cbargs))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117972: Do not set `url-gateway-method' in `url-https'. (Bug#16543),
Ulf Jasper <=