[Mono-list] bug in HttpWebRequest and https ?

Harobed mailing@harobed.org
Tue, 13 Jul 2004 01:26:25 +0200


This code get web page from "https://" URL.
When I start this code, I've this error :

Unhandled Exception: System.Net.WebException: Error getting response
stream: ReceiveFailure ---> System.ObjectDisposedException: The object
was used after being disposed.
in <0x00036> Mono.Security.Protocol.Tls.SslClientStream:checkDisposed ()
in <0x0004f> (wrapper remoting-invoke-with-check)
Mono.Security.Protocol.Tls.SslClientStream:checkDisposed ()
in <0x0004d> Mono.Security.Protocol.Tls.SslClientStream:BeginRead
in <0x0007e> System.Net.WebConnection:InitRead (object)
--- End of inner exception stack trace ---
in <0x0006e> System.Net.HttpWebRequest:CheckFinalStatus
in <0x00065> (wrapper remoting-invoke-with-check)
System.Net.HttpWebRequest:CheckFinalStatus (System.Net.WebAsyncResult)
in <0x001b7> System.Net.HttpWebRequest:EndGetResponse
in <0x0006d> System.Net.HttpWebRequest:GetResponse ()
in <0x000d9> Prog:Main (string[])

It's one bug, or my code is bad ?

This code success with "http://" URL.



using System;
using System.Net;
using System.Text;
using System.IO;

class Prog 

	static void Main(string[] args) 
		HttpWebRequest WRequest = (HttpWebRequest) WebRequest.Create("https://localhost");
		HttpWebResponse WResponse = (HttpWebResponse) WRequest.GetResponse();
		StreamReader SR = new StreamReader(WResponse.GetResponseStream(), Encoding.ASCII);
			string s = SR.ReadLine();
			while (s!=null)
				s = SR.ReadLine();

Stéphane KLEIN
Home page : http://www.harobed.org
Jabber : harobed@myjabber.net