<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Looks good to me as well - +1.<BR><BR>Best regards,<BR>Stefan Andersson<BR>Tribal Media AB<BR> <BR>Join the 3d web revolution : <A href="http://tribalnet.se/" target=_blank>http://tribalnet.se/</A><BR> <BR><BR><BR><BR>

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