/[mod_ua_charset]/mod_ua_charset.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /mod_ua_charset.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dpavlin, Tue Apr 18 06:54:05 2000 UTC revision 1.3 by dpavlin, Tue Apr 18 06:56:17 2000 UTC
# Line 60  Line 60 
60    
61   */   */
62    
63    
64  #include "httpd.h"  #include "httpd.h"
 #include "http_config.h"  
65  #include "http_core.h"  #include "http_core.h"
66    #include "http_config.h"
67    
68  module MODULE_VAR_EXPORT ua_charset_module;  module MODULE_VAR_EXPORT ua_charset_module;
69    
70  static int add_charset_header(request_rec * r)  static int add_charset_header(request_rec * r)
71  {  {
72          char *ua, *ct;          const char *ua, *ct;
73          if (ua = ap_table_get(r->headers_in, "User-Agent")) {  
74            ua = ap_table_get(r->headers_in, "User-Agent");
75            /*ct = ap_table_get(r->headers_in, "Content-Type"); */
76            /**** Isn't this better? */
77            ct = r->content_type;
78            if (ua != NULL)
79                  ap_table_setn(r->headers_out, "X-User-Agent", ua);                  ap_table_setn(r->headers_out, "X-User-Agent", ua);
80          }          else
81                    ua = "<unknown>";
82  #if 1  #if 1
83          if (ct = ap_table_get(r->headers_in, "Content-type")) {          if (ct != NULL)
84                  ap_table_setn(r->headers_out, "X-Content-type", ct);                  ap_table_setn(r->headers_out, "X-Content-Type", ct);
85          }          if (strstr(ct, "text/html") == NULL)
86          if (strstr(ct, "text/html")) {                  return DECLINED;        /* Don't mess with other types */
87                  return DECLINED;        /* don't mess with other types */          if (strstr(ua, "Mac") != NULL) {
88          }                  if (strstr(ua, "MSIE") != NULL)
         if (strstr(ua, "Mac")) {  
                 if (strstr(ua, "MSIE")) {  
89                          r->content_type = "text/html; charset=x-mac-roman";                          r->content_type = "text/html; charset=x-mac-roman";
90                  } else {                  else
91                          r->content_type = "text/html; charset=MacCE";                          r->content_type = "text/html; charset=MacCE";
92                  }          } else
         } else {  
93                  r->content_type = "text/html; charset=iso-8859-2";                  r->content_type = "text/html; charset=iso-8859-2";
         }  
   
94  #endif  #endif
95          return OK;          return OK;
         return DECLINED;  
96  }  }
97    
98  module MODULE_VAR_EXPORT ua_charset_module = {  module MODULE_VAR_EXPORT ua_charset_module = {
99          STANDARD_MODULE_STUFF, NULL,    /* initializer */          STANDARD_MODULE_STUFF,
100            NULL,                   /* initializer */
101          NULL,                   /* dir config creater */          NULL,                   /* dir config creater */
102          NULL,                   /* dir merger --- default is to override */          NULL,                   /* dir merger --- default is to override */
103          NULL,                   /* server config */          NULL,                   /* server config */

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26