comparison src/http/ngx_http_request.c @ 1549:099d8470e6c3

pass length clearly
author Igor Sysoev <igor@sysoev.ru>
date Mon, 01 Oct 2007 12:57:47 +0000
parents 8596627c4cc5
children 4435ca2e467d
comparison
equal deleted inserted replaced
1548:a83aa8c53552 1549:099d8470e6c3
1202 1202
1203 static ngx_int_t 1203 static ngx_int_t
1204 ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h, 1204 ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h,
1205 ngx_uint_t offset) 1205 ngx_uint_t offset)
1206 { 1206 {
1207 if (ngx_strcasestrn(h->value.data, "close", 4)) { 1207 if (ngx_strcasestrn(h->value.data, "close", 5 - 1)) {
1208 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; 1208 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
1209 1209
1210 } else if (ngx_strcasestrn(h->value.data, "keep-alive", 9)) { 1210 } else if (ngx_strcasestrn(h->value.data, "keep-alive", 10 - 1)) {
1211 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE; 1211 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
1212 } 1212 }
1213 1213
1214 return NGX_OK; 1214 return NGX_OK;
1215 } 1215 }
1318 return NGX_ERROR; 1318 return NGX_ERROR;
1319 } 1319 }
1320 1320
1321 if (r->headers_in.transfer_encoding 1321 if (r->headers_in.transfer_encoding
1322 && ngx_strcasestrn(r->headers_in.transfer_encoding->value.data, 1322 && ngx_strcasestrn(r->headers_in.transfer_encoding->value.data,
1323 "chunked", 6)) 1323 "chunked", 7 - 1))
1324 { 1324 {
1325 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1325 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1326 "client sent \"Transfer-Encoding: chunked\" header"); 1326 "client sent \"Transfer-Encoding: chunked\" header");
1327 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); 1327 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
1328 return NGX_ERROR; 1328 return NGX_ERROR;
1350 * in CPU cache 1350 * in CPU cache
1351 */ 1351 */
1352 1352
1353 user_agent = r->headers_in.user_agent->value.data; 1353 user_agent = r->headers_in.user_agent->value.data;
1354 1354
1355 ua = ngx_strstrn(user_agent, "MSIE", 3); 1355 ua = ngx_strstrn(user_agent, "MSIE", 4 - 1);
1356 1356
1357 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) { 1357 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) {
1358 1358
1359 r->headers_in.msie = 1; 1359 r->headers_in.msie = 1;
1360 1360
1368 c->ssl->no_send_shutdown = 1; 1368 c->ssl->no_send_shutdown = 1;
1369 } 1369 }
1370 #endif 1370 #endif
1371 } 1371 }
1372 1372
1373 if (ngx_strstrn(user_agent, "Opera", 4)) { 1373 if (ngx_strstrn(user_agent, "Opera", 5 - 1)) {
1374 r->headers_in.opera = 1; 1374 r->headers_in.opera = 1;
1375 r->headers_in.msie = 0; 1375 r->headers_in.msie = 0;
1376 r->headers_in.msie4 = 0; 1376 r->headers_in.msie4 = 0;
1377 } 1377 }
1378 1378
1379 if (!r->headers_in.msie && !r->headers_in.opera) { 1379 if (!r->headers_in.msie && !r->headers_in.opera) {
1380 1380
1381 if (ngx_strstrn(user_agent, "Gecko/", 5)) { 1381 if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
1382 r->headers_in.gecko = 1; 1382 r->headers_in.gecko = 1;
1383 1383
1384 } else if (ngx_strstrn(user_agent, "Konqueror", 8)) { 1384 } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
1385 r->headers_in.konqueror = 1; 1385 r->headers_in.konqueror = 1;
1386 } 1386 }
1387 } 1387 }
1388 } 1388 }
1389 1389