restsharp/RestSharp — pull request #289 by aroben (2012-06-19 15:11:22+00:00)
Title: Don't crash on captive networks that intercept SSL

Some captive WiFi networks intercept SSL traffic using an untrusted
certificate. This causes HttpWebRequest.EndGetRequestStream to throw a
TrustFailure WebException with the following message:

The underlying connection was closed: Could not establish trust
relationship for the SSL/TLS secure channel.

Http.RequestStreamCallback was ignoring this exception, which caused us
to call HttpWebRequest.BeginGetResponse even though we hadn't written
the request body to the request stream. This caused a
ProtocolViolationException to be thrown and was the cause of the crash.

We now handle all kinds of exceptions (and still special-case
RequestCanceled exceptions). I made a similar change in
Http.ResponseCallback even though I didn't personally run into a bug
there.