nginx-0.0.9-2004-07-30-21:05:14 import
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 68be0ef..910846f 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -206,7 +206,7 @@
return NGX_OK;
}
- in_cidr->mask = (ngx_uint_t) (0 - (1 << (32 - m)));
+ in_cidr->mask = htonl((ngx_uint_t) (0 - (1 << (32 - m))));
return NGX_OK;
}
diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c
index 1e6ee64..f14040f 100644
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -123,6 +123,83 @@
}
+ngx_int_t ngx_encode_base64(ngx_pool_t *pool, ngx_str_t *src, ngx_str_t *dst)
+{
+ u_char *d, *s;
+ ngx_uint_t i;
+ static u_char basis64[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ if (!(d = ngx_palloc(pool, ((src->len + 2) / 3) * 4 + 1))) {
+ return NGX_ERROR;
+ }
+
+ dst->data = d;
+ s = src->data;
+
+ for (i = 0; i < src->len - 2; i += 3) {
+ *d++ = basis64[(s[i] >> 2) & 0x3f];
+ *d++ = basis64[((s[i] & 3) << 4) | (s[i + 1] >> 4)];
+ *d++ = basis64[((s[i + 1] & 0x0f) << 2) | (s[i + 2] >> 6)];
+ *d++ = basis64[s[i + 2] & 0x3f];
+ }
+
+ if (i < src->len) {
+ *d++ = basis64[(s[i] >> 2) & 0x3f];
+
+ if (i == src->len - 1) {
+ *d++ = basis64[(s[i] & 3) << 4];
+ *d++ = '=';
+
+ } else {
+ *d++ = basis64[((s[i] & 3) << 4) | (s[i + 1] >> 4)];
+ *d++ = basis64[(s[i + 1] & 0x0f) << 2];
+ }
+
+ *d++ = '=';
+ }
+
+ dst->len = d - dst->data;
+ *d++ = '\0';
+
+ return NGX_OK;
+}
+
+
+ngx_int_t ngx_decode_base64(ngx_pool_t *pool, ngx_str_t *src, ngx_str_t *dst)
+{
+ u_char *d, *s, c;
+
+ if (!(d = ngx_palloc(pool, ((src->len + 3) / 4) * 3))) {
+ return NGX_ABORT;
+ }
+
+ dst->data = d;
+ s = src->data;
+
+ if (*s == '+') {
+ c = 62;
+
+ } else if (*s == '/') {
+ c = 63;
+
+ } else if (*s >= '0' && *s <= '9') {
+ c = *s - '0' + 52;
+
+ } else if (*s >= 'A' && *s <= 'Z') {
+ c = *s - 'A';
+
+ } else if (*s >= 'a' && *s <= 'z') {
+ c = *s - 'a' + 26;
+
+ } else {
+ return NGX_ERROR;
+ }
+
+ return NGX_OK;
+}
+
+
#if 0
char *ngx_psprintf(ngx_pool_t *p, const char *fmt, ...)
{
diff --git a/src/http/modules/ngx_http_access_handler.c b/src/http/modules/ngx_http_access_handler.c
index b6fdeab..6dd5729 100644
--- a/src/http/modules/ngx_http_access_handler.c
+++ b/src/http/modules/ngx_http_access_handler.c
@@ -92,6 +92,9 @@
rule = alcf->rules->elts;
for (i = 0; i < alcf->rules->nelts; i++) {
+ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "%08X %08X %08X",
+ addr_in->sin_addr.s_addr, rule[i].mask, rule[i].addr);
+
if ((addr_in->sin_addr.s_addr & rule[i].mask) == rule[i].addr) {
if (rule[i].deny) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 2280c1b..06c6165 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -341,6 +341,16 @@
break;
}
+ if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) {
+
+ /*
+ * MSIE may wait for some time if the response for the POST request
+ * is sent over the keepalive connection
+ */
+
+ r->keepalive = 0;
+ }
+
#if 0
/* TEST STUB */ r->http_version = NGX_HTTP_VERSION_10;
/* TEST STUB */ r->keepalive = 0;