diff src/http/ngx_http_request.c @ 393:5659d773cfa8

nginx-0.0.7-2004-07-15-20:35:51 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 15 Jul 2004 16:35:51 +0000
parents d1222d46b3f9
children e7a68e14ccd3
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -141,6 +141,9 @@ static void ngx_http_init_request(ngx_ev
     ngx_http_server_name_t    *server_name;
     ngx_http_core_srv_conf_t  *cscf;
     ngx_http_core_loc_conf_t  *clcf;
+#if (NGX_HTTP_SSL)
+    ngx_http_ssl_srv_conf_t   *sscf;
+#endif
 
     c = rev->data;
 
@@ -229,9 +232,18 @@ static void ngx_http_init_request(ngx_ev
     r->srv_conf = cscf->ctx->srv_conf;
     r->loc_conf = cscf->ctx->loc_conf;
 
-#if 1
-    r->ssl = 1;
-    r->filter_need_in_memory = 1;
+#if (NGX_HTTP_SSL)
+
+    sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_filter_module);
+    if (sscf->enable) {
+        if (ngx_ssl_create_session(sscf->ssl_ctx, c) == NGX_ERROR) {
+            ngx_http_close_connection(c);
+            return;
+        }
+
+        r->filter_need_in_memory = 1;
+    }
+
 #endif
 
     server_name = cscf->server_names.elts;
@@ -820,22 +832,13 @@ static ssize_t ngx_http_read_request_hea
         return NGX_AGAIN;
     }
 
-/* STUB */
-#if (NGX_OPENSSL)
-    if (r->ssl) {
-        n = ngx_http_ssl_read(r, r->header_in->last,
-                              r->header_in->end - r->header_in->last);
-    } else {
-#endif
-        n = ngx_recv(r->connection, r->header_in->last,
-                     r->header_in->end - r->header_in->last);
-#if (NGX_OPENSSL)
-    }
-#endif
+    cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
+
+    n = cscf->recv(r->connection, r->header_in->last,
+                   r->header_in->end - r->header_in->last);
 
     if (n == NGX_AGAIN) {
         if (!r->header_timeout_set) {
-            cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
             ngx_add_timer(rev, cscf->client_header_timeout);
             r->header_timeout_set = 1;
         }