Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mono - HttpWebRequest over SSL - Error writing headers

Tags:

mono

The below throws a System.Net.WebException - Error:SendFailure (Error writing headers) over SSL but works fine for http://www.google.com

using System;
using System.Web;
using System.Net;
using System.IO;

namespace HTTPS_Headers
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            var request = (HttpWebRequest)WebRequest.Create ("https://www.google.co.uk/?q=mono");

            using(var reader = new StreamReader(request.GetResponse().GetResponseStream())) {

                Console.WriteLine (reader.ReadToEnd ());
            }

            Console.ReadLine();
        }
    }
}

I am running this on Mono 3.4.0/Lubuntu 14.04. Works fine over SSL on Windows/.NET 4.

like image 242
Myles McDonnell Avatar asked Aug 01 '14 13:08

Myles McDonnell


1 Answers

Try running the following on your machine to import trusted root certificates:

mozroots --import --sync
like image 75
Matt Ward Avatar answered Nov 15 '22 23:11

Matt Ward