httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject ap_cgi_var_lookup()
Date Sun, 11 Nov 2001 01:21:59 GMT
i would like to avoid calling ap_add_{common,cgi}_vars() in mod_perl and
just tie Perl's %ENV to a lookup function.  i cooked up some generated
code based logic in Perl's ExtUtils::Constant module.  the generated code
will probably explain itself better than i can, but here is a comment from
the gen_vars.pl script:

#the jist of this generated code is that we:
#do not want to build a hash table of 30-something entries
#do not want to do 30-something strcmps

#so what we do is this:
#call strlen() only once
#switch on length, then switch on optimal offset (name[offset])
#and memcmp (as few times as possible) with given length
#see comment in best_index() for detail

i put a proof-of-concept here:
http://httpd.apache.org/~dougm/mod_cgi_vars.tar.gz

reason i'm posting here is because the code could be used in
ssl_var_lookup() and the code generator could be extended to
deal with ssl-specific variables.  ssl_var_lookup() is currently a big
hairball of strcmps.  and the "30-something" in the comment above, is
quite a bit more than that for ssl_var_lookup().




Mime
View raw message