--- mod_ua_charset.c 2000/04/18 06:54:05 1.2 +++ mod_ua_charset.c 2000/04/18 06:56:17 1.3 @@ -60,41 +60,44 @@ */ + #include "httpd.h" -#include "http_config.h" #include "http_core.h" +#include "http_config.h" module MODULE_VAR_EXPORT ua_charset_module; static int add_charset_header(request_rec * r) { - char *ua, *ct; - if (ua = ap_table_get(r->headers_in, "User-Agent")) { + const char *ua, *ct; + + ua = ap_table_get(r->headers_in, "User-Agent"); + /*ct = ap_table_get(r->headers_in, "Content-Type"); */ + /**** Isn't this better? */ + ct = r->content_type; + if (ua != NULL) ap_table_setn(r->headers_out, "X-User-Agent", ua); - } + else + ua = ""; #if 1 - if (ct = ap_table_get(r->headers_in, "Content-type")) { - ap_table_setn(r->headers_out, "X-Content-type", ct); - } - if (strstr(ct, "text/html")) { - return DECLINED; /* don't mess with other types */ - } - if (strstr(ua, "Mac")) { - if (strstr(ua, "MSIE")) { + if (ct != NULL) + ap_table_setn(r->headers_out, "X-Content-Type", ct); + if (strstr(ct, "text/html") == NULL) + return DECLINED; /* Don't mess with other types */ + if (strstr(ua, "Mac") != NULL) { + if (strstr(ua, "MSIE") != NULL) r->content_type = "text/html; charset=x-mac-roman"; - } else { + else r->content_type = "text/html; charset=MacCE"; - } - } else { + } else r->content_type = "text/html; charset=iso-8859-2"; - } - #endif return OK; - return DECLINED; } + module MODULE_VAR_EXPORT ua_charset_module = { - STANDARD_MODULE_STUFF, NULL, /* initializer */ + STANDARD_MODULE_STUFF, + NULL, /* initializer */ NULL, /* dir config creater */ NULL, /* dir merger --- default is to override */ NULL, /* server config */