SHA256
1
0
forked from pool/apache2
apache2/httpd-2.2.3-AddDirectoryIndexCharset.patch

52 lines
2.3 KiB
Diff

diff -uNr httpd-2.2.3.orig/modules/generators/mod_autoindex.c httpd-2.2.3/modules/generators/mod_autoindex.c
--- httpd-2.2.3.orig/modules/generators/mod_autoindex.c 2006-07-12 05:38:44.000000000 +0200
+++ httpd-2.2.3/modules/generators/mod_autoindex.c 2006-12-21 10:32:01.478754000 +0100
@@ -130,6 +130,7 @@
int icon_height;
char default_keyid;
char default_direction;
+ char *fs_charset;
apr_array_header_t *icon_list;
apr_array_header_t *alt_list;
@@ -556,6 +557,9 @@
AP_INIT_ITERATE2("AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS,
"alternate descriptive text followed by one or more "
"content encodings"),
+ AP_INIT_TAKE1("AddDirectoryIndexCharset", ap_set_string_slot,
+ (void *)APR_OFFSETOF(autoindex_config_rec, fs_charset),
+ DIR_CMD_PERMS, "alternative encoding of filenames, if not utf-8"),
AP_INIT_TAKE_ARGV("IndexOptions", add_opts, NULL, DIR_CMD_PERMS,
"one or more index options [+|-][]"),
AP_INIT_TAKE2("IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS,
@@ -617,6 +621,8 @@
: base->default_icon;
new->style_sheet = add->style_sheet ? add->style_sheet
: base->style_sheet;
+ new->fs_charset = add->fs_charset ? add->fs_charset
+ : base->fs_charset;
new->icon_height = add->icon_height ? add->icon_height : base->icon_height;
new->icon_width = add->icon_width ? add->icon_width : base->icon_width;
@@ -1978,11 +1984,15 @@
return HTTP_FORBIDDEN;
}
-#if APR_HAS_UNICODE_FS
- ap_set_content_type(r, "text/html;charset=utf-8");
-#else
- ap_set_content_type(r, "text/html");
-#endif
+ if (autoindex_conf->fs_charset != NULL) {
+ ap_set_content_type(r, apr_pstrcat(r->pool,
+ "text/html;charset=",
+ autoindex_conf->fs_charset,
+ NULL));
+ } else {
+ ap_set_content_type(r, "text/html;charset=utf-8");
+ }
+
if (autoindex_opts & TRACK_MODIFIED) {
ap_update_mtime(r, r->finfo.mtime);
ap_set_last_modified(r);