]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.0.1-2002-12-17-18:48:27 import
authorIgor Sysoev <igor@sysoev.ru>
Tue, 17 Dec 2002 15:48:27 +0000 (15:48 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 17 Dec 2002 15:48:27 +0000 (15:48 +0000)
src/core/ngx_config.h
src/core/ngx_sendfile.c
src/http/modules/ngx_http_index_handler.c
src/http/ngx_http_event.c
src/http/ngx_http_parse_time.c
src/os/unix/freebsd/ngx_sendfile.c

index cc650c1f027b929e984f84f9e8aef69c70a93644..2582ddae3d71b3fdbfa1337254610b754470c1f2 100644 (file)
 #define HAVE_INHERITED_NONBLOCK  1
 #endif
 
+/* FreeBSD sendfile */
 #if __FreeBSD_version >= 300007
 
 #ifndef HAVE_FREEBSD_SENDFILE
 #define HAVE_FREEBSD_SENDFILE_NBYTES_BUG  2
 #endif
 
-#endif
+#endif /* FreeBSD sendfile */
 
+/* FreeBSD sendfile nbytes bug */
 #if (__FreeBSD__ == 4 && __FreeBSD_version >= 460100) \
     || __FreeBSD_version == 460001
     || __FreeBSD_version >= 500029
 #define HAVE_FREEBSD_SENDFILE_NBYTES_BUG  0
 #endif
 
-#endif
+#endif /* FreeBSD sendfile nbytes bug */
 
 #if (HAVE_FREEBSD_SENDFILE)
 #define HAVE_SENDFILE  1
 #endif
 
 
+/* FreeBSD kqueue */
 #if (__FreeBSD__ == 4 && __FreeBSD_version >= 410000) \
     || __FreeBSD_version >= 500011
 
 #include <sys/event.h>
 #endif
 
-#endif
+#endif /* FreeBSD kqueue */
 
 
 #endif /* __FreeBSD__ */
index bffd29c0c859803ade67fef2afb8bc7c7fd24458..e930fe53bb6d8c263fc1535d44374cc798d606b0 100644 (file)
@@ -1,5 +1,8 @@
 
 #include <ngx_config.h>
+
+#if !(HAVE_SENDFILE)
+
 #include <ngx_core.h>
 #include <ngx_log.h>
 #include <ngx_socket.h>
@@ -18,3 +21,5 @@ int ngx_sendfile(ngx_socket_t s,
 
     return NGX_ERROR;
 }
+
+#endif
index 1948795032ee7b81ca8be14db9781f3196c30f04..db3e3ccfe334678804e79291f164b1ffe0af0f22 100644 (file)
@@ -19,7 +19,7 @@ static char *ngx_http_index_set_index(ngx_pool_t *p, void *conf,
 
 static ngx_command_t ngx_http_index_commands[] = {
 
-    {"index", ngx_http_index_set_index, NULL,
+    {"index", ngx_http_index_set_index, 0,
      NGX_HTTP_LOC_CONF, NGX_CONF_ITERATE,
      "set index files"},
 
index cbea0c6826fe3cb19b27e4d53b90935c541c6319..60b3ca4160f4cf0803da508f74c5578796bcb14c 100644 (file)
@@ -104,11 +104,11 @@ int ngx_http_init_connection(ngx_connection_t *c)
     ngx_test_null(c->addr_text.data, ngx_palloc(c->pool, c->addr_text.len),
                   NGX_ERROR);
 
-    ngx_test_null(c->addr_text.len,
-                  ngx_inet_ntop(c->family,
-                                (char *)c->sockaddr + c->addr,
-                                c->addr_text.data, c->addr_text.len),
-                  NGX_ERROR);
+    c->addr_text.len = ngx_inet_ntop(c->family,
+                                     (char *)c->sockaddr + c->addr,
+                                     c->addr_text.data, c->addr_text.len);
+    if (c->addr_text.len = 0)
+       return NGX_ERROR;
 
     ngx_test_null(ctx, ngx_pcalloc(c->pool, sizeof(ngx_http_log_ctx_t)),
                   NGX_ERROR);
index 199a7f9f044a53a15964e67330cfcfc83c90910e..9c606c26ee27b5d0ee02bf6b0624664b1cf61f66 100644 (file)
@@ -207,7 +207,7 @@ time_t ngx_http_parse_time(char *value, size_t len)
        month += 12;
        year -= 1;
     }
-           /* Gauss's formula for days from 1 March 1 BC */
+           /* Gauss's formula for Grigorian days from 1 March 1 BC */
     return (365 * year + year / 4 - year / 100 + year / 400
                                                + 367 * month / 12 + day - 31
            /* 719527 days are between 1 March 1 BC and 1 March 1970,
index ff577db7dcfaf05b123c9f863fbda88aed1e30c5..dcbf68a3a7d64dc95e51e7ad7d1641fe20e89934 100644 (file)
@@ -1,5 +1,8 @@
 
 #include <ngx_config.h>
+
+#if (HAVE_FREEBSD_SENDFILE)
+
 #include <ngx_core.h>
 #include <ngx_types.h>
 #include <ngx_file.h>
 #include <ngx_sendfile.h>
 
 /*
-  TODO:
-    FreeBSD:
+  CHECK:
        check sent if errno == EINTR then should return right sent.
 */
 
-#if (HAVE_FREEBSD_SENDFILE)
 
 int ngx_sendfile(ngx_socket_t s,
                  ngx_iovec_t *headers, int hdr_cnt,