On 4/3/08 11:38 AM, "William A. Rowe, Jr." <[EMAIL PROTECTED]> wrote:

>> <If HTTP_Method == GET>
>> ...
>> </If>
> 
> Slooooooooooooooooooooow

Not if the parsing is done at config time and HTTP_Method is handle by a
provider.  Some pseudo code:

At config time, the parser would do something like:

parse_provider *prov;
void *data;

prov = ap_lookup_provider("config_parse", "HTTP_Method", "0.1");

data = prov->init(conf_pool, "HTTP_Method", TOKEN_EQUAL, "GET")

/*the provider may do something like*/
typedef struct {
    parse_token token;
    int method_number;
} method_data;

void *method_init(apr_pool_t *pool, const char *key, parse_token token,
const char *arg) {
   method_data *data = apr_pcalloc(pool, sizeof(method_data));
   data->token = token; /*need to check if we only handle === or something
*/
   if(strcacecmp(arg, "GET")) {
        data->method_number = M_GET;
    }

   return data;

/*the parser stores this data with the node*/

At run time, then when running this node from the cached parse tree, it may
call something like:

node->prov->exec(r, nod->data)

/*the provider runs something like*/
int method_exec(reuqest_rec *r, method_data *data) {
    if(data->method_number == r->method_number)
        return 1;
    return 0;
}




Very rough draft.  But this is not necessarily slooooow... ;)

-- 
Brian Akins
Chief Operations Engineer
Turner Digital Media Technologies

Reply via email to