[Mono-devel-list] HttpWorkerRequest

Joe Audette joe_audette at yahoo.com
Wed Dec 15 09:28:03 EST 2004

That may be true when you inherit from HttpWorkerRequest but when you call it directly on windows GetPreloadedEntityBody returns a byte array not null. I step through the code to verify this and the code never raises an error on windows because it never returns null.
This is the code that gets a reference to HttpWorkerRequest before it is passed into the RequestStream class:

HttpWorkerRequest GetWorkerRequest(HttpContext context)


IServiceProvider provider = (IServiceProvider)HttpContext.Current;

return (HttpWorkerRequest)provider.GetService(typeof(HttpWorkerRequest));


So in my observation mono does not produce the same behavior as windows .net, therefore this code works on windows but not mono. On Windows if you call directly HttpWorkerRequest.GetPreLoadedEntityBody it does not return null.

I urge you to download the code and its sample project and see how it works under windows but not on mono.



Best Regards,

Joe Audette

Gonzalo Paniagua Javier <gonzalo at ximian.com> wrote:

>tempBuff will always be null until GetPreloadedEntityBody() is
>implemented in HttpWorkerRequest >Yes I could check for null and that
would get rid of the error but it >would not make the code functional.
In fact if I did check for null and >found null, my inclination would be
to throw an exception so why not >windows .NET and should work under
mono at some point if I understand >the goals of mono correctly. >My
original question is only to inquire when the methods of
>HttpWorkerRequest will be implemented. You said the methods are
>implemented in XSP in classes derived from HttpWorkerRequest, but my
>code refers directly to HttpWorkerRequest not to any derived class.
>Will the methods ever be implemented directly on HttpWorkerRequest in
I think you're misundertanding. That method is already implemented in
HttpWorkerRequest.cs. It just returns null. That's the implementation.
You can easilly test that is the behavior that MS NET has in that method
of HttpWorkerRequest class. How? Derive your own class from
HttpWorkerRequest and call GetPreloadedEntityBody(). You'll always get

Moreover, you have HasEntityBody() and IsEntireEntityBodyIsPreloaded()
to know in advance if GetPreloadedEntityBody() can be null.


Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com

joe_audette at yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041215/64c5c99e/attachment.html 

More information about the Mono-devel-list mailing list