Apply patch from Mario Kosmiskaso fix bug 1204: Add certificate to the HttpWebRequest...
authorMiguel de Icaza <miguel@gnome.org>
Sun, 16 Oct 2011 15:31:56 +0000 (11:31 -0400)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 16 Oct 2011 15:45:59 +0000 (11:45 -0400)
System.ServiceModel.Channels.HttpRequestChannel never added the configured
certificate to the HttpWebRequest which prevented client side authentication.

The attached patch does exactly that if a certificate has been configured.

mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs

index 227d1910a1d5514e84d7eb1baaa8533af7450945..4ea1dcda1aba833d9d2669265c2c7f21e60797cf 100644 (file)
@@ -164,6 +164,9 @@ namespace System.ServiceModel.Channels
                                        suppressEntityBody = true;
                        }
 
+                       if (source.ClientCredentials.ClientCertificate.Certificate != null) 
+                               ((HttpWebRequest)web_request).ClientCertificates.Add (source.ClientCredentials.ClientCertificate.Certificate);
+
                        if (!suppressEntityBody && String.Compare (web_request.Method, "GET", StringComparison.OrdinalIgnoreCase) != 0) {
                                MemoryStream buffer = new MemoryStream ();
                                Encoder.WriteMessage (message, buffer);