aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_access_module.c10
-rw-r--r--src/http/modules/ngx_http_addition_filter_module.c8
-rw-r--r--src/http/modules/ngx_http_auth_basic_module.c10
-rw-r--r--src/http/modules/ngx_http_autoindex_module.c44
-rw-r--r--src/http/modules/ngx_http_charset_filter_module.c23
-rw-r--r--src/http/modules/ngx_http_chunked_filter_module.c8
-rw-r--r--src/http/modules/ngx_http_dav_module.c34
-rw-r--r--src/http/modules/ngx_http_gzip_filter_module.c32
-rw-r--r--src/http/modules/ngx_http_headers_filter_module.c26
-rw-r--r--src/http/modules/ngx_http_index_module.c56
-rw-r--r--src/http/modules/ngx_http_not_modified_filter_module.c12
-rw-r--r--src/http/modules/ngx_http_range_filter_module.c16
-rw-r--r--src/http/modules/ngx_http_realip_module.c10
-rw-r--r--src/http/modules/ngx_http_rewrite_module.c10
-rw-r--r--src/http/modules/ngx_http_ssi_filter_module.c11
-rw-r--r--src/http/modules/ngx_http_static_module.c10
-rw-r--r--src/http/modules/ngx_http_userid_filter_module.c26
-rw-r--r--src/http/modules/perl/Makefile.PL7
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/modules/perl/nginx.xs36
-rw-r--r--src/http/modules/perl/ngx_http_perl_module.c51
-rw-r--r--src/http/modules/perl/ngx_http_perl_module.h6
22 files changed, 252 insertions, 196 deletions
diff --git a/src/http/modules/ngx_http_access_module.c b/src/http/modules/ngx_http_access_module.c
index 93c865253..2cd8a8f24 100644
--- a/src/http/modules/ngx_http_access_module.c
+++ b/src/http/modules/ngx_http_access_module.c
@@ -29,7 +29,7 @@ static char *ngx_http_access_rule(ngx_conf_t *cf, ngx_command_t *cmd,
static void *ngx_http_access_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_access_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
-static ngx_int_t ngx_http_access_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_access_init(ngx_conf_t *cf);
static ngx_command_t ngx_http_access_commands[] = {
@@ -57,7 +57,7 @@ static ngx_command_t ngx_http_access_commands[] = {
static ngx_http_module_t ngx_http_access_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_access_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -76,7 +76,7 @@ ngx_module_t ngx_http_access_module = {
ngx_http_access_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_access_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -215,12 +215,12 @@ ngx_http_access_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
static ngx_int_t
-ngx_http_access_init(ngx_cycle_t *cycle)
+ngx_http_access_init(ngx_conf_t *cf)
{
ngx_http_handler_pt *h;
ngx_http_core_main_conf_t *cmcf;
- cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
+ cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers);
if (h == NULL) {
diff --git a/src/http/modules/ngx_http_addition_filter_module.c b/src/http/modules/ngx_http_addition_filter_module.c
index 31209f9ca..9db87bda9 100644
--- a/src/http/modules/ngx_http_addition_filter_module.c
+++ b/src/http/modules/ngx_http_addition_filter_module.c
@@ -20,10 +20,10 @@ typedef struct {
} ngx_http_addition_ctx_t;
-static ngx_int_t ngx_http_addition_filter_init(ngx_cycle_t *cycle);
static void *ngx_http_addition_create_conf(ngx_conf_t *cf);
static char *ngx_http_addition_merge_conf(ngx_conf_t *cf, void *parent,
void *child);
+static ngx_int_t ngx_http_addition_filter_init(ngx_conf_t *cf);
static ngx_command_t ngx_http_addition_commands[] = {
@@ -48,7 +48,7 @@ static ngx_command_t ngx_http_addition_commands[] = {
static ngx_http_module_t ngx_http_addition_filter_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_addition_filter_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -67,7 +67,7 @@ ngx_module_t ngx_http_addition_filter_module = {
ngx_http_addition_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_addition_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -178,7 +178,7 @@ ngx_http_addition_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
static ngx_int_t
-ngx_http_addition_filter_init(ngx_cycle_t *cycle)
+ngx_http_addition_filter_init(ngx_conf_t *cf)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_addition_header_filter;
diff --git a/src/http/modules/ngx_http_auth_basic_module.c b/src/http/modules/ngx_http_auth_basic_module.c
index 113527f2f..5a4f9d823 100644
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -32,7 +32,7 @@ static void ngx_http_auth_basic_close(ngx_file_t *file);
static void *ngx_http_auth_basic_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_auth_basic_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
-static ngx_int_t ngx_http_auth_basic_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_auth_basic_init(ngx_conf_t *cf);
static char *ngx_http_auth_basic(ngx_conf_t *cf, void *post, void *data);
@@ -62,7 +62,7 @@ static ngx_command_t ngx_http_auth_basic_commands[] = {
static ngx_http_module_t ngx_http_auth_basic_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_auth_basic_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -81,7 +81,7 @@ ngx_module_t ngx_http_auth_basic_module = {
ngx_http_auth_basic_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_auth_basic_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -351,12 +351,12 @@ ngx_http_auth_basic_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
static ngx_int_t
-ngx_http_auth_basic_init(ngx_cycle_t *cycle)
+ngx_http_auth_basic_init(ngx_conf_t *cf)
{
ngx_http_handler_pt *h;
ngx_http_core_main_conf_t *cmcf;
- cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
+ cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
h = ngx_array_push(&cmcf->phases[NGX_HTTP_ACCESS_PHASE].handlers);
if (h == NULL) {
diff --git a/src/http/modules/ngx_http_autoindex_module.c b/src/http/modules/ngx_http_autoindex_module.c
index 7064f37c2..1c7709376 100644
--- a/src/http/modules/ngx_http_autoindex_module.c
+++ b/src/http/modules/ngx_http_autoindex_module.c
@@ -48,7 +48,7 @@ static int ngx_libc_cdecl ngx_http_autoindex_cmp_entries(const void *one,
const void *two);
static ngx_int_t ngx_http_autoindex_error(ngx_http_request_t *r,
ngx_dir_t *dir, ngx_str_t *name);
-static ngx_int_t ngx_http_autoindex_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_autoindex_init(ngx_conf_t *cf);
static void *ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_autoindex_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
@@ -83,7 +83,7 @@ static ngx_command_t ngx_http_autoindex_commands[] = {
static ngx_http_module_t ngx_http_autoindex_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_autoindex_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -102,7 +102,7 @@ ngx_module_t ngx_http_autoindex_module = {
ngx_http_autoindex_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_autoindex_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -590,25 +590,6 @@ ngx_http_autoindex_error(ngx_http_request_t *r, ngx_dir_t *dir, ngx_str_t *name)
}
-static ngx_int_t
-ngx_http_autoindex_init(ngx_cycle_t *cycle)
-{
- ngx_http_handler_pt *h;
- ngx_http_core_main_conf_t *cmcf;
-
- cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
-
- h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
- if (h == NULL) {
- return NGX_ERROR;
- }
-
- *h = ngx_http_autoindex_handler;
-
- return NGX_OK;
-}
-
-
static void *
ngx_http_autoindex_create_loc_conf(ngx_conf_t *cf)
{
@@ -639,3 +620,22 @@ ngx_http_autoindex_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_OK;
}
+
+
+static ngx_int_t
+ngx_http_autoindex_init(ngx_conf_t *cf)
+{
+ ngx_http_handler_pt *h;
+ ngx_http_core_main_conf_t *cmcf;
+
+ cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
+
+ h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
+ if (h == NULL) {
+ return NGX_ERROR;
+ }
+
+ *h = ngx_http_autoindex_handler;
+
+ return NGX_OK;
+}
diff --git a/src/http/modules/ngx_http_charset_filter_module.c b/src/http/modules/ngx_http_charset_filter_module.c
index ab6f5ce2b..bf6ecc8cc 100644
--- a/src/http/modules/ngx_http_charset_filter_module.c
+++ b/src/http/modules/ngx_http_charset_filter_module.c
@@ -102,8 +102,6 @@ static char *ngx_http_set_charset_slot(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static ngx_int_t ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name);
-static ngx_int_t ngx_http_charset_filter_init(ngx_cycle_t *cycle);
-
static void *ngx_http_charset_create_main_conf(ngx_conf_t *cf);
static void *ngx_http_charset_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_charset_merge_loc_conf(ngx_conf_t *cf,
@@ -169,7 +167,7 @@ ngx_module_t ngx_http_charset_filter_module = {
ngx_http_charset_filter_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_charset_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -1334,19 +1332,6 @@ ngx_http_add_charset(ngx_array_t *charsets, ngx_str_t *name)
}
-static ngx_int_t
-ngx_http_charset_filter_init(ngx_cycle_t *cycle)
-{
- ngx_http_next_header_filter = ngx_http_top_header_filter;
- ngx_http_top_header_filter = ngx_http_charset_header_filter;
-
- ngx_http_next_body_filter = ngx_http_top_body_filter;
- ngx_http_top_body_filter = ngx_http_charset_body_filter;
-
- return NGX_OK;
-}
-
-
static void *
ngx_http_charset_create_main_conf(ngx_conf_t *cf)
{
@@ -1516,5 +1501,11 @@ ngx_http_charset_postconfiguration(ngx_conf_t *cf)
dst[tables[t].src] = tables[t].dst2src;
}
+ ngx_http_next_header_filter = ngx_http_top_header_filter;
+ ngx_http_top_header_filter = ngx_http_charset_header_filter;
+
+ ngx_http_next_body_filter = ngx_http_top_body_filter;
+ ngx_http_top_body_filter = ngx_http_charset_body_filter;
+
return NGX_OK;
}
diff --git a/src/http/modules/ngx_http_chunked_filter_module.c b/src/http/modules/ngx_http_chunked_filter_module.c
index 4e02194c0..3cc20ebfb 100644
--- a/src/http/modules/ngx_http_chunked_filter_module.c
+++ b/src/http/modules/ngx_http_chunked_filter_module.c
@@ -9,12 +9,12 @@
#include <ngx_http.h>
-static ngx_int_t ngx_http_chunked_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_chunked_filter_init(ngx_conf_t *cf);
static ngx_http_module_t ngx_http_chunked_filter_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_chunked_filter_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -33,7 +33,7 @@ ngx_module_t ngx_http_chunked_filter_module = {
NULL, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_chunked_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -183,7 +183,7 @@ ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
static ngx_int_t
-ngx_http_chunked_filter_init(ngx_cycle_t *cycle)
+ngx_http_chunked_filter_init(ngx_conf_t *cf)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_chunked_header_filter;
diff --git a/src/http/modules/ngx_http_dav_module.c b/src/http/modules/ngx_http_dav_module.c
index 8bede73af..02dd3886e 100644
--- a/src/http/modules/ngx_http_dav_module.c
+++ b/src/http/modules/ngx_http_dav_module.c
@@ -28,7 +28,7 @@ static char *ngx_http_dav_access(ngx_conf_t *cf, ngx_command_t *cmd,
static void *ngx_http_dav_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_dav_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
-static ngx_int_t ngx_http_dav_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_dav_init(ngx_conf_t *cf);
static ngx_conf_bitmask_t ngx_http_dav_methods_mask[] = {
@@ -69,7 +69,7 @@ static ngx_command_t ngx_http_dav_commands[] = {
static ngx_http_module_t ngx_http_dav_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_dav_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -88,7 +88,7 @@ ngx_module_t ngx_http_dav_module = {
ngx_http_dav_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_dav_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -245,6 +245,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
{
char *failed;
u_char *name;
+ time_t date;
ngx_err_t err;
ngx_str_t *temp, path;
ngx_uint_t status;
@@ -295,6 +296,24 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
#endif
+ if (r->headers_in.date) {
+ date = ngx_http_parse_time(r->headers_in.date->value.data,
+ r->headers_in.date->value.len);
+
+ if (date != NGX_ERROR) {
+ if (ngx_set_file_time(temp->data,
+ r->request_body->temp_file->file.fd, date)
+ != NGX_OK)
+ {
+ err = ngx_errno;
+ failed = ngx_set_file_time_n;
+ name = temp->data;
+
+ goto failed;
+ }
+ }
+ }
+
failed = ngx_rename_file_n;
name = path.data;
@@ -332,13 +351,10 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
err = ngx_errno;
}
-
-#else
+#endif
failed:
-#endif
-
if (ngx_delete_file(temp->data) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
ngx_delete_file_n " \"%s\" failed",
@@ -543,12 +559,12 @@ ngx_http_dav_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
static ngx_int_t
-ngx_http_dav_init(ngx_cycle_t *cycle)
+ngx_http_dav_init(ngx_conf_t *cf)
{
ngx_http_handler_pt *h;
ngx_http_core_main_conf_t *cmcf;
- cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
+ cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
if (h == NULL) {
diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c
index 26c164990..e3bf752e9 100644
--- a/src/http/modules/ngx_http_gzip_filter_module.c
+++ b/src/http/modules/ngx_http_gzip_filter_module.c
@@ -83,7 +83,7 @@ static ngx_int_t ngx_http_gzip_add_variables(ngx_conf_t *cf);
static ngx_int_t ngx_http_gzip_ratio_variable(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
-static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_gzip_filter_init(ngx_conf_t *cf);
static void *ngx_http_gzip_create_conf(ngx_conf_t *cf);
static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
void *parent, void *child);
@@ -201,7 +201,7 @@ static ngx_command_t ngx_http_gzip_filter_commands[] = {
static ngx_http_module_t ngx_http_gzip_filter_module_ctx = {
ngx_http_gzip_add_variables, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_gzip_filter_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -220,7 +220,7 @@ ngx_module_t ngx_http_gzip_filter_module = {
ngx_http_gzip_filter_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_gzip_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -1030,19 +1030,6 @@ ngx_http_gzip_ratio_variable(ngx_http_request_t *r,
}
-static ngx_int_t
-ngx_http_gzip_filter_init(ngx_cycle_t *cycle)
-{
- ngx_http_next_header_filter = ngx_http_top_header_filter;
- ngx_http_top_header_filter = ngx_http_gzip_header_filter;
-
- ngx_http_next_body_filter = ngx_http_top_body_filter;
- ngx_http_top_body_filter = ngx_http_gzip_body_filter;
-
- return NGX_OK;
-}
-
-
static void *
ngx_http_gzip_create_conf(ngx_conf_t *cf)
{
@@ -1123,6 +1110,19 @@ ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child)
}
+static ngx_int_t
+ngx_http_gzip_filter_init(ngx_conf_t *cf)
+{
+ ngx_http_next_header_filter = ngx_http_top_header_filter;
+ ngx_http_top_header_filter = ngx_http_gzip_header_filter;
+
+ ngx_http_next_body_filter = ngx_http_top_body_filter;
+ ngx_http_top_body_filter = ngx_http_gzip_body_filter;
+
+ return NGX_OK;
+}
+
+
static char *
ngx_http_gzip_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c
index 8065742a0..fcb31a78a 100644
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -28,10 +28,10 @@ typedef struct {
#define NGX_HTTP_EXPIRES_EPOCH -2147483645
-static ngx_int_t ngx_http_headers_filter_init(ngx_cycle_t *cycle);
static void *ngx_http_headers_create_conf(ngx_conf_t *cf);
static char *ngx_http_headers_merge_conf(ngx_conf_t *cf,
void *parent, void *child);
+static ngx_int_t ngx_http_headers_filter_init(ngx_conf_t *cf);
static char *ngx_http_headers_expires(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static char *ngx_http_headers_add(ngx_conf_t *cf, ngx_command_t *cmd,
@@ -62,7 +62,7 @@ static ngx_command_t ngx_http_headers_filter_commands[] = {
static ngx_http_module_t ngx_http_headers_filter_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_headers_filter_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -81,7 +81,7 @@ ngx_module_t ngx_http_headers_filter_module = {
ngx_http_headers_filter_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_headers_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -274,16 +274,6 @@ ngx_http_headers_filter(ngx_http_request_t *r)
}
-static ngx_int_t
-ngx_http_headers_filter_init(ngx_cycle_t *cycle)
-{
- ngx_http_next_header_filter = ngx_http_top_header_filter;
- ngx_http_top_header_filter = ngx_http_headers_filter;
-
- return NGX_OK;
-}
-
-
static void *
ngx_http_headers_create_conf(ngx_conf_t *cf)
{
@@ -331,6 +321,16 @@ ngx_http_headers_merge_conf(ngx_conf_t *cf, void *parent, void *child)
}
+static ngx_int_t
+ngx_http_headers_filter_init(ngx_conf_t *cf)
+{
+ ngx_http_next_header_filter = ngx_http_top_header_filter;
+ ngx_http_top_header_filter = ngx_http_headers_filter;
+
+ return NGX_OK;
+}
+
+
static char *
ngx_http_headers_expires(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
diff --git a/src/http/modules/ngx_http_index_module.c b/src/http/modules/ngx_http_index_module.c
index b93e6fb09..cd1c51ee5 100644
--- a/src/http/modules/ngx_http_index_module.c
+++ b/src/http/modules/ngx_http_index_module.c
@@ -40,7 +40,7 @@ static ngx_int_t ngx_http_index_test_dir(ngx_http_request_t *r,
static ngx_int_t ngx_http_index_error(ngx_http_request_t *r,
ngx_http_index_ctx_t *ctx, ngx_err_t err);
-static ngx_int_t ngx_http_index_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_index_init(ngx_conf_t *cf);
static void *ngx_http_index_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_index_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
@@ -74,7 +74,7 @@ static ngx_command_t ngx_http_index_commands[] = {
static ngx_http_module_t ngx_http_index_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_index_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -93,7 +93,7 @@ ngx_module_t ngx_http_index_module = {
ngx_http_index_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_index_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -198,7 +198,7 @@ ngx_http_index_handler(ngx_http_request_t *r)
len += 16;
}
- if (len > ctx->path.len) {
+ if (len > (size_t) (ctx->path.data + ctx->path.len - ctx->index.data)) {
last = ngx_http_map_uri_to_path(r, &ctx->path, len);
if (last == NULL) {
@@ -378,7 +378,7 @@ ngx_http_index_create_loc_conf(ngx_conf_t *cf)
}
conf->indices = NULL;
- conf->max_index_len = 1;
+ conf->max_index_len = 0;
return conf;
}
@@ -422,6 +422,25 @@ ngx_http_index_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
}
+static ngx_int_t
+ngx_http_index_init(ngx_conf_t *cf)
+{
+ ngx_http_handler_pt *h;
+ ngx_http_core_main_conf_t *cmcf;
+
+ cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
+
+ h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
+ if (h == NULL) {
+ return NGX_ERROR;
+ }
+
+ *h = ngx_http_index_handler;
+
+ return NGX_OK;
+}
+
+
/* TODO: warn about duplicate indices */
static char *
@@ -429,8 +448,8 @@ ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_index_loc_conf_t *ilcf = conf;
- ngx_uint_t i, n;
ngx_str_t *value;
+ ngx_uint_t i, n;
ngx_http_index_t *index;
ngx_http_script_compile_t sc;
@@ -471,9 +490,7 @@ ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
n = ngx_http_script_variables_count(&value[i]);
if (n == 0) {
- if (ilcf->max_index_len != 0
- && ilcf->max_index_len < index->name.len)
- {
+ if (ilcf->max_index_len < index->name.len) {
ilcf->max_index_len = index->name.len;
}
@@ -496,28 +513,7 @@ ngx_http_index_set_index(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
if (ngx_http_script_compile(&sc) != NGX_OK) {
return NGX_CONF_ERROR;
}
-
- ilcf->max_index_len = 0;
}
return NGX_CONF_OK;
}
-
-
-static ngx_int_t
-ngx_http_index_init(ngx_cycle_t *cycle)
-{
- ngx_http_handler_pt *h;
- ngx_http_core_main_conf_t *cmcf;
-
- cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
-
- h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
- if (h == NULL) {
- return NGX_ERROR;
- }
-
- *h = ngx_http_index_handler;
-
- return NGX_OK;
-}
diff --git a/src/http/modules/ngx_http_not_modified_filter_module.c b/src/http/modules/ngx_http_not_modified_filter_module.c
index 6dd8a3204..dc626362d 100644
--- a/src/http/modules/ngx_http_not_modified_filter_module.c
+++ b/src/http/modules/ngx_http_not_modified_filter_module.c
@@ -10,12 +10,12 @@
-static ngx_int_t ngx_http_not_modified_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_not_modified_filter_init(ngx_conf_t *cf);
static ngx_http_module_t ngx_http_not_modified_filter_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_not_modified_filter_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -34,7 +34,7 @@ ngx_module_t ngx_http_not_modified_filter_module = {
NULL, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_not_modified_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -47,7 +47,8 @@ ngx_module_t ngx_http_not_modified_filter_module = {
static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
-static ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
+static
+ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
{
time_t ims;
@@ -80,7 +81,8 @@ static ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r)
}
-static ngx_int_t ngx_http_not_modified_filter_init(ngx_cycle_t *cycle)
+static
+ngx_int_t ngx_http_not_modified_filter_init(ngx_conf_t *cf)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_not_modified_header_filter;
diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c
index 7beb091ca..ab346f9ba 100644
--- a/src/http/modules/ngx_http_range_filter_module.c
+++ b/src/http/modules/ngx_http_range_filter_module.c
@@ -49,13 +49,13 @@ typedef struct {
} ngx_http_range_filter_ctx_t;
-static ngx_int_t ngx_http_range_header_filter_init(ngx_cycle_t *cycle);
-static ngx_int_t ngx_http_range_body_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_range_header_filter_init(ngx_conf_t *cf);
+static ngx_int_t ngx_http_range_body_filter_init(ngx_conf_t *cf);
static ngx_http_module_t ngx_http_range_header_filter_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_range_header_filter_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -74,7 +74,7 @@ ngx_module_t ngx_http_range_header_filter_module = {
NULL, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_range_header_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -86,7 +86,7 @@ ngx_module_t ngx_http_range_header_filter_module = {
static ngx_http_module_t ngx_http_range_body_filter_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_range_body_filter_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -105,7 +105,7 @@ ngx_module_t ngx_http_range_body_filter_module = {
NULL, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_range_body_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -588,7 +588,7 @@ ngx_http_range_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
static ngx_int_t
-ngx_http_range_header_filter_init(ngx_cycle_t *cycle)
+ngx_http_range_header_filter_init(ngx_conf_t *cf)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_range_header_filter;
@@ -598,7 +598,7 @@ ngx_http_range_header_filter_init(ngx_cycle_t *cycle)
static ngx_int_t
-ngx_http_range_body_filter_init(ngx_cycle_t *cycle)
+ngx_http_range_body_filter_init(ngx_conf_t *cf)
{
ngx_http_next_body_filter = ngx_http_top_body_filter;
ngx_http_top_body_filter = ngx_http_range_body_filter;
diff --git a/src/http/modules/ngx_http_realip_module.c b/src/http/modules/ngx_http_realip_module.c
index 8f128d277..df5859880 100644
--- a/src/http/modules/ngx_http_realip_module.c
+++ b/src/http/modules/ngx_http_realip_module.c
@@ -30,7 +30,7 @@ static char *ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd,
static void *ngx_http_realip_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_realip_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
-static ngx_int_t ngx_http_realip_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_realip_init(ngx_conf_t *cf);
static ngx_conf_enum_t ngx_http_realip_header[] = {
@@ -63,7 +63,7 @@ static ngx_command_t ngx_http_realip_commands[] = {
static ngx_http_module_t ngx_http_realip_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_realip_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -82,7 +82,7 @@ ngx_module_t ngx_http_realip_module = {
ngx_http_realip_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_realip_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -250,12 +250,12 @@ ngx_http_realip_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
static ngx_int_t
-ngx_http_realip_init(ngx_cycle_t *cycle)
+ngx_http_realip_init(ngx_conf_t *cf)
{
ngx_http_handler_pt *h;
ngx_http_core_main_conf_t *cmcf;
- cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
+ cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
h = ngx_array_push(&cmcf->phases[NGX_HTTP_POST_READ_PHASE].handlers);
if (h == NULL) {
diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c
index 30fbcd87e..6db1bc06f 100644
--- a/src/http/modules/ngx_http_rewrite_module.c
+++ b/src/http/modules/ngx_http_rewrite_module.c
@@ -23,7 +23,7 @@ typedef struct {
static void *ngx_http_rewrite_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
-static ngx_int_t ngx_http_rewrite_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_rewrite_init(ngx_conf_t *cf);
static char *ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
static char *ngx_http_rewrite_return(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
@@ -104,7 +104,7 @@ static ngx_command_t ngx_http_rewrite_commands[] = {
static ngx_http_module_t ngx_http_rewrite_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_rewrite_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -123,7 +123,7 @@ ngx_module_t ngx_http_rewrite_module = {
ngx_http_rewrite_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_rewrite_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -267,12 +267,12 @@ ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
static ngx_int_t
-ngx_http_rewrite_init(ngx_cycle_t *cycle)
+ngx_http_rewrite_init(ngx_conf_t *cf)
{
ngx_http_handler_pt *h;
ngx_http_core_main_conf_t *cmcf;
- cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
+ cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
h = ngx_array_push(&cmcf->phases[NGX_HTTP_SERVER_REWRITE_PHASE].handlers);
if (h == NULL) {
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
index ef870beb5..5045fd696 100644
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -106,13 +106,14 @@ static char *ngx_http_ssi_init_main_conf(ngx_conf_t *cf, void *conf);
static void *ngx_http_ssi_create_conf(ngx_conf_t *cf);
static char *ngx_http_ssi_merge_conf(ngx_conf_t *cf,
void *parent, void *child);
-static ngx_int_t ngx_http_ssi_filter_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_ssi_filter_init(ngx_conf_t *cf);
static ngx_command_t ngx_http_ssi_filter_commands[] = {
{ ngx_string("ssi"),
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
+ |NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_ssi_loc_conf_t, enable),
@@ -160,7 +161,7 @@ static ngx_command_t ngx_http_ssi_filter_commands[] = {
static ngx_http_module_t ngx_http_ssi_filter_module_ctx = {
ngx_http_ssi_preconfiguration, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_ssi_filter_init, /* postconfiguration */
ngx_http_ssi_create_main_conf, /* create main configuration */
ngx_http_ssi_init_main_conf, /* init main configuration */
@@ -179,7 +180,7 @@ ngx_module_t ngx_http_ssi_filter_module = {
ngx_http_ssi_filter_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_ssi_filter_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -2654,7 +2655,7 @@ ngx_http_ssi_merge_conf(ngx_conf_t *cf, void *parent, void *child)
static ngx_int_t
-ngx_http_ssi_filter_init(ngx_cycle_t *cycle)
+ngx_http_ssi_filter_init(ngx_conf_t *cf)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_ssi_header_filter;
diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c
index ad0885217..f9df46eeb 100644
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -18,7 +18,7 @@ static ngx_int_t ngx_http_static_handler(ngx_http_request_t *r);
static void *ngx_http_static_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_static_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
-static ngx_int_t ngx_http_static_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_static_init(ngx_conf_t *cf);
static ngx_command_t ngx_http_static_commands[] = {
@@ -40,7 +40,7 @@ static ngx_command_t ngx_http_static_commands[] = {
ngx_http_module_t ngx_http_static_module_ctx = {
NULL, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_static_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -59,7 +59,7 @@ ngx_module_t ngx_http_static_module = {
ngx_http_static_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_static_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -317,12 +317,12 @@ ngx_http_static_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
static ngx_int_t
-ngx_http_static_init(ngx_cycle_t *cycle)
+ngx_http_static_init(ngx_conf_t *cf)
{
ngx_http_handler_pt *h;
ngx_http_core_main_conf_t *cmcf;
- cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
+ cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
if (h == NULL) {
diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c
index 648f1ade7..c341a0873 100644
--- a/src/http/modules/ngx_http_userid_filter_module.c
+++ b/src/http/modules/ngx_http_userid_filter_module.c
@@ -59,7 +59,7 @@ static ngx_int_t ngx_http_userid_add_variables(ngx_conf_t *cf);
static ngx_int_t ngx_http_userid_variable(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
-static ngx_int_t ngx_http_userid_init(ngx_cycle_t *cycle);
+static ngx_int_t ngx_http_userid_init(ngx_conf_t *cf);
static void *ngx_http_userid_create_conf(ngx_conf_t *cf);
static char *ngx_http_userid_merge_conf(ngx_conf_t *cf, void *parent,
void *child);
@@ -162,7 +162,7 @@ static ngx_command_t ngx_http_userid_commands[] = {
static ngx_http_module_t ngx_http_userid_filter_module_ctx = {
ngx_http_userid_add_variables, /* preconfiguration */
- NULL, /* postconfiguration */
+ ngx_http_userid_init, /* postconfiguration */
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -181,7 +181,7 @@ ngx_module_t ngx_http_userid_filter_module = {
ngx_http_userid_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- ngx_http_userid_init, /* init module */
+ NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -622,16 +622,6 @@ ngx_http_userid_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
}
-static ngx_int_t
-ngx_http_userid_init(ngx_cycle_t *cycle)
-{
- ngx_http_next_header_filter = ngx_http_top_header_filter;
- ngx_http_top_header_filter = ngx_http_userid_filter;
-
- return NGX_OK;
-}
-
-
static void *
ngx_http_userid_create_conf(ngx_conf_t *cf)
{
@@ -693,6 +683,16 @@ ngx_http_userid_merge_conf(ngx_conf_t *cf, void *parent, void *child)
}
+static ngx_int_t
+ngx_http_userid_init(ngx_conf_t *cf)
+{
+ ngx_http_next_header_filter = ngx_http_top_header_filter;
+ ngx_http_top_header_filter = ngx_http_userid_filter;
+
+ return NGX_OK;
+}
+
+
static char *
ngx_http_userid_domain(ngx_conf_t *cf, void *post, void *data)
{
diff --git a/src/http/modules/perl/Makefile.PL b/src/http/modules/perl/Makefile.PL
index 48f1ebcd2..c33b1fc72 100644
--- a/src/http/modules/perl/Makefile.PL
+++ b/src/http/modules/perl/Makefile.PL
@@ -12,7 +12,7 @@ WriteMakefile(
ABSTRACT_FROM => 'nginx.pm', # retrieve abstract from module
AUTHOR => 'Igor Sysoev',
- CCFLAGS => "$ENV{NGX_PERL_CFLAGS}",
+ CCFLAGS => "$ENV{NGX_PM_CFLAGS}",
OPTIMIZE => '-O',
INC => "-I ../../../../../src/core " .
@@ -22,8 +22,9 @@ WriteMakefile(
"-I ../../../../../src/http/modules " .
"-I ../../../../../src/http/modules/perl " .
"-I ../../../../../$ENV{NGX_OBJS} " .
- "-I ../../../../../$ENV{NGX_PCRE} " .
- "-I ../../../../../$ENV{NGX_ZLIB} ",
+ ($ENV{NGX_PCRE} =~ /^(YES|NO)/ ? "" :
+ ($ENV{NGX_PCRE} =~ m#^/# ? "-I $ENV{NGX_PCRE} " :
+ "-I ../../../../../$ENV{NGX_PCRE} ")),
depend => {
'nginx.c' =>
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index badd494b4..309eaa545 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -17,7 +17,7 @@ our @EXPORT = qw(
HTTP_SERVER_ERROR
);
-our $VERSION = '0.3.43';
+our $VERSION = '0.4.0';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
index 53b6a9230..6e6afed15 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -329,6 +329,42 @@ header_in(r, key)
void
+has_request_body(r, next)
+ CODE:
+
+ dXSTARG;
+ ngx_http_request_t *r;
+ SV *next;
+ ngx_http_perl_ctx_t *ctx;
+
+ ngx_http_perl_set_request(r);
+
+ if (r->headers_in.content_length_n <= 0) {
+ XSRETURN_UNDEF;
+ }
+
+ next = ST(1);
+
+ ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
+ ctx->next = next;
+
+ r->request_body_in_single_buf = 1;
+ r->request_body_in_persistent_file = 1;
+ r->request_body_delete_incomplete_file = 1;
+
+ if (r->request_body_in_file_only) {
+ r->request_body_file_log_level = 0;
+ }
+
+ ngx_http_read_client_request_body(r, ngx_http_perl_handle_request);
+
+ sv_upgrade(TARG, SVt_IV);
+ sv_setiv(TARG, 1);
+
+ ST(0) = TARG;
+
+
+void
request_body(r)
CODE:
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c
index 6f979c661..e59ece4bb 100644
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -45,7 +45,6 @@ static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r,
ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params);
#endif
-static void ngx_http_perl_handle_request(ngx_http_request_t *r);
static ngx_int_t
ngx_http_perl_get_interpreter(ngx_http_perl_main_conf_t *pmcf,
PerlInterpreter **perl, ngx_log_t *log);
@@ -176,6 +175,9 @@ static ngx_http_ssi_command_t ngx_http_perl_ssi_command = {
#endif
+static ngx_str_t ngx_null_name = ngx_null_string;
+
+
static HV *nginx_stash;
static void
@@ -190,13 +192,16 @@ ngx_http_perl_xs_init(pTHX)
static ngx_int_t
ngx_http_perl_handler(ngx_http_request_t *r)
{
- ngx_int_t rc;
-
/* TODO: Win32 */
if (r->zero_in_uri) {
return NGX_HTTP_NOT_FOUND;
}
+ ngx_http_perl_handle_request(r);
+
+ return NGX_DONE;
+
+#if 0
r->request_body_in_single_buf = 1;
r->request_body_in_persistent_file = 1;
r->request_body_delete_incomplete_file = 1;
@@ -212,14 +217,16 @@ ngx_http_perl_handler(ngx_http_request_t *r)
}
return NGX_DONE;
+#endif
}
-static void
+void
ngx_http_perl_handle_request(ngx_http_request_t *r)
{
+ SV *sub;
ngx_int_t rc;
- ngx_str_t uri, args;
+ ngx_str_t uri, args, *handler;
ngx_http_perl_ctx_t *ctx;
ngx_http_perl_loc_conf_t *plcf;
ngx_http_perl_main_conf_t *pmcf;
@@ -231,7 +238,7 @@ ngx_http_perl_handle_request(ngx_http_request_t *r)
if (ctx == NULL) {
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_perl_ctx_t));
if (ctx == NULL) {
- ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ ngx_http_finalize_request(r, NGX_ERROR);
return;
}
@@ -251,10 +258,18 @@ ngx_http_perl_handle_request(ngx_http_request_t *r)
dTHXa(ctx->perl);
- plcf = ngx_http_get_module_loc_conf(r, ngx_http_perl_module);
+ if (ctx->next == NULL) {
+ plcf = ngx_http_get_module_loc_conf(r, ngx_http_perl_module);
+ sub = plcf->sub;
+ handler = &plcf->handler;
+
+ } else {
+ sub = ctx->next;
+ handler = &ngx_null_name;
+ ctx->next = NULL;
+ }
- rc = ngx_http_perl_call_handler(aTHX_ r, plcf->sub, NULL,
- &plcf->handler, NULL);
+ rc = ngx_http_perl_call_handler(aTHX_ r, sub, NULL, handler, NULL);
}
@@ -278,6 +293,10 @@ ngx_http_perl_handle_request(ngx_http_request_t *r)
ctx->filename.data = NULL;
ctx->redirect_uri.len = 0;
+ if (ctx->done || ctx->next) {
+ return;
+ }
+
if (uri.len) {
ngx_http_internal_redirect(r, &uri, &args);
return;
@@ -285,6 +304,7 @@ ngx_http_perl_handle_request(ngx_http_request_t *r)
if (rc == NGX_OK || rc == NGX_HTTP_OK) {
ngx_http_send_special(r, NGX_HTTP_LAST);
+ ctx->done = 1;
}
ngx_http_finalize_request(r, rc);
@@ -666,14 +686,6 @@ ngx_http_perl_run_requires(pTHX_ ngx_array_t *requires, ngx_log_t *log)
}
-#if (__INTEL_COMPILER)
-/*
- * disable 'declaration hides parameter "my_perl"' warning for ENTER and LEAVE
- */
-#pragma warning(disable:1599)
-#endif
-
-
static ngx_int_t
ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, SV *sub,
ngx_str_t **args, ngx_str_t *handler, ngx_str_t *rv)
@@ -773,11 +785,6 @@ ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, SV *sub,
}
-#if (__INTEL_COMPILER)
-#pragma warning(default:1599)
-#endif
-
-
static void
ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv)
{
diff --git a/src/http/modules/perl/ngx_http_perl_module.h b/src/http/modules/perl/ngx_http_perl_module.h
index 1609c478b..66d15da1c 100644
--- a/src/http/modules/perl/ngx_http_perl_module.h
+++ b/src/http/modules/perl/ngx_http_perl_module.h
@@ -24,6 +24,9 @@ typedef struct {
ngx_str_t filename;
ngx_str_t redirect_uri;
ngx_str_t redirect_args;
+ SV *next;
+
+ ngx_uint_t done; /* unsigned done:1; */
#if (NGX_HTTP_SSI)
ngx_http_ssi_ctx_t *ssi;
@@ -47,4 +50,7 @@ extern ngx_module_t ngx_http_perl_module;
extern void boot_DynaLoader(pTHX_ CV* cv);
+void ngx_http_perl_handle_request(ngx_http_request_t *r);
+
+
#endif /* _NGX_HTTP_PERL_MODULE_H_INCLUDED_ */