[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [meek/master] Don't allow overriding the proxy per-request.



commit 6beb65b2dea5a68081f21da3abc2ec35b5cee286
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Thu Sep 25 01:45:02 2014 -0700

    Don't allow overriding the proxy per-request.
---
 doc/meek-client.1.txt      |    7 +++----
 meek-client/meek-client.go |   24 +++++-------------------
 2 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/doc/meek-client.1.txt b/doc/meek-client.1.txt
index 601836b..cc5036a 100644
--- a/doc/meek-client.1.txt
+++ b/doc/meek-client.1.txt
@@ -53,8 +53,7 @@ HTTPSProxy localhost:8080
 Socks4Proxy localhost:1080
 Socks5Proxy localhost:1080
 ----
-or, equivalently, using the **--proxy** command-line option or **proxy**
-SOCKS arg.
+or, equivalently, using the **--proxy** command-line option.
 
 When the **--helper** option is used, you can use any type of proxy:
 HTTP or SOCKS. Without **--helper**, you can only use an HTTP proxy.
@@ -73,8 +72,8 @@ OPTIONS
     URL of upstream proxy. For example,
     **--proxy=http://localhost:8080/**,
     **--proxy=socks4a://localhost:1080**, or
-    **--proxy=socks5://localhost:1080**. The **proxy** SOCKS arg
-    overrides the command line. You would normally control the proxy
+    **--proxy=socks5://localhost:1080**.
+    You would normally control the proxy
     using the **HTTPSProxy**, **Socks4Proxy**, or **Socks5Proxy**
     configuration options in a torrc file, instead of using this option.
 
diff --git a/meek-client/meek-client.go b/meek-client/meek-client.go
index 9024032..d39e06a 100644
--- a/meek-client/meek-client.go
+++ b/meek-client/meek-client.go
@@ -105,19 +105,17 @@ type RequestInfo struct {
 	// The Host header to put in the HTTP request (optional and may be
 	// different from the host name in URL).
 	Host string
-	// URL of an upstream proxy to use. If nil, no proxy is used.
-	ProxyURL *url.URL
 }
 
 // Do an HTTP roundtrip using the payload data in buf and the request metadata
 // in info.
 func roundTripWithHTTP(buf []byte, info *RequestInfo) (*http.Response, error) {
 	tr := new(http.Transport)
-	if info.ProxyURL != nil {
-		if info.ProxyURL.Scheme != "http" {
-			panic(fmt.Sprintf("don't know how to use proxy %s", info.ProxyURL.String()))
+	if options.ProxyURL != nil {
+		if options.ProxyURL.Scheme != "http" {
+			panic(fmt.Sprintf("don't know how to use proxy %s", options.ProxyURL.String()))
 		}
-		tr.Proxy = http.ProxyURL(info.ProxyURL)
+		tr.Proxy = http.ProxyURL(options.ProxyURL)
 	}
 	req, err := http.NewRequest("POST", info.URL.String(), bytes.NewReader(buf))
 	if err != nil {
@@ -303,18 +301,6 @@ func handler(conn *pt.SocksConn) error {
 		info.URL.Host = front
 	}
 
-	// First check proxy= SOCKS arg, then --proxy option/managed
-	// configuration.
-	proxy, ok := conn.Req.Args.Get("proxy")
-	if ok {
-		info.ProxyURL, err = url.Parse(proxy)
-		if err != nil {
-			return err
-		}
-	} else if options.ProxyURL != nil {
-		info.ProxyURL = options.ProxyURL
-	}
-
 	return copyLoop(conn, &info)
 }
 
@@ -380,7 +366,7 @@ func main() {
 	flag.StringVar(&options.Front, "front", "", "front domain name if no front= SOCKS arg")
 	flag.StringVar(&helperAddr, "helper", "", "address of HTTP helper (browser extension)")
 	flag.StringVar(&logFilename, "log", "", "name of log file")
-	flag.StringVar(&proxy, "proxy", "", "proxy URL if no proxy= SOCKS arg")
+	flag.StringVar(&proxy, "proxy", "", "proxy URL")
 	flag.StringVar(&options.URL, "url", "", "URL to request if no url= SOCKS arg")
 	flag.Parse()
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits