https://bz.apache.org/bugzilla/show_bug.cgi?id=69430
Bug ID: 69430
Summary: ap_custom_response always overwrites an existing
Content-Type Header set in r->headers_out
Product: Apache httpd-2
Version: 2.4.62
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P2
Component: Core
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Hi,
i am working on a rest like client which returns json text. When i try to set
the Content-Type Header with:
ap_set_content_type( r, "text/json; charset=utf-8") ;
and sending the rsponse with:
ap_custom_response
(
r,
HTTP_BAD_REQUEST,
apr_pstrdup( r->pool, "{"foo": "bar"}" )
) ;
the Content-Type-Header always gets overwritten with: text/html;
charset=iso-8859-1
I have looked through the sources and found the function:
ap_send_error_response
in http_protocol.c which causes this behaviour.
When I surround the Line 1449 :
ap_set_content_type_ex(r, "text/html; charset=iso-8859-1", 1);
with an :
if ( ! apr_table_get(r->headers_out, "Content-Type") ) {
ap_set_content_type_ex(r, "text/html; charset=iso-8859-1", 1);
}
everything works fine. Do you think is's possibe to change this function, so
the Header can be set by the clients using the function: ap_custom_response
Regards
Michael
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]