[Opensim-dev] HttpServer overview & RFC

Stefan Andersson stefan at tribalmedia.se
Wed May 28 18:07:50 UTC 2008


Looks good to me as well - +1.Best regards,Stefan AnderssonTribal Media AB Join the 3d web revolution : http://tribalnet.se/ 



> Date: Wed, 28 May 2008 18:41:39 +0100> From: jjustincc at googlemail.com> To: opensim-dev at lists.berlios.de> Subject: Re: [Opensim-dev] HttpServer overview & RFC> > +1> > me too> > Frisby, Adam wrote:> > Looks good!> > > > > > > > +1> > > > > > > > Adam> > > > > > > > *From:* opensim-dev-bounces at lists.berlios.de > > [mailto:opensim-dev-bounces at lists.berlios.de] *On Behalf Of *Dr Scofield> > *Sent:* Wednesday, 28 May 2008 2:07 AM> > *To:* opensim-dev at lists.berlios.de> > *Subject:* [Opensim-dev] HttpServer overview & RFC> > > > > > > > hi all, another request for comments :-)> > > > i've been chewing on HttpServer and how to use it instead of the .NET > > HttpListener stuff. here's first a short overview of HttpServer and what > > it offers (keyword is "short", for more details have a look at > > opensim-libs/HttpServer), then some thoughts on how we could make use of it.> > > > HttpServer basically offers the following ways of processing HTTP requests:> > > > * HttpListener()> > * HttpModule> > * Controllers> > > > == HttpListener ==> > > > HttpListener (not the .NET one!) basically works like this:> > > > HttpListener listener;> > listener = new HttpListener(IPAddress.Any, 80);> > listener.RequestHandler += OnRequest;> > listener.Start(5);> > > > with OnRequest like this:> > > > void OnRequest(HttpClientContext client, HttpRequest request)> > {> > ...> > client.Respond(...);> > }> > > > to support HTTPS, all we need to do is load an X509 certificate and pass > > that in to the HttpListener constructor.> > > > == HttpModule ==> > > > HttpModule basically allows us to register an HttpModule derived object > > with an HttpServer object (which internally uses HttpListener). Each > > registered module gets invoked to handle an incoming request (similar to > > the handler idea alan webb brainstormed about a couple of days ago) and > > can signal back whether it has handled the request.> > > > == Controller ==> > > > Controller finally is kind of a pre-canned REST handler making use of > > the first three parts of an URL (slash is separator) as "addressing"> > > > http://localhost/user/view/1 > > > > > > (example from > > http://www.codeplex.com/webserver/Wiki/View.aspx?title=Part%20five%20-%20Using%20controllers&referringTitle=Home > > <http://www.codeplex.com/webserver/Wiki/View.aspx?title=Part%20five%20-%20Using%20controllers&referringTitle=Home>)> > > > would address the controller module User (or UserController) and invoke > > the method View() with the value "1".> > > > > > == Authentication ==> > > > Authentication is via Authentication modules as well as via callbacks > > where required (for example for DigestAuthentication the callback occurs > > to get the password).> > > > > > == making use of HttpServer ==> > > > what i'd actually like to implement (either as an HttpModule or as an > > HttpListener handler) is an event--event handler scheme:> > > > * incoming HTTP request is pushed as an OSHttpRequest object into an> > HTTP request queue.> > * each OSHttpRequest encapsulates> > o the HTTP request header,> > o an input stream fed by the remote client,> > o an output stream feeding the remote client> > o method to produce OSHttpResponse object (for signaling> > redirects, setting status codes, etc)> > * we have a pool of OSHttpRequest pumps that take OSHttpRequest> > objects and pump them via the registered event handlers to whoever> > registered an interest (via multicast mechanism that stefan> > already explained a couple of days ago as well)> > * event handlers return either> > o Pass --- didn't act on it> > o Handled --- acted on it, response return as out parameter> > o Detach --- acting on it, taking care of it myself, don't do> > anything> > * if no event handler acted on the OSHttpRequest, we return an error> > code> > * as soon as as we get a Handled or Detached response we stop going> > through the handlers> > * if we get a Handled we OSHttpResponse.SendHeaders and close the> > input and output streams> > > > any event handler that returns Detached is responsible for sending > > response header and for dealing with the input and output stream itself > > --- and could, for example, keep an HTTP connection open, implementing a > > long poll scheme, for example.> > > > BaseHttpServer would offer two events to which event handlers could > > attach: OnHttpRequest and OnHttpsRequest.> > > > > > what do you think?> > > > cheers,> > dr scofield/dirk> > > > > > -- > > > > dr dirk husemann ---- virtual worlds research ---- ibm zurich research lab> > > > SL: dr scofield ---- drscofield at xyzzyxyzzy.net <mailto:drscofield at xyzzyxyzzy.net> ---- http://xyzzyxyzzy.net/> > > > RL: hud at zurich.ibm.com <mailto:hud at zurich.ibm.com> - +41 44 724 8573 - http://www.zurich.ibm.com/~hud/ <http://www.zurich.ibm.com/%7Ehud/>> > > > > > ------------------------------------------------------------------------> > > > _______________________________________________> > Opensim-dev mailing list> > Opensim-dev at lists.berlios.de> > https://lists.berlios.de/mailman/listinfo/opensim-dev> > > -- > justincc> Justin Clark-Casey> http://justincc.wordpress.com> _______________________________________________> Opensim-dev mailing list> Opensim-dev at lists.berlios.de> https://lists.berlios.de/mailman/listinfo/opensim-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080528/0e7afd53/attachment-0001.html>


More information about the Opensim-dev mailing list