httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Plüm, Rüdiger, VF-Group" <ruediger.pl...@vodafone.com>
Subject Re: ap_custom_response content type 'text/xml'
Date Thu, 26 Jun 2008 14:36:34 GMT
 

> -----Ursprüngliche Nachricht-----
> Von: Brian J. France 
> Gesendet: Donnerstag, 26. Juni 2008 16:29
> An: dev@httpd.apache.org
> Betreff: Re: ap_custom_response content type 'text/xml'
> 
> 
> On Jun 26, 2008, at 9:48 AM, Kiffin Gish wrote:
> > Thanks Brian, I've tried what you suggested but it doesn't seem to  
> > work.
> > Could you be more specific? Here's what I've tried:
> >
> > void register_hooks(apr_pool_t *p)
> > {
> >     ap_hook_translate_name(hook_translate_name, NULL, NULL,
> > APR_HOOK_REALLY_FIRST);
> >     ap_hook_pre_connection(hook_pre_connection, NULL, NULL,
> > APR_HOOK_MIDDLE);
> >     ap_register_output_filter("wms-error-http-header",  
> > wmserror_ofilter,
> >             NULL, AP_FTYPE_CONNECTION) ;
> > }
> >
> > static int hook_translate_name (request_rec *r)
> > {
> >     apr_table_setn(r->notes, "MY_NOTE", ".");
> >     ap_custom_response(r, HTTP_INTERNAL_SERVER_ERROR, xml);
> >     return HTTP_INTERNAL_SERVER_ERROR;
> > }
> >
> > static int hook_pre_connection(conn_rec *c, void *csd)
> > {
> >     ap_add_output_filter("wms-error-httpd-header", NULL, NULL, c);
> >     return OK;
> > }
> >
> > int wmserror_ofilter(ap_filter_t* f, apr_bucket_brigade* bb)
> > {
> >     const char *t = apr_table_get(f->r->notes, "MY_NOTE");
> >     if (t != NULL) { ap_set_content_type(f->r, "text/xml"); }
> >     return ap_pass_brigade(f->next, bb) ;
> > }
> >
> 
> My guess would be you can't use ap_set_content_type in your filter,  
> you will have to examine the buckets, find Conetent-Type and 
> change it  
> to text/xml.

You can, but you must ensure that your filter runs before the http header
filter (HTTP_HEADER).

Regards

Rüdiger


Mime
View raw message