comparison src/http/ngx_http_request.c @ 1676:447765dc6d67

do not allow plain 0.9 request to HTTPS
author Igor Sysoev <igor@sysoev.ru>
date Sat, 01 Dec 2007 11:46:04 +0000
parents 13f8dec720b5
children c997912a8f0b
comparison
equal deleted inserted replaced
1675:c74e7fd0bcaf 1676:447765dc6d67
1333 "client sent \"Transfer-Encoding: chunked\" header"); 1333 "client sent \"Transfer-Encoding: chunked\" header");
1334 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); 1334 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
1335 return NGX_ERROR; 1335 return NGX_ERROR;
1336 } 1336 }
1337 1337
1338 if (r->plain_http) {
1339 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1340 "client sent plain HTTP request to HTTPS port");
1341 ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
1342 return NGX_ERROR;
1343 }
1344
1345 if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) { 1338 if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) {
1346 if (r->headers_in.keep_alive) { 1339 if (r->headers_in.keep_alive) {
1347 r->headers_in.keep_alive_n = 1340 r->headers_in.keep_alive_n =
1348 ngx_atotm(r->headers_in.keep_alive->value.data, 1341 ngx_atotm(r->headers_in.keep_alive->value.data,
1349 r->headers_in.keep_alive->value.len); 1342 r->headers_in.keep_alive->value.len);
1406 long rc; 1399 long rc;
1407 ngx_http_ssl_srv_conf_t *sscf; 1400 ngx_http_ssl_srv_conf_t *sscf;
1408 #endif 1401 #endif
1409 1402
1410 c = r->connection; 1403 c = r->connection;
1404
1405 if (r->plain_http) {
1406 ngx_log_error(NGX_LOG_INFO, c->log, 0,
1407 "client sent plain HTTP request to HTTPS port");
1408 ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
1409 return;
1410 }
1411 1411
1412 #if (NGX_HTTP_SSL) 1412 #if (NGX_HTTP_SSL)
1413 1413
1414 if (c->ssl) { 1414 if (c->ssl) {
1415 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); 1415 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);