comparison src/http/ngx_http_request.c @ 218:1bf60f8c5c9e NGINX_0_3_56

nginx 0.3.56 *) Feature: the "dav_access" directive. *) Feature: the "if" directive supports the "-d", "!-d", "-e", "!-e", "-x", and "!-x" operators. *) Bugfix: a segmentation fault occurred if an request returned an redirect and some sent to client header lines were logged in the access log.
author Igor Sysoev <http://sysoev.ru>
date Fri, 04 Aug 2006 00:00:00 +0400
parents fa32d59d9a15
children 559bc7ec214e
comparison
equal deleted inserted replaced
217:a346c23fc94e 218:1bf60f8c5c9e
1267 "client sent plain HTTP request to HTTPS port"); 1267 "client sent plain HTTP request to HTTPS port");
1268 ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS); 1268 ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
1269 return NGX_ERROR; 1269 return NGX_ERROR;
1270 } 1270 }
1271 1271
1272 if (r->headers_in.connection) {
1273 if (r->headers_in.connection->value.len == 5
1274 && ngx_strcasecmp(r->headers_in.connection->value.data, "close")
1275 == 0)
1276 {
1277 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
1278
1279 } else if (r->headers_in.connection->value.len == 10
1280 && ngx_strcasecmp(r->headers_in.connection->value.data,
1281 "keep-alive") == 0)
1282 {
1283 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
1284
1285 if (r->headers_in.keep_alive) {
1286 r->headers_in.keep_alive_n =
1287 ngx_atotm(r->headers_in.keep_alive->value.data,
1288 r->headers_in.keep_alive->value.len);
1289 }
1290 }
1291 }
1292
1293 if (r->headers_in.user_agent) {
1294
1295 /*
1296 * check some widespread browsers while the headers are still
1297 * in CPU cache
1298 */
1299
1300 user_agent = r->headers_in.user_agent->value.data;
1301
1302 ua = (u_char *) ngx_strstr(user_agent, "MSIE");
1303
1304 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) {
1305
1306 r->headers_in.msie = 1;
1307
1308 if (ua[4] == ' ' && ua[5] == '4' && ua[6] == '.') {
1309 r->headers_in.msie4 = 1;
1310 }
1311
1312 #if 0
1313 /* MSIE ignores the SSL "close notify" alert */
1314 if (c->ssl) {
1315 c->ssl->no_send_shutdown = 1;
1316 }
1317 #endif
1318 }
1319
1320 if (ngx_strstr(user_agent, "Opera")) {
1321 r->headers_in.opera = 1;
1322 r->headers_in.msie = 0;
1323 r->headers_in.msie4 = 0;
1324 }
1325
1326 if (!r->headers_in.msie && !r->headers_in.opera) {
1327
1328 if (ngx_strstr(user_agent, "Gecko/")) {
1329 r->headers_in.gecko = 1;
1330
1331 } else if (ngx_strstr(user_agent, "Konqueror")) {
1332 r->headers_in.konqueror = 1;
1333 }
1334 }
1335 }
1336
1272 #if (NGX_HTTP_SSL) 1337 #if (NGX_HTTP_SSL)
1273 1338
1274 if (r->connection->ssl) { 1339 if (r->connection->ssl) {
1275 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); 1340 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
1276 1341
1277 if (sscf->verify) { 1342 if (sscf->verify) {
1278 rc = SSL_get_verify_result(r->connection->ssl->connection); 1343 rc = SSL_get_verify_result(r->connection->ssl->connection);
1279 1344
1280 if (rc != X509_V_OK) { 1345 if (rc != X509_V_OK) {
1281 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1346 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1282 "client SSL certificate verify error: %l ", rc); 1347 "client SSL certificate verify error: (%l:%s) ",
1348 rc, X509_verify_cert_error_string(rc));
1283 ngx_http_finalize_request(r, NGX_HTTPS_CERT_ERROR); 1349 ngx_http_finalize_request(r, NGX_HTTPS_CERT_ERROR);
1284 return NGX_ERROR; 1350 return NGX_ERROR;
1285 } 1351 }
1286 1352
1287 if (SSL_get_peer_certificate(r->connection->ssl->connection) 1353 if (SSL_get_peer_certificate(r->connection->ssl->connection)
1294 } 1360 }
1295 } 1361 }
1296 } 1362 }
1297 1363
1298 #endif 1364 #endif
1299
1300 if (r->headers_in.connection) {
1301 if (r->headers_in.connection->value.len == 5
1302 && ngx_strcasecmp(r->headers_in.connection->value.data, "close")
1303 == 0)
1304 {
1305 r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE;
1306
1307 } else if (r->headers_in.connection->value.len == 10
1308 && ngx_strcasecmp(r->headers_in.connection->value.data,
1309 "keep-alive") == 0)
1310 {
1311 r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
1312
1313 if (r->headers_in.keep_alive) {
1314 r->headers_in.keep_alive_n =
1315 ngx_atotm(r->headers_in.keep_alive->value.data,
1316 r->headers_in.keep_alive->value.len);
1317 }
1318 }
1319 }
1320
1321 if (r->headers_in.user_agent) {
1322
1323 /*
1324 * check some widespread browsers while the headers are still
1325 * in CPU cache
1326 */
1327
1328 user_agent = r->headers_in.user_agent->value.data;
1329
1330 ua = (u_char *) ngx_strstr(user_agent, "MSIE");
1331
1332 if (ua && ua + 8 < user_agent + r->headers_in.user_agent->value.len) {
1333
1334 r->headers_in.msie = 1;
1335
1336 if (ua[4] == ' ' && ua[5] == '4' && ua[6] == '.') {
1337 r->headers_in.msie4 = 1;
1338 }
1339
1340 #if 0
1341 /* MSIE ignores the SSL "close notify" alert */
1342 if (c->ssl) {
1343 c->ssl->no_send_shutdown = 1;
1344 }
1345 #endif
1346 }
1347
1348 if (ngx_strstr(user_agent, "Opera")) {
1349 r->headers_in.opera = 1;
1350 r->headers_in.msie = 0;
1351 r->headers_in.msie4 = 0;
1352 }
1353
1354 if (!r->headers_in.msie && !r->headers_in.opera) {
1355
1356 if (ngx_strstr(user_agent, "Gecko/")) {
1357 r->headers_in.gecko = 1;
1358
1359 } else if (ngx_strstr(user_agent, "Konqueror")) {
1360 r->headers_in.konqueror = 1;
1361 }
1362 }
1363 }
1364 1365
1365 return NGX_OK; 1366 return NGX_OK;
1366 } 1367 }
1367 1368
1368 1369