nginx-0.0.1-2002-08-22-19:24:03 import
diff --git a/src/core/ngx_alloc.c b/src/core/ngx_alloc.c
index 61ecabc..e059e94 100644
--- a/src/core/ngx_alloc.c
+++ b/src/core/ngx_alloc.c
@@ -12,8 +12,8 @@
 
     p = malloc(size);
     if (p == NULL)
-        ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
-                     "ngx_alloc: malloc %d bytes failed", size);
+        ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
+                      "ngx_alloc: malloc() %d bytes failed", size);
     return p;
 }
 
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
new file mode 100644
index 0000000..137e160
--- /dev/null
+++ b/src/core/ngx_core.h
@@ -0,0 +1,10 @@
+#ifndef _NGX_CORE_H_INCLUDED_
+#define _NGX_CORE_H_INCLUDED_
+
+
+#define  NGX_OK      0
+#define  NGX_ERROR  -1
+#define  NGX_AGAIN  -2
+
+
+#endif /* _NGX_CORE_H_INCLUDED_ */
diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h
index 8352333..36c36e8 100644
--- a/src/core/ngx_hunk.h
+++ b/src/core/ngx_hunk.h
@@ -57,6 +57,14 @@
     ngx_chain_t *next;
 };
 
+#define ngx_add_hunk_to_chain(chain, h, pool, error)                         \
+            do {                                                             \
+                ngx_test_null(chain, ngx_create_chain_entry(pool), error);   \
+                chain->hunk = h;                                             \
+                chain->next = NULL;                                          \
+            } while (0);
+
+
 
 ngx_hunk_t *ngx_get_hunk(ngx_pool_t *pool, int size, int before, int after);
 
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index ad4fcee..7afabcb 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -17,17 +17,37 @@
 
 /*
     "[%time] [%level] %pid#%tid: %message:(%errno)%errstr, while %action"
-        " %peer and processing %context"
+        " %peer and while processing %context"
 
+    ----
     message = "recv() failed";
     errno = 32;
     action = "reading request headers from client";
     peer = "192.168.1.1";
     context = "URL /"
 
-    "[2002/08/20 12:00:00] [error] 412#3: recv() failed:(32)Broken pipe,"
+    "[2002/08/20 12:00:00] [error] 412#3: recv() failed (32: Broken pipe)"
     " while reading request headers from client 192.168.1.1"
-    " and processing URL /"
+    " and while processing URL /"
+
+    ----
+    message = "recv() failed";
+    errno = 32;
+    ngx_http_proxy_error_context_t:
+        action = "reading headers from server %s for client %s and "
+                 "while processing %s"
+        backend = "127.0.0.1";
+        peer = "192.168.1.1";
+        context = "URL /"
+
+    "[2002/08/20 12:00:00] [error] 412#3: recv() failed (32: Broken pipe)"
+    " while reading headers from backend 127.0.0.1"
+    " for client 192.168.1.1 and while processing URL /"
+
+    ----
+    "[alert] 412#3: ngx_alloc: malloc() 102400 bytes failed (12: Cannot "
+    "allocate memory) while reading request headers from client 192.168.1.1"
+    " and while processing URL /"
 
 
     OLD:
@@ -42,7 +62,10 @@
     int    log_level;
     char  *action;
     char  *context;
-/*  char  *func(ngx_log_t *log); */
+#if 0
+    void  *data;   /* i.e. ngx_http_proxy_error_context_t */
+    char  *func(ngx_log_t *log);
+#endif
 } ngx_log_t;
 
 #define MAX_ERROR_STR	2048
@@ -57,7 +80,7 @@
 #define ngx_log_error(level, log, args...) \
         if (log->log_level >= level) ngx_log_error_core(level, log, args)
 
-#ifdef NGX_DEBUG
+#if (NGX_DEBUG)
 #define ngx_log_debug(log, args...) \
     if (log->log_level == NGX_LOG_DEBUG) \
         ngx_log_error_core(NGX_LOG_DEBUG, log, 0, args)
@@ -82,7 +105,7 @@
 #define ngx_log_error(level, log, ...) \
         if (log->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
 
-#ifdef NGX_DEBUG
+#if (NGX_DEBUG)
 #define ngx_log_debug(log, ...) \
     if (log->log_level == NGX_LOG_DEBUG) \
         ngx_log_error_core(NGX_LOG_DEBUG, log, 0, __VA_ARGS__)
@@ -104,7 +127,7 @@
 
 #include <stdarg.h>
 
-#ifdef NGX_DEBUG
+#if (NGX_DEBUG)
 #define ngx_log_debug(log, text) \
     if (log->log_level == NGX_LOG_DEBUG) \
         ngx_log_debug_core(log, text)