mozilla/browserid — pull request #2621 by 6a68 (2012-10-18 20:58:28+00:00)
Title: Add a timeout when trying to fetch a well-known. Fixes #2603.

See discussion in #2603 of how SSL connections to some IdPs, e.g. yahoo domains of the form https://yahoo.co.uk, hang forever.

There's a 15 second timeout somewhere in squid or node, but the front-end dialog code looks like it shows the "this is taking a while" error message after 10 seconds.

So, to strike a balance between letting slow IdPs negotiate SSL connection and serve the well-known in time, but also forcing fallback to happen in a timely manner, I pegged the timeout at 8 sec.

I'm not sure how to easily test this, but I could be convinced it's worth spending time figuring out how to do it. My immediate thoughts are: hack the request object to always fire a timeout, monkey-patch the clock to make it look like the timeout has elapsed, or use a wrapper around node to really hold the socket open long enough to cause a timeout (don't like this idea, seems slow and hacky for a unit test).