Commit 9b98ba3
committed
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.1 parent db44f42 commit 9b98ba3
1 file changed
+20
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
198 | 199 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 200 | + | |
202 | 201 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 202 | + | |
207 | 203 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
212 | 211 | | |
213 | 212 | | |
214 | 213 | | |
| |||
297 | 296 | | |
298 | 297 | | |
299 | 298 | | |
300 | | - | |
| 299 | + | |
301 | 300 | | |
302 | | - | |
| 301 | + | |
303 | 302 | | |
304 | 303 | | |
305 | | - | |
306 | | - | |
307 | 304 | | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
314 | 311 | | |
315 | 312 | | |
316 | 313 | | |
| |||
0 commit comments