/[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.3 by dpavlin, Tue Apr 18 06:56:17 2000 UTC revision 1.4 by dpavlin, Tue Apr 18 07:36:39 2000 UTC
# Line 57  Line 57 
57    
58  /* charset module  /* charset module
59   *   *
60     * sets `Contnet-type: text/html; charset=foobar' based on user agent string
61     * from client browser
62     *
63     * Dobrica Pavlinusic <dpavlin@rot13.org>
64     * Robert Avilov <ravilov@linux.hr>
65     *
66   */   */
67    
68    
# Line 72  static int add_charset_header(request_re Line 77  static int add_charset_header(request_re
77          const char *ua, *ct;          const char *ua, *ct;
78    
79          ua = ap_table_get(r->headers_in, "User-Agent");          ua = ap_table_get(r->headers_in, "User-Agent");
80          /*ct = ap_table_get(r->headers_in, "Content-Type"); */          if (ua == NULL)
         /**** Isn't this better? */  
         ct = r->content_type;  
         if (ua != NULL)  
                 ap_table_setn(r->headers_out, "X-User-Agent", ua);  
         else  
81                  ua = "<unknown>";                  ua = "<unknown>";
82  #if 1  
83          if (ct != NULL)          ct = r->content_type;
84                  ap_table_setn(r->headers_out, "X-Content-Type", ct);  
85          if (strstr(ct, "text/html") == NULL)          if (ct != NULL) {
86                  return DECLINED;        /* Don't mess with other types */  
87          if (strstr(ua, "Mac") != NULL) {                  if (strstr(ct, "text/html") == NULL)
88                  if (strstr(ua, "MSIE") != NULL)                          return DECLINED; /* Don't mess with other types */
89                          r->content_type = "text/html; charset=x-mac-roman";  
90                  else                  if (strstr(ua, "Mac") != NULL) {
91                          r->content_type = "text/html; charset=MacCE";                          if (strstr(ua, "MSIE") != NULL)
92          } else                                  r->content_type = "text/html; charset=x-mac-roman";
93                  r->content_type = "text/html; charset=iso-8859-2";                          else
94                                    r->content_type = "text/html; charset=MacCE";
95                    } else
96                            r->content_type = "text/html; charset=iso-8859-2";
97                    }
98    
99    #ifdef DEBUG
100            ap_table_setn(r->headers_out, "X-Content-Type", ct);
101            ap_table_setn(r->headers_out, "X-User-Agent", ua);
102  #endif  #endif
103          return OK;          return OK;
104  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26