[Mono-devel-list] HttpWorkerRequest

Rafael Teixeira monoman at gmail.com
Wed Dec 15 14:37:42 EST 2004


Well this is some internal class from the .NET implementation as it
isn't documented in MSDN.

In Mono we have some subclass of  MonoWorkerRequest (either
XSPWorkerRequest or ModMonoWorkerRequest). These classes are the ones
that return null for GetPreLoadedEntityBody().

Could you please fill a bugzilla, giving some more details of what is
expected to come in the byte array, and pointing to implement in those
classes (or the superclass), please. I would do it for you, by I run
out of time just now.

Thanks for helping us make Mono better.

Fun,

On Wed, 15 Dec 2004 08:13:54 -0800 (PST), Joe Audette
<joe_audette at yahoo.com> wrote:
> Hi Rafael, 
>   
> When I do GetType().ToString()  I get
> System.Web.Hosting.ISAPIWorkerRequestOutOfProc 
>   
> Does that help? 
>   
> Thanks, 
>   
> Joe
> 
> 
> Rafael Teixeira <monoman at gmail.com> wrote: 
> Hi Joe, just a small thing, you may be pointing to the wrong class, see:
> 
> > return (HttpWorkerRequest)provider.GetService(typeof(HttpWorkerRequest)); 
> 
> IServiceProvider.GetService() will return some instance of
> HttpWorkerRequest or a subclass of it, what is probably the case. See,
> it returns the first matching instance registered in the container
> (HttpContext.Current in this case) that subclasses or implements (in
> the more common case where you pass it the type of an interface
> definition) the passed type.
> 
> Print the full type name of the returned instance in your code, to
> tell us which subclass should we be returning. That subclass is the
> one that has to override GetPreloadedEntityBody() to return something
> more useful.
> 
> Hope it helps,
> 
> On Wed, 15 Dec 2004 06:28:03 -0800 (PST), Joe Audette
> wrote:
> > Gonzalo, 
> > 
> > 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. 
> > 
> > http://krystalware.com/files/SlickUpload.zip 
> > 
> > http://krystalware.com/files/AdvancedUploadSpike.zip 
> > 
> > Best Regards, 
> > 
> > Joe Audette 
> > 
> > 
> > Gonzalo Paniagua Javier 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 understa nd >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
> > >mono? 
> > 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
> > null.
> > 
> > Moreover, you have HasEntityBody() and IsEntireEntityBodyIsPreloaded()
> > to know in advance if GetPreloadedEntityBody() can be null.
> > 
> > -Gonzalo
> > 
> > 
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> > 
> > 
> > joe_audette at yahoo.com
> > http://www.joeaudette.com
> > http://www.mojoportal.com 
> 
> 
> -- 
> Rafael "Monoman" Teixeira
> ---------------------------------------
> Just the 'crazy' me in a sane world, or would it be the reverse? I dunno...
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 
> joe_audette at yahoo.com
> http://www.joeaudette.com
> http://www.mojoportal.com 


-- 
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.



More information about the Mono-devel-list mailing list