On Thu, Nov 22, 2007 at 08:39:47AM +0100, [EMAIL PROTECTED] wrote: > > For my python binding to evhttp (temporarily called fapws2 > http://www.opensource4you.com/cgi-bin/gitweb.cgi?p=fapws2;a=summary), I > would like to implement the concept of virtual host. > > > Is there anyone having expertise with that within libevent ? > > I'm thinking to add it within the http structure. Indeed, an uri is always > coupled with a virtual host.
You mean evhttp_request, right? There are a bunch of http-related structures in libevent. > Then the evhttp_dispatch_callback need to check the uri AND the > virtualhost against the HTTP_X_FORWARDED_FOR environment variable (in case > of proxy) or the req->remote_host. What logic did you have in mind for X-Forwarded-For? Do you mean the header, or the environment variable? My understanding is that the environment variable is mainly used by CGI stuff, and I don't want to make libevent CGI-specific by default. > To be backward compatible, an empty virtualhost means that the uri is > always valid. Sounds reasonable. > Unfortunately this is quite invasive within the libevent code. If I'm not > wrong the following calls must be adapted: > evhttp_free > evhttp_set_cb > evhttp_del_cb > evhttp_set_gencb Changing code is no problem. Changing APIs is not so good, though, if it makes old code stop working. I think the only function whose interface would need to change would be evhttp_set_cb. Instead, it would probably be best to add a new fuction. There's already some discussion of improving the callback-matching interface in the sourceforge feature request tracker at [ 1826562 ] Add wildcard calbacks to http.c http://sourceforge.net/tracker/index.php?func=detail&aid=1826562&group_id=50884&atid=461325 It would be neat to come up with an interface that satisfied both the need of adding wildcards and adding vhost support. > Does the core developers will accept to port it in the trunk of > libevent ? Sounds reasonable, if the code is clean. It would be even better if it came with regression tests. :) peace, -- Nick
pgpEJP0Z4zoyp.pgp
Description: PGP signature
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users