[Mono-dev] Bug found in Mono.WebServer.XSPWorker ?

Sebastien Pouliot sebastien.pouliot at gmail.com
Sat Sep 2 13:42:41 EDT 2006

Hello Jean-François,

On Sat, 2006-09-02 at 18:14 +0200, Jean-François Burdet wrote:
> Hi there,
> I hope it's the correct place to post such request.


> I was searching a way of embedding an secure web server in my .Net
> application i'm writting using Visual Studio 2005.
> At first, I simply took the Mono.WebServer2.dll and Mono.Security.Dll
> from the Mono Window build ( and some sources files (server.cs
> and security.cs) to build the Mono.XSP assembly which simply parse the
> command line then launching Mono.WebServer.ApplicationServer.
> Using that setup I had success running the server, including static html
> files, ASP pages, web services under http and https/SSL. Good :-)

strange (see later)

> Then I wanted to dig a bit into Mono.Webserver, so I grab the source
> files from the tarball and made another project to build my own
> Mono.Webserver.dll then using it instead of the Mono.WebServer2.dll of
> the official windows build to make the Mono.XSP server running and ...
> it works as good as before BUT :
> I realized that when using SSL, something was now broken, it seems that
> now the SSL negociation is somehow buggy and I can't figure out why but
> when running regular http everything is ok (asp, webservices, ...).
> When opening the webpage from my browser, it simply waits, receiving
> nothing ...

yes, this has been filed as bug 79222 last week

> So I dig a bit into the source code and I realize that the worker was
> reading it's data from the socket but not the stream ... 

uho, that's bad as the socket data is encrypted under SSL

> so I simply
> change some line in the XSPApplicationHost.cs source file :
> 1. "sock.BeginReceive (buffer, 0, buffer.Length, SocketFlags.None, new
> AsyncCallback (ReadCB), buffer);" becomes "stream.BeginRead(buffer, 0,
> buffer.Length, new AsyncCallback(ReadCB), buffer);"
> 2. "int nread = sock.EndReceive (ares);" becomes "int nread =
> stream.EndRead(ares);"
> and ... it now works fine.
> Please can you confirm I found a bug, if the solution is ok, you can
> comit this to the source tree.

The fix looks logical. We'll look into this and confirm asap.


> Regards,
> JF
> PS: I'm starting to wonder why it was working with the DLL from the
> Official windows build ... The Reflector disassembler showed me that
> this dll code is not the same as the latest sources, for example, look
> at the XSPWorker.Run method is absolutly not the same than the source code !

That's strange too. Thanks for noticing that!
Sebastien Pouliot  <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/

More information about the Mono-devel-list mailing list