Meek bridges (amazon and azure) don't work on both windows7 and wheezy.
Tor launcher error messages:
Tor failed to establish a Tor network connection.
Loading network status failed (done).
Tor log:
[NOTICE] Bootstrapped 5%: Connecting to directory server
[NOTICE] Bootstrapped 10%: Finishing handshake with directory server
[WARN] Problem bootstrapping. Stuck at 10%: Finishing handshake with
directory server. (DONE; DONE; count 1; recommendation warn)
[WARN] 1 connections have failed:
[WARN] 1 connections died in state handshaking (TLS) with SSL state
SSLv2/v3 read server hello A in HANDSHAKE
Meek client Debug messages on Windows:
using helper on 127.0.0.1:49929
listening on 127.0.0.1:49932
error in handling request: WSARecv tcp 127.0.0.1:49934: i/o timeout
Designs
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
I tried setting privacy.thirdparty.isolate=0 in profile.meek-http-helper. It made the getFirstPartyURI errors go away, but the "Component returned failure code: 0x80040111" one remained and it still didn't work.
Regarding the other problem, looking here:
http://mxr.mozilla.org/mozilla-esr31/source/netwerk/protocol/http/HttpBaseChannel.cpp#1232
it seems like the request did not complete successfully. I am not sure why that would be the case, but I think the onStopRequest code should execute a test like this:
{{{
if (Components.isSuccessCode(status)) {
}}}
before trying to access responseStatus.
We already do the isSuccessCode(status) check a couple of lines later, at main.js:398. The error is happening at main.js:396 when trying to index context, not when reading status.
There's something internal to Tor Browser that is blocking the request. It's not just a remote server error—those already happen frequently in normal use and the code handles them. Something (something new in 4.5-alpha-1) is preventing the request from even being sent. We can make the code handle this case gracefully, but we'll also have to find out what prevents the requests from being sent in order for the pluggable transport to work.
I don't really know what I'm looking at, but this looks promising. The 4.0 log has this:
nsSocketTransport::ResolveHost [this=7fbe015e6140 ajax.aspnetcdn.com:443]nsSocketTransport::SendStatus [this=7fbe015e6140 status=804b0003]Resolving host [ajax.aspnetcdn.com]. No usable address in cache for [ajax.aspnetcdn.com] DNS thread counters: total=1 any-live=0 idle=0 pending=1 DNS lookup for host [ajax.aspnetcdn.com] blocking pending 'getaddrinfo' query: callback [7fbe00207650] advancing to STATE_RESOLVING
while the 4.5-alpha-1 log has this:
nsSocketTransport::ResolveHost [this=7fc7bcda9c60 :65535] nsSocketTransport::SendStatus [this=7fc7bcda9c60 status=804b0003] after event [this=7fc7bcda9c60 cond=8000ffff]
This one makes the headless browser not headless, so you can Ctrl+J and view the Browser Console. To apply it, you need to first unzip the xpi.
cd Browser/TorBrowser/Data/Browser/profile.meek-http-helper/extensionsmkdir meek-http-helper@bamsoftware.comcd meek-http-helper@bamsoftware.comunzip ../meek-http-helper@bamsoftware.com.xpirm ../meek-http-helper@bamsoftware.com# Now edit meek-http-helper@bamsoftware.com/components/main.js.
Unfortunately I don't know of a way to view the browser dump messages out of the box, but you can do it by patching meek-client-torbrowser to log those messages. You also have to enable logging by adding the --log option to the ClientTransportPlugin line (note meek-client-torbrowser and meek-client have separate logs). The log will be written to Browser/meek-client-torbrowser.log.
--- a/meek-client-torbrowser/meek-client-torbrowser.go+++ b/meek-client-torbrowser/meek-client-torbrowser.go@@ -102,6 +102,7 @@ func grepHelperAddr(r io.Reader) (string, error) { scanner := bufio.NewScanner(r) for scanner.Scan() { line := scanner.Text()+ log.Print(line) if m := helperAddrPattern.FindStringSubmatch(line); m != nil { helperAddr = m[1] break@@ -116,7 +117,12 @@ func grepHelperAddr(r io.Reader) (string, error) { return "", io.EOF } // Keep reading from the browser to avoid its output buffer filling.- go io.Copy(ioutil.Discard, r)+ go func() {+ for scanner.Scan() {+ line := scanner.Text()+ log.Print(line)+ }+ }() return helperAddr, nil }
I usually just symlink Browser/TorBrowser/Tor/PluggableTransports/meek-client-torbrowser to my development build of meek-client-torbrowser when I'm testing something like this. To build meek-client-torbrowser,
There are also some commented log.Printf calls in meek-client itself that log when it tries to make a request. However I think the error happening somewhere inside Firefox; none of the meek code changed since 4.0.
Unfortunately I don't know of a way to view the browser dump messages out of the box, but you can do it by patching meek-client-torbrowser to log those messages. You also have to enable logging by adding the --log option to the ClientTransportPlugin line (note meek-client-torbrowser and meek-client have separate logs). The log will be written to Browser/meek-client-torbrowser.log.
When I do this, I just get the same message on stdout that I got in the browser console.
2014/11/24 15:41:04 running firefox command ["./firefox" "-no-remote" "-profile" "/home/david/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.meek-http-helper"]2014/11/24 15:41:04 firefox started with pid 319542014/11/24 15:41:04 meek-http-helper: listen 127.0.0.1:513112014/11/24 15:41:04 running meek-client command ["./TorBrowser/Tor/PluggableTransports/meek-client" "--helper" "127.0.0.1:51311"]2014/11/24 15:41:04 meek-client started with pid 319682014/11/24 15:41:06 ************************************************************2014/11/24 15:41:06 * Call to xpconnect wrapped JSObject produced this error: *2014/11/24 15:41:06 [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIHttpChannel.responseStatus]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: file:///home/david/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.meek-http-helper/extensions/meek-http-helper@bamsoftware.com/components/main.js :: MeekHTTPHelper.HttpStreamListener.prototype.onStopRequest :: line 396" data: no]2014/11/24 15:41:06 ************************************************************
And I think I know what is going on: nsSocketTransport::SocketHost() is using the host of the nsIProxyInfo if there is any. And per default meek is creating an HTTP channel with a nsIProxyInfo which is instructing the browser to make a direct connection (type DIRECT). Thus, the host is empty but is nevertheless selected as the socket host as
if (mProxyInfo && !mProxyTransparent) {
is true. I guess we should just check that we not only have an nsIProxyInfo but a non-empty host as well (nsSocketTransport::SocketPort() is affected, too). Arthur?
(dcf - thanks for the logs they were pretty helpful and saved me some time :) )
And I think I know what is going on: nsSocketTransport::SocketHost() is using the host of the nsIProxyInfo if there is any. And per default meek is creating an HTTP channel with a nsIProxyInfo which is instructing the browser to make a direct connection (type DIRECT). Thus, the host is empty but is nevertheless selected as the socket host as
{{{
if (mProxyInfo && !mProxyTransparent) {
}}}
is true. I guess we should just check that we not only have an nsIProxyInfo but a non-empty host as well (nsSocketTransport::SocketPort() is affected, too). Arthur?
Thanks gk, that's great.
In case anyone is wondering why the code works like that (setting a proxy with a "direct" type instead of simply setting no proxy), it is just a failsafe; see legacy/trac#12674 (moved). Just in case something goes wrong and the extension shows a browser window, the global proxy setting in the extension profile is a non-working "blackhole" proxy. That is, the default proxy setting is blackholed, and the extension has to specifically ask to turn off the proxy for every request that it makes.
I tried this patch (copying the host and port from the URI into the "direct" nsIProxyInfo, rather than using empty values), but it didn't work. It also didnt' work if I hardcoded 443 for the port.
--- a/firefox/components/main.js+++ b/firefox/components/main.js@@ -149,3 +149,3 @@ MeekHTTPHelper.lookupStatus = function(status) { // {"type": "socks4a", "host": "example.com", "port": 1080}-MeekHTTPHelper.buildProxyInfo = function(spec) {+MeekHTTPHelper.buildProxyInfo = function(spec, uri) { // https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIProxyInfo#Constants@@ -154,3 +154,3 @@ MeekHTTPHelper.buildProxyInfo = function(spec) { // "direct"; i.e., no proxy. This is the default.- return MeekHTTPHelper.proxyProtocolService.newProxyInfo("direct", "", 0, flags, 0xffffffff, null);+ return MeekHTTPHelper.proxyProtocolService.newProxyInfo("direct", uri.host, uri.port, flags, 0xffffffff, null); } else if (spec.type === "http") {@@ -198,5 +198,7 @@ MeekHTTPHelper.LocalConnectionHandler.prototype = {+ var uri = MeekHTTPHelper.ioService.newURI(req.url, null, null);+ // Check what proxy to use, if any. // dump("using proxy " + JSON.stringify(req.proxy) + "\n");- var proxyInfo = MeekHTTPHelper.buildProxyInfo(req.proxy);+ var proxyInfo = MeekHTTPHelper.buildProxyInfo(req.proxy, uri); if (proxyInfo === null) {@@ -208,3 +210,2 @@ MeekHTTPHelper.LocalConnectionHandler.prototype = { // https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIHttpChannel- var uri = MeekHTTPHelper.ioService.newURI(req.url, null, null); this.channel = MeekHTTPHelper.httpProtocolHandler.newProxiedChannel(uri, proxyInfo, 0, null)
I'm posting a fixup here that simplifies that patch (e0eaf6b4) and restores the use of !mProxyHost.IsEmpty() in nsSocketTransport2.*. I did this work in trying to get the patch to land in mozilla-central (still working on that). The patch works for domain isolation, but I haven't had a chance to test it with meek. If anyone wants to give it a try, let me know if this helps.