comparison src/http/ngx_http_request.c @ 1611:d5db0e96bcc6 stable-0.5

r1542, r1543, r1544, r1549, r1550, r1551, r1555 merge: *) ngx_strstrn() and ngx_strcasestrn() *) fix memcached END test
author Igor Sysoev <igor@sysoev.ru>
date Mon, 29 Oct 2007 14:52:51 +0000
parents 85e12fc61211
children cacb565c554e
comparison
equal deleted inserted replaced
1610:f5e9d597a751 1611:d5db0e96bcc6
1203 1203
1204 static ngx_int_t 1204 static ngx_int_t
1205 ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h, 1205 ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h,
1206 ngx_uint_t offset) 1206 ngx_uint_t offset)
1207 { 1207 {
1208 if (ngx_strstr(h->value.data, "close")) { 1208 if (ngx_strcasestrn(h->value.data, "close", 5 - 1)) {
1209 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; 1209 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
1210 1210
1211 } else if (ngx_strstr(h->value.data, "keep-alive")) { 1211 } else if (ngx_strcasestrn(h->value.data, "keep-alive", 10 - 1)) {
1212 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE; 1212 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
1213 } 1213 }
1214 1214
1215 return NGX_OK; 1215 return NGX_OK;
1216 } 1216 }
1318 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); 1318 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
1319 return NGX_ERROR; 1319 return NGX_ERROR;
1320 } 1320 }
1321 1321
1322 if (r->headers_in.transfer_encoding 1322 if (r->headers_in.transfer_encoding
1323 && ngx_strstr(r->headers_in.transfer_encoding->value.data, "chunked")) 1323 && ngx_strcasestrn(r->headers_in.transfer_encoding->value.data,
1324 "chunked", 7 - 1))
1324 { 1325 {
1325 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1326 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1326 "client sent \"Transfer-Encoding: chunked\" header"); 1327 "client sent \"Transfer-Encoding: chunked\" header");
1327 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); 1328 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
1328 return NGX_ERROR; 1329 return NGX_ERROR;
1350 * in CPU cache 1351 * in CPU cache
1351 */ 1352 */
1352 1353
1353 user_agent = r->headers_in.user_agent->value.data; 1354 user_agent = r->headers_in.user_agent->value.data;
1354 1355
1355 ua = (u_char *) ngx_strstr(user_agent, "MSIE"); 1356 ua = ngx_strstrn(user_agent, "MSIE", 4 - 1);
1356 1357
1357 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) { 1358 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) {
1358 1359
1359 r->headers_in.msie = 1; 1360 r->headers_in.msie = 1;
1360 1361
1368 c->ssl->no_send_shutdown = 1; 1369 c->ssl->no_send_shutdown = 1;
1369 } 1370 }
1370 #endif 1371 #endif
1371 } 1372 }
1372 1373
1373 if (ngx_strstr(user_agent, "Opera")) { 1374 if (ngx_strstrn(user_agent, "Opera", 5 - 1)) {
1374 r->headers_in.opera = 1; 1375 r->headers_in.opera = 1;
1375 r->headers_in.msie = 0; 1376 r->headers_in.msie = 0;
1376 r->headers_in.msie4 = 0; 1377 r->headers_in.msie4 = 0;
1377 } 1378 }
1378 1379
1379 if (!r->headers_in.msie && !r->headers_in.opera) { 1380 if (!r->headers_in.msie && !r->headers_in.opera) {
1380 1381
1381 if (ngx_strstr(user_agent, "Gecko/")) { 1382 if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
1382 r->headers_in.gecko = 1; 1383 r->headers_in.gecko = 1;
1383 1384
1384 } else if (ngx_strstr(user_agent, "Konqueror")) { 1385 } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
1385 r->headers_in.konqueror = 1; 1386 r->headers_in.konqueror = 1;
1386 } 1387 }
1387 } 1388 }
1388 } 1389 }
1389 1390