httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Prud'hommeaux" <>
Subject .foo files in the same dir must have the same content-type and charset
Date Mon, 03 Mar 2003 19:43:55 GMT
In general, AddType/AddCharset directives provide general rules for
file extensions. mod_negotiation.c:handle_map_file provides a way to
do negotiation based on rules supplied in file.var rather than the
AddType/AddCharset rules for *.html.
for the purposes of content negotiation.

The problem is that these Content-Type/Language parameters are used for the negotiation

static int handle_map_file(request_rec *r)
    negotiation_state *neg = parse_accept_headers(r);
    var_rec *best;
    int res;

    char *udir;

//  read .htaccess:
//    AddType text/html;charset=iso-8859-1 html htm
//  override with foo.var:
//    URI: foo.html
//    Content-Type: application/xhtml+xml; charset=UTF-8; qs=0.99
//    Content-Language: en
    if ((res = read_type_map(neg, r))) {
        return res;

//  find the characteristics of the best choice:
    res = do_negotiation(r, neg, &best, 0);
    if (res != 0) return res;

    if (r->path_info && *r->path_info) {
        r->uri[ap_find_path_info(r->uri, r->path_info)] = '\0';
    udir = ap_make_dirstr_parent(r->pool, r->uri);
    udir = ap_escape_uri(r->pool, udir);
//  throw away everything except the file_name of the best choice:
    ap_internal_redirect(ap_pstrcat(r->pool, udir, best->file_name,
                                    r->path_info, NULL), r);
    return OK;

It seems like making headers from best and stuffing them into r's
headers_out would be a good way to solve this. ap_internal_redirect
copies the new headers from the r (via internal_internal_redirect) and
i THINK that headers won't be replaced if they're already set.

gdb'd apache 1.3.27
looked at 2.something-or-other

office: +1.617.258.5741 NE43-344, MIT, Cambridge, MA 02144 USA
cell:   +1.857.222.5741

Feel free to forward this message to any list for any purpose other than
email address distribution.

View raw message