[tor-commits] [meek/master] Return an error string for request format errors.

dcf at torproject.org dcf at torproject.org
Thu Jun 12 03:20:57 UTC 2014


commit 77e4bff0fb29b214fb3641b943da5c809b29aff3
Author: David Fifield <david at bamsoftware.com>
Date:   Wed Jun 11 20:18:46 2014 -0700

    Return an error string for request format errors.
    
    Previously we just closed the socket. I was trying to use a plain http
    URL through the helper, which isn't allowed by requestOK. (This is just
    a safety feature because none of our deployment is planned to use plain
    http.) It took me a little while to figure out what was going wrong. Now
    you will get a line in the meek-client log:
    
    error in handling request: helper returned error: request failed validation
---
 firefox/components/main.js |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/firefox/components/main.js b/firefox/components/main.js
index 4265f97..841c6f1 100644
--- a/firefox/components/main.js
+++ b/firefox/components/main.js
@@ -184,7 +184,7 @@ MeekHTTPHelper.LocalConnectionHandler.prototype = {
     makeRequest: function(req) {
         // dump("makeRequest " + JSON.stringify(req) + "\n");
         if (!this.requestOk(req)) {
-            this.transport.close(0);
+            this.returnResponse({"error": "request failed validation"});
             return;
         }
 
@@ -192,8 +192,7 @@ MeekHTTPHelper.LocalConnectionHandler.prototype = {
         // dump("using proxy " + JSON.stringify(req.proxy) + "\n");
         var proxyInfo = MeekHTTPHelper.buildProxyInfo(req.proxy);
         if (proxyInfo === null) {
-            dump("can't create nsIProxyInfo from " + JSON.stringify(req.proxy) + "\n");
-            this.transport.close(0);
+            this.returnResponse({"error": "can't create nsIProxyInfo from " + JSON.stringify(req.proxy)});
             return;
         }
 



More information about the tor-commits mailing list