comparison src/http/ngx_http_request.c @ 429:694cd6cdb714

nginx-0.0.11-2004-09-17-20:07:35 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 17 Sep 2004 16:07:35 +0000
parents 0d08eabe5c7b
children 1fa5daf7558e
comparison
equal deleted inserted replaced
428:5e73d0ea4dab 429:694cd6cdb714
1021 } 1021 }
1022 1022
1023 1023
1024 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r) 1024 static ngx_int_t ngx_http_process_request_header(ngx_http_request_t *r)
1025 { 1025 {
1026 u_char *ua; 1026 u_char *ua, *user_agent;
1027 size_t len; 1027 size_t len;
1028 ngx_uint_t i; 1028 ngx_uint_t i;
1029 ngx_http_server_name_t *name; 1029 ngx_http_server_name_t *name;
1030 ngx_http_core_srv_conf_t *cscf; 1030 ngx_http_core_srv_conf_t *cscf;
1031 ngx_http_core_loc_conf_t *clcf; 1031 ngx_http_core_loc_conf_t *clcf;
1124 /* 1124 /*
1125 * check some widespread browsers while the headers are still 1125 * check some widespread browsers while the headers are still
1126 * in CPU cache 1126 * in CPU cache
1127 */ 1127 */
1128 1128
1129 ua = (u_char *) ngx_strstr(r->headers_in.user_agent->value.data, 1129 user_agent = r->headers_in.user_agent->value.data;
1130 "MSIE"); 1130
1131 if (ua 1131 ua = (u_char *) ngx_strstr(user_agent, "MSIE");
1132 && ua + 8 < r->headers_in.user_agent->value.data 1132
1133 + r->headers_in.user_agent->value.len) 1133 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) {
1134 { 1134
1135 r->headers_in.msie = 1; 1135 r->headers_in.msie = 1;
1136
1136 if (ua[4] == ' ' && ua[5] == '4' && ua[6] == '.') { 1137 if (ua[4] == ' ' && ua[5] == '4' && ua[6] == '.') {
1137 r->headers_in.msie4 = 1; 1138 r->headers_in.msie4 = 1;
1138 } 1139 }
1139 1140
1140 #if 0 1141 #if 0
1142 1143
1143 ngx_ssl_set_nosendshut(r->connection->ssl); 1144 ngx_ssl_set_nosendshut(r->connection->ssl);
1144 #endif 1145 #endif
1145 } 1146 }
1146 1147
1147 if (ngx_strstr(r->headers_in.user_agent->value.data, "Opera")) { 1148 if (ngx_strstr(user_agent, "Opera")) {
1148 r->headers_in.opera = 1; 1149 r->headers_in.opera = 1;
1149 r->headers_in.msie = 0; 1150 r->headers_in.msie = 0;
1150 r->headers_in.msie4 = 0; 1151 r->headers_in.msie4 = 0;
1152 }
1153
1154 if (!r->headers_in.msie && !r->headers_in.opera) {
1155
1156 if (ngx_strstr(user_agent, "Gecko")) {
1157 r->headers_in.gecko = 1;
1158
1159 } else if (ngx_strstr(user_agent, "Konqueror")) {
1160 r->headers_in.konqueror = 1;
1161 }
1151 } 1162 }
1152 } 1163 }
1153 1164
1154 return NGX_OK; 1165 return NGX_OK;
1155 } 1166 }