[mono/mono] 613906e0: Further reduce the chance of an NRE in WebConnection, ref: 55f400b6446024adef5dcc8cc690b6951af98125
| Newsgroups | gmane.comp.gnome.mono.patches |
|---|---|
| Message-ID | <000001422a41e476-bc3527b9-820a-4039-8b47-a9a6fe977f4a-000000@email.amazonses.com> |
Branch: refs/heads/master
Home: https://github.com/mono/mono
Compare: https://github.com/mono/mono/compare/fe80190fc4d2...613906e04b7d
Commit: 613906e04b7d1f496c242a926b08bf0dbaddbba7
Author: Sebastien Pouliot <[email protected]> (spouliot)
Date: 2013-11-05 21:52:19 GMT
URL: https://github.com/mono/mono/commit/613906e04b7d1f496c242a926b08bf0dbaddbba7
Further reduce the chance of an NRE in WebConnection, ref: 55f400b6446024adef5dcc8cc690b6951af98125
Changed paths:
M mcs/class/System/System.Net/WebConnection.cs
Modified: mcs/class/System/System.Net/WebConnection.cs
===================================================================
@@ -613,16 +613,16 @@ static bool ExpectContent (int statusCode, string method)
return (statusCode >= 200 && statusCode != 204 && statusCode != 304);
}
- internal void GetCertificates ()
+ internal void GetCertificates (Stream stream)
{
// here the SSL negotiation have been done
#if SECURITY_DEP && MONOTOUCH
- HttpsClientStream s = (nstream as HttpsClientStream);
+ HttpsClientStream s = (stream as HttpsClientStream);
X509Certificate client = s.SelectedClientCertificate;
X509Certificate server = s.ServerCertificate;
#else
- X509Certificate client = (X509Certificate) piClient.GetValue (nstream, null);
- X509Certificate server = (X509Certificate) piServer.GetValue (nstream, null);
+ X509Certificate client = (X509Certificate) piClient.GetValue (stream, null);
+ X509Certificate server = (X509Certificate) piServer.GetValue (stream, null);
#endif
sPoint.SetCertificates (client, server);
certsAvailable = (server != null);
@@ -1144,16 +1144,16 @@ internal bool Write (HttpWebRequest request, byte [] buffer, int offset, int siz
lock (this) {
if (Data.request != request)
throw new ObjectDisposedException (typeof (NetworkStream).FullName);
- if (nstream == null)
- return false;
s = nstream;
+ if (s == null)
+ return false;
}
try {
s.Write (buffer, offset, size);
// here SSL handshake should have been done
if (ssl && !certsAvailable)
- GetCertificates ();
+ GetCertificates (s);
} catch (Exception e) {
err_msg = e.Message;
WebExceptionStatus wes = WebExceptionStatus.SendFailure;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches