]> git.kaiwu.me - nginx.git/commitdiff
do not allow plain 0.9 request to HTTPS
authorIgor Sysoev <igor@sysoev.ru>
Sat, 1 Dec 2007 11:46:04 +0000 (11:46 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sat, 1 Dec 2007 11:46:04 +0000 (11:46 +0000)
src/http/ngx_http_request.c

index e6341830648c2221484a1bc459f61615f9c166c5..5ecdf120487e1445d8cbfca141f786072c5057df 100644 (file)
@@ -1335,13 +1335,6 @@ ngx_http_process_request_header(ngx_http_request_t *r)
         return NGX_ERROR;
     }
 
-    if (r->plain_http) {
-        ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
-                      "client sent plain HTTP request to HTTPS port");
-        ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
-        return NGX_ERROR;
-    }
-
     if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) {
         if (r->headers_in.keep_alive) {
             r->headers_in.keep_alive_n =
@@ -1409,6 +1402,13 @@ ngx_http_process_request(ngx_http_request_t *r)
 
     c = r->connection;
 
+    if (r->plain_http) {
+        ngx_log_error(NGX_LOG_INFO, c->log, 0,
+                      "client sent plain HTTP request to HTTPS port");
+        ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
+        return;
+    }
+
 #if (NGX_HTTP_SSL)
 
     if (c->ssl) {