return cp;
}
-int read_type_map (negotiation_state *neg, char *map_name)
+static int read_type_map (negotiation_state *neg, request_rec *rr)
{
request_rec *r = neg->r;
- FILE *map = pfopen (neg->pool, map_name, "r");
-
+ FILE *map;
char buffer[MAX_STRING_LEN];
enum header_state hstate;
struct var_rec mime_info;
+ if (rr->status != HTTP_OK) {
+ return rr->status;
+ }
+ map = pfopen (neg->pool, rr->filename, "r");
if (map == NULL) {
- log_reason("cannot access type map file", map_name, r);
+ log_reason("cannot access type map file", rr->filename, r);
return FORBIDDEN;
}
closedir(dirp);
neg->avail_vars->nelts = 0;
- return read_type_map (neg, sub_req->filename);
+ return read_type_map (neg, sub_req);
}
/* Have reasonable variant --- gather notes.
/* If the best variant's charset is ISO-8859-1 and this variant has
the same charset quality, then we prefer this variant */
if (variant->charset_quality == best->charset_quality &&
- (best->content_charset == NULL || *best->content_charset == 0 ||
- strcmp(best->content_charset, "iso-8859-1") == 0)) {
+ (variant->content_charset != NULL &&
+ strcmp(variant->content_charset, "iso-8859-1") != 0) &&
+ (best->content_charset == NULL ||
+ *best->content_charset == '\0' ||
+ strcmp(best->content_charset, "iso-8859-1") == 0)) {
*p_bestq = q;
return 1;
}
/* If the best variant's charset is ISO-8859-1 and this variant has
the same charset quality, then we prefer this variant */
if (variant->charset_quality > best->charset_quality ||
- (variant->charset_quality == best->charset_quality &&
- (best->content_charset == NULL || *best->content_charset == 0 ||
- strcmp(best->content_charset, "iso-8859-1") == 0))) {
+ ((variant->content_charset != NULL &&
+ strcmp(variant->content_charset, "iso-8859-1") != 0) &&
+ (best->content_charset == NULL ||
+ *best->content_charset == '\0' ||
+ strcmp(best->content_charset, "iso-8859-1") == 0))) {
*p_bestq = q;
return 1;
}
char *udir;
- if ((res = read_type_map (neg, r->filename))) return res;
+ if ((res = read_type_map (neg, r))) return res;
maybe_add_default_encodings(neg, 0);