The binaryType can be "arraybuffer" or "blob", and "blob" is the
default. The code is only aware of "arraybuffer": I discovered a problem
while running snowflake.html in debug mode; this code fails:
if DEBUG
# Go sends only raw bytes...
if '[object ArrayBuffer]' == recv.toString()
bytes = new Uint8Array recv
line = String.fromCharCode.apply(null, bytes)
line = line.trim()
log 'WebRTC --> websocket data: ' + line
with the error:
TypeError: line.trim is not a function[Learn More] snowflake.js:497:16
because recv is of type Blob, not ArrayBuffer.
Despite the unexpected type, the code seemed to work as expected when
not in debug mode. Though the two types provide different interfaces,
they are both valid to pass on to WebSocket.send. The only other thing
we did with it was try to read the .length member for rate-limiting
purposes:
@rateLimit.update chunk.length
but .length is incorrect for either type: Blob uses .size and
ArrayBuffer uses .byteLength. It worked anyway, because
DummyRateLimit.update doesn't actually look at its argument.
We were already setting binaryType="arraybuffer" for WebSocket
connections.
ReferenceError: age is not defined snowflake.js:265:7
BucketRateLimit.prototype.when snowflake/proxy/build/snowflake.js:265:7
ProxyPair.prototype.flush snowflake/proxy/build/snowflake.js:558:63
bind/< snowflake/proxy/build/snowflake.js:10:56
ProxyPair.prototype.onClientToRelayMessage snowflake/proxy/build/snowflake.js:495:14
bind/< snowflake/proxy/build/snowflake.js:10:56
You can nest a "describe" in a "describe":
describe
describe
it
But you can't nest an "it" in an "it":
describe
it
it
The nested "it"s were not getting run (or getting run, but their output
ignored, I'm not sure).
Before this change:
41 specs, 0 failures
After:
44 specs, 5 failures
https://bugs.torproject.org/25600#comment:14
Snowflake in Tor Browser has been hanging after surfing for a while.
(Tor reports "no running bridges".) It only began happening after commit
12922a232b, which caused snowflake-client not to log to a file by
default (leaving it to log to its default stderr). What seems to be
happening is that tor doesn't read from its PT clients' stderr, leaving
a buffer to fill up that eventually causes a hang.
The semicolons made it look like the end of a declaration. I got these
errors in the Firefox console:
Expected declaration but found ‘1px’. Skipped to next declaration. 1 embed.html:29:17
Expected declaration but found ‘-1px’. Skipped to next declaration. 1 embed.html:30:17
I'm intuiting that the purpose of linking to github was to show the
README, not to link to the source code per se, so I changed the link to
point to the wiki page rather than gitweb.torproject.org/....
https://bugs.torproject.org/23947#comment:15
https://bugs.torproject.org/25344
5s matches DEFAULT_BROKER_POLL_INTERVAL in the JavaScript proxy.
This is set up so as long as the actual HTTPS requests take less time
than pollInterval, there will a steady one poll per pollInterval. If the
HTTPS requests take longer than that, there will be no delay between
polls.
This is a port of commit e3f3054f8b74caa639a6d9be09702693af9a70e7 from
meek.
In the previous commit, we changed from separate Listen and Serve steps
to always calling ListenAndServe. However, we would really like to
immediately get feedback if any errors happen in the Listen step inside
the call, because it's much better for debugging if those errors get
reported to tor through SMETHOD-ERROR--rather than reporting success to
tor and actually logging an error only in the snowflake log. So we wait
100 ms for an error to occur before deciding that the Listen succeeded.
We don't need to apply this hack to the ACME HTTP-01 listener, because
it's a plaintext listener. Unlike in the TLS case, there isn't any
internal magic that the net library does that we have to rely on. We
just call net.ListenTCP and check for an error.
This is a port of commit cea86c937dc278ba6b2100c238b1d5206bbae2f0 from
meek. Its purpose is to remove the need to copy-paste parts of
net/http.Server.ListenAndServeTLS. Here is a copy of the commit message
from meek:
The net/http package provides ListenAndServe and ListenAndServeTLS
functions, but it doesn't provide a way to set up a listener without
also entering an infinite serve loop. This matters for
ListenAndServeTLS, which sets up a lot of magic behind the scenes for
TLS and HTTP/2 support. Formerly, we had copy-pasted code from
ListenAndServeTLS, but that code has only gotten more complicated in
upstream net/http.
The price we pay for this is that it's no longer possible for a server
bindaddr to ask to listen on port 0 (i.e., a random ephemeral port).
That's because we never get a change to find out what the listening
address is, before entering the serve loop.
What we gain is HTTP/2 support; formerly our copy-pasted code had the
side effect of disabling HTTP/2, because it was copied from an older
version and did things like
config.NextProtos = []string{"http/1.1"}
The new code calls http2.ConfigureServer first, but that's not what's
providing HTTP/2 support. HTTP/2 support happens by default. The reason
we call http2.ConfigureServer is because we need to set
TLSConfig.GetCertificate, and http2.ConfigureServer is a convenient way
to initialize TLSConfig in a way that is guaranteed to work with HTTP/2.
As with commit fcc274ac68 for the broker,
we need to start using the HTTP-01 challenge type in the Snowflake
websocket server transport plugin.
https://bugs.torproject.org/25346