Rian Hunter wrote:
If there was going to be a large change to core, request_rec and friends how about:struct request_rec { /* common stuff */ char *protocol_name; // different from r->protocol, // but maybe doesn't have to be struct ap_conf_vector_t *request_config; };The request_config vector would store all the protocol specific data. Protocol_name would be so modules new what they were dealing with. To retrieve protocol specific data define this in each protocol module:smtpd_request_rec *get_smtpd_request(request_rec *r) { return ap_get_module_config(r->request_config, &MODULE_NAME); } Then in handler modules: type misc_smtp_handler(request_rec *r) { smtpd_request_rec *smtp_data; if (strncmp("http", r->protocol_name, 4)) { // decline to handle, this module doesn't handle // http requests. } //then get smtpd specific data smtp_data = get_smtpd_request(r); // do some handlin' }The advantage to this approach is a less bulky (but more all encompassing) request_rec with support for an arbitrary amount of protocols and protocol specific data.
Rather than inserting dozens of strcmps all throught the processing, I'd prefer to store an int identifying the protocol, and just have a simple compare. No reason to burn CPU on the strcmp if we don't have to.
-garrett
