--- parser3/src/targets/apache13/modules/extra/Attic/mod_parser3.C 2001/03/22 12:10:01 1.9 +++ parser3/src/targets/apache13/modules/extra/Attic/mod_parser3.C 2001/03/23 08:47:48 1.13 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: mod_parser3.C,v 1.9 2001/03/22 12:10:01 paf Exp $ + $Id: mod_parser3.C,v 1.13 2001/03/23 08:47:48 paf Exp $ */ #include "httpd.h" @@ -429,12 +429,12 @@ static const char *cmd_parser_auto_path( //@{ /// service func decl static const char *get_env(Pool& pool, const char *name) { - request_rec *r=static_cast(pool.info()); + request_rec *r=static_cast(pool.context()); return (const char *)ap_table_get(r->subprocess_env, name); } static uint read_post(Pool& pool, char *buf, uint max_bytes) { - request_rec *r=static_cast(pool.info()); + request_rec *r=static_cast(pool.context()); /* ap_log_error(APLOG_MARK, APLOG_DEBUG, r->server, "mod_parser3: read_post(max=%u)", max_bytes); @@ -461,7 +461,7 @@ static uint read_post(Pool& pool, char * } static void add_header_attribute(Pool& pool, const char *key, const char *value) { - request_rec *r=static_cast(pool.info()); + request_rec *r=static_cast(pool.context()); if(strcasecmp(key, "content-type")==0) { /* r->content_type, *not* r->headers_out("Content-type"). If you don't @@ -475,7 +475,7 @@ static void add_header_attribute(Pool& p } static void send_header(Pool& pool) { - request_rec *r=static_cast(pool.info()); + request_rec *r=static_cast(pool.context()); ap_hard_timeout("Send header", r); ap_send_http_header(r); @@ -483,7 +483,7 @@ static void send_header(Pool& pool) { } static void send_body(Pool& pool, const char *buf, size_t size) { - request_rec *r=static_cast(pool.info()); + request_rec *r=static_cast(pool.context()); ap_hard_timeout("Send body", r); ap_rwrite(buf, size, r); @@ -500,12 +500,16 @@ Service_funcs service_funcs={ send_body }; -/// main workhorse +/** + main workhorse + + @todo intelligent cache-control +*/ static int parser_handler(request_rec *r) { Pool pool; pool.set_storage(r->pool); - pool.set_info(r); + pool.set_context(r); Parser_module_config *dcfg=our_dconfig(r); @@ -566,18 +570,17 @@ static int parser_handler(request_rec *r int content_length=strlen(body); // prepare header - (*service_funcs.add_header_attribute)(pool, "content-type", "text/plain"); + add_header_attribute(pool, "content-type", "text/plain"); char content_length_cstr[MAX_NUMBER]; - snprintf(content_length_cstr, MAX_NUMBER, "%d", content_length); - (*service_funcs.add_header_attribute)(pool, "content-length", - content_length_cstr); + snprintf(content_length_cstr, MAX_NUMBER, "%lu", content_length); + add_header_attribute(pool, "content-length", content_length_cstr); // send header - (*service_funcs.send_header)(pool); + send_header(pool); // send body if(!r->header_only) - (*service_funcs.send_body)(pool, body, content_length); + send_body(pool, body, content_length); // unsuccessful finish } @@ -647,7 +650,7 @@ static void parser_init(server_rec *s, p //... } PCATCH(e) { // global problem const char *body=e.comment(); - // somehow report that error + // TODO: somehow report that error } PEND_CATCH }