You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1997/01/03 21:34:12 UTC

Re: Header Parse API

I would vote +1 to commit this so that we can more easily test.


> Here's the patch to add an extra API for header parsing. As you can see, its
> pretty simple. I've only added it to the main request processor, and not to the
> subrequest processors, on the grounds that the headers from the client only
> happen in the main request. There is room for debate here, though.
> 
> I've tested it lightly, and BrowserMatch still works, so I guess its mostly OK.
> I'd like to commit it so people can test it easily - if its OK then I'll do the
> changes for mod_auth to make it user BrowserMatch instead. I will undertake to
> remove the changes if, in the end, the mod is not approved.
> 
> Cheers,
> 
> Ben.
> 
> Index: http_config.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_config.c,v
> retrieving revision 1.39
> diff -c -r1.39 http_config.c
> *** http_config.c	1997/01/01 18:10:16	1.39
> --- http_config.c	1997/01/03 17:03:08
> ***************
> *** 292,297 ****
> --- 292,301 ----
>      return run_method (r, XtOffsetOf (module, logger), 1);
>   }
>   
> + int header_parse (request_rec *r) {
> +     return run_method (r, XtOffsetOf (module, header_parser), 1);
> + }
> + 
>   /* Auth stuff --- anything that defines one of these will presumably
>    * want to define something for the other.  Note that check_auth is
>    * separate from check_access to make catching some config errors easier.
> Index: http_config.h
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_config.h,v
> retrieving revision 1.26
> diff -c -r1.26 http_config.h
> *** http_config.h	1997/01/01 18:10:17	1.26
> --- http_config.h	1997/01/03 17:03:14
> ***************
> *** 216,221 ****
> --- 216,222 ----
>       int (*type_checker)(request_rec *);
>       int (*fixer_upper)(request_rec *);
>       int (*logger)(request_rec *);
> +     int (*header_parser)(request_rec *);
>   } module;
>   
>   /* Initializer for the first few module slots, which are only
> ***************
> *** 225,231 ****
>    * handle it back-compatibly, or at least signal an error).
>    */
>   
> ! #define MODULE_MAGIC_NUMBER 19961211
>   #define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER, -1, __FILE__, NULL
>   
>   /* Generic accessors for other modules to get at their own module-specific
> --- 226,232 ----
>    * handle it back-compatibly, or at least signal an error).
>    */
>   
> ! #define MODULE_MAGIC_NUMBER 19970103
>   #define STANDARD_MODULE_STUFF MODULE_MAGIC_NUMBER, -1, __FILE__, NULL
>   
>   /* Generic accessors for other modules to get at their own module-specific
> ***************
> *** 291,295 ****
> --- 292,297 ----
>   int run_fixups (request_rec *);	/* poke around for other metainfo, etc.... */
>   int invoke_handler (request_rec *);     
>   int log_transaction (request_rec *r);
> + int header_parse (request_rec *);
>   
>   #endif
> Index: http_request.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_request.c,v
> retrieving revision 1.34
> diff -c -r1.34 http_request.c
> *** http_request.c	1997/01/01 18:10:22	1.34
> --- http_request.c	1997/01/03 17:03:23
> ***************
> *** 867,872 ****
> --- 867,877 ----
>           die (access_status, r);
>   	return;
>       }	
> + 
> +     if ((access_status = header_parse (r))) {
> +         die (access_status, r);
> + 	return;
> +     }
>       
>       switch (satisfies(r)) {
>       case SATISFY_ALL:
> Index: mod_browser.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/mod_browser.c,v
> retrieving revision 1.6
> diff -c -r1.6 mod_browser.c
> *** mod_browser.c	1997/01/01 18:10:29	1.6
> --- mod_browser.c	1997/01/03 17:03:24
> ***************
> *** 138,144 ****
>   { NULL },
>   };
>   
> ! int fixup_browser_module(request_rec *r)
>   {
>       server_rec *s = r->server;
>       browser_server_config_rec *sconf = get_module_config (s->module_config,
> --- 138,144 ----
>   { NULL },
>   };
>   
> ! int parse_headers_browser_module(request_rec *r)
>   {
>       server_rec *s = r->server;
>       browser_server_config_rec *sconf = get_module_config (s->module_config,
> ***************
> *** 182,187 ****
>      NULL,			/* check auth */
>      NULL,			/* check access */
>      NULL,			/* type_checker */
> !    fixup_browser_module,	/* fixups */
>      NULL,			/* logger */
>   };
> --- 182,188 ----
>      NULL,			/* check auth */
>      NULL,			/* check access */
>      NULL,			/* type_checker */
> !    NULL,			/* fixups */
>      NULL,			/* logger */
> +    parse_headers_browser_module,/* header parser */
>   };
> 
> -- 
> Ben Laurie                Phone: +44 (181) 994 6435  Email: ben@algroup.co.uk
> Freelance Consultant and  Fax:   +44 (181) 994 6472
> Technical Director        URL: http://www.algroup.co.uk/Apache-SSL
> A.L. Digital Ltd,         Apache Group member (http://www.apache.org)
> London, England.          Apache-SSL author