annotate src/http/modules/perl/ngx_http_perl_module.c @ 166:fef68f68bcfd NGINX_0_3_30

nginx 0.3.30 *) Change: the ECONNABORTED error log level was changed to "error" from "crit". *) Bugfix: the ngx_http_perl_module could not be build without the ngx_http_ssi_filter_module. *) Bugfix: nginx could not be built on i386 platform, if the PIC was used; bug appeared in 0.3.27.
author Igor Sysoev <http://sysoev.ru>
date Wed, 22 Feb 2006 00:00:00 +0300
parents ea622d8acb38
children 3314be145cb9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
1
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
2 /*
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
3 * Copyright (C) Igor Sysoev
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
4 */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
5
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
6
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
7 #include <ngx_config.h>
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
8 #include <ngx_core.h>
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
9 #include <ngx_http.h>
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
10 #include <ngx_http_perl_module.h>
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
11
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
12
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
13 typedef struct {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
14 PerlInterpreter **free_perls;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
15 ngx_uint_t interp;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
16 ngx_uint_t nalloc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
17 ngx_uint_t interp_max;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
18
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
19 PerlInterpreter *perl;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
20 ngx_str_t modules;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
21 ngx_array_t requires;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
22 } ngx_http_perl_main_conf_t;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
23
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
24
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
25 typedef struct {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
26 SV *sub;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
27 ngx_str_t handler;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
28 } ngx_http_perl_loc_conf_t;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
29
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
30
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
31 typedef struct {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
32 SV *sub;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
33 ngx_str_t handler;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
34 } ngx_http_perl_variable_t;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
35
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
36
166
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
37 #if (NGX_HTTP_SSI)
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
38 static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
39 ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params);
166
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
40 #endif
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
41
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
42 static ngx_int_t
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
43 ngx_http_perl_get_interpreter(ngx_http_perl_main_conf_t *pmcf,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
44 PerlInterpreter **perl, ngx_log_t *log);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
45 static ngx_inline void
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
46 ngx_http_perl_free_interpreter(ngx_http_perl_main_conf_t *pmcf,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
47 PerlInterpreter *perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
48 static char *ngx_http_perl_init_interpreter(ngx_conf_t *cf,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
49 ngx_http_perl_main_conf_t *pmcf);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
50 static PerlInterpreter *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
51 ngx_http_perl_create_interpreter(ngx_http_perl_main_conf_t *pmcf,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
52 ngx_log_t *log);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
53 static ngx_int_t ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
54 SV *sub, ngx_str_t **args, ngx_str_t *handler, ngx_str_t *rv);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
55 static void ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
56
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
57 static ngx_int_t ngx_http_perl_preconfiguration(ngx_conf_t *cf);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
58 static void *ngx_http_perl_create_main_conf(ngx_conf_t *cf);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
59 static char *ngx_http_perl_init_main_conf(ngx_conf_t *cf, void *conf);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
60 static void *ngx_http_perl_create_loc_conf(ngx_conf_t *cf);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
61 static char *ngx_http_perl_merge_loc_conf(ngx_conf_t *cf, void *parent,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
62 void *child);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
63 static char *ngx_http_perl_require(ngx_conf_t *cf, ngx_command_t *cmd,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
64 void *conf);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
65 static char *ngx_http_perl(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
66 static char *ngx_http_perl_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
67 static char *ngx_http_perl_interp_max_unsupported(ngx_conf_t *cf, void *post,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
68 void *data);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
69 static void ngx_http_perl_cleanup_perl(void *data);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
70
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
71
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
72 static ngx_conf_post_handler_pt ngx_http_perl_interp_max_p =
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
73 ngx_http_perl_interp_max_unsupported;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
74
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
75
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
76 static ngx_command_t ngx_http_perl_commands[] = {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
77
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
78 { ngx_string("perl_modules"),
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
79 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
80 ngx_conf_set_str_slot,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
81 NGX_HTTP_MAIN_CONF_OFFSET,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
82 offsetof(ngx_http_perl_main_conf_t, modules),
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
83 NULL },
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
84
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
85 { ngx_string("perl_require"),
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
86 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
87 ngx_http_perl_require,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
88 NGX_HTTP_MAIN_CONF_OFFSET,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
89 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
90 NULL },
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
91
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
92 { ngx_string("perl_interp_max"),
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
93 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
94 ngx_conf_set_num_slot,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
95 NGX_HTTP_MAIN_CONF_OFFSET,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
96 offsetof(ngx_http_perl_main_conf_t, interp_max),
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
97 &ngx_http_perl_interp_max_p },
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
98
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
99 { ngx_string("perl"),
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
100 NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
101 ngx_http_perl,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
102 NGX_HTTP_LOC_CONF_OFFSET,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
103 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
104 NULL },
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
105
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
106 { ngx_string("perl_set"),
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
107 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE2,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
108 ngx_http_perl_set,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
109 NGX_HTTP_LOC_CONF_OFFSET,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
110 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
111 NULL },
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
112
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
113 ngx_null_command
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
114 };
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
115
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
116
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
117 static ngx_http_module_t ngx_http_perl_module_ctx = {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
118 ngx_http_perl_preconfiguration, /* preconfiguration */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
119 NULL, /* postconfiguration */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
120
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
121 ngx_http_perl_create_main_conf, /* create main configuration */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
122 ngx_http_perl_init_main_conf, /* init main configuration */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
123
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
124 NULL, /* create server configuration */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
125 NULL, /* merge server configuration */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
126
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
127 ngx_http_perl_create_loc_conf, /* create location configuration */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
128 ngx_http_perl_merge_loc_conf /* merge location configuration */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
129 };
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
130
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
131
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
132 ngx_module_t ngx_http_perl_module = {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
133 NGX_MODULE_V1,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
134 &ngx_http_perl_module_ctx, /* module context */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
135 ngx_http_perl_commands, /* module directives */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
136 NGX_HTTP_MODULE, /* module type */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
137 NULL, /* init master */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
138 NULL, /* init module */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
139 NULL, /* init process */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
140 NULL, /* init thread */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
141 NULL, /* exit thread */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
142 NULL, /* exit process */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
143 NULL, /* exit master */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
144 NGX_MODULE_V1_PADDING
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
145 };
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
146
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
147
166
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
148 #if (NGX_HTTP_SSI)
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
149
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
150 #define NGX_HTTP_PERL_SSI_SUB 0
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
151 #define NGX_HTTP_PERL_SSI_ARG 1
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
152
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
153
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
154 static ngx_http_ssi_param_t ngx_http_perl_ssi_params[] = {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
155 { ngx_string("sub"), NGX_HTTP_PERL_SSI_SUB, 1, 0 },
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
156 { ngx_string("arg"), NGX_HTTP_PERL_SSI_ARG, 0, 1 },
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
157 { ngx_null_string, 0, 0, 0 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
158 };
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
159
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
160 static ngx_http_ssi_command_t ngx_http_perl_ssi_command = {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
161 ngx_string("perl"), ngx_http_perl_ssi, ngx_http_perl_ssi_params, 0, 1
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
162 };
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
163
166
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
164 #endif
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
165
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
166
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
167 static void
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
168 ngx_http_perl_xs_init(pTHX)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
169 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
170 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
171 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
172
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
173
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
174 static ngx_int_t
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
175 ngx_http_perl_handler(ngx_http_request_t *r)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
176 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
177 ngx_int_t rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
178 ngx_str_t uri, args;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
179 ngx_http_perl_ctx_t *ctx;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
180 ngx_http_perl_loc_conf_t *plcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
181 ngx_http_perl_main_conf_t *pmcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
182
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
183 /* TODO: Win32 */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
184 if (r->zero_in_uri) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
185 return NGX_HTTP_NOT_FOUND;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
186 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
187
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
188 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "perl handler");
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
189
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
190 /* mod_perl's content handler assumes that content type was already set */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
191
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
192 if (ngx_http_set_content_type(r) != NGX_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
193 return NGX_HTTP_INTERNAL_SERVER_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
194 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
195
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
196 ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
197
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
198 if (ctx == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
199 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_perl_ctx_t));
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
200 if (ctx == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
201 return NGX_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
202 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
203
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
204 ngx_http_set_ctx(r, ctx, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
205 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
206
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
207 pmcf = ngx_http_get_module_main_conf(r, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
208
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
209 rc = ngx_http_perl_get_interpreter(pmcf, &ctx->perl, r->connection->log);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
210
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
211 if (rc != NGX_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
212 return rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
213 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
214
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
215 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
216
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
217 dTHXa(ctx->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
218
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
219 plcf = ngx_http_get_module_loc_conf(r, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
220
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
221 rc = ngx_http_perl_call_handler(aTHX_ r, plcf->sub, NULL,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
222 &plcf->handler, NULL);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
223
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
224 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
225
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
226 ngx_http_perl_free_interpreter(pmcf, ctx->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
227
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
228 if (rc > 600) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
229 rc = NGX_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
230 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
231
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
232 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
233 "perl handler done: %i", rc);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
234
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
235 if (ctx->redirect_uri.len) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
236 uri = ctx->redirect_uri;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
237 args = ctx->redirect_args;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
238 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
239
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
240 ctx->filename = NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
241 ctx->redirect_uri.len = 0;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
242
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
243 if (uri.len) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
244 return ngx_http_internal_redirect(r, &uri, &args);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
245 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
246
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
247 if (rc == NGX_OK || rc == NGX_HTTP_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
248 return ngx_http_send_special(r, NGX_HTTP_LAST);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
249 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
250
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
251 return rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
252 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
253
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
254
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
255 static ngx_int_t
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
256 ngx_http_perl_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
257 uintptr_t data)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
258 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
259 ngx_http_perl_variable_t *pv = (ngx_http_perl_variable_t *) data;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
260
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
261 ngx_int_t rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
262 ngx_str_t value;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
263 ngx_http_perl_ctx_t *ctx;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
264 ngx_http_perl_main_conf_t *pmcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
265
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
266 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
267 "perl variable handler");
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
268
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
269 ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
270
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
271 if (ctx == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
272 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_perl_ctx_t));
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
273 if (ctx == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
274 return NGX_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
275 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
276
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
277 ngx_http_set_ctx(r, ctx, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
278 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
279
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
280 pmcf = ngx_http_get_module_main_conf(r, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
281
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
282 rc = ngx_http_perl_get_interpreter(pmcf, &ctx->perl, r->connection->log);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
283
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
284 if (rc != NGX_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
285 return rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
286 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
287
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
288 value.data = NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
289
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
290 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
291
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
292 dTHXa(ctx->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
293
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
294 rc = ngx_http_perl_call_handler(aTHX_ r, pv->sub, NULL,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
295 &pv->handler, &value);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
296
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
297 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
298
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
299 ngx_http_perl_free_interpreter(pmcf, ctx->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
300
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
301 if (value.data) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
302 v->len = value.len;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
303 v->valid = 1;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
304 v->no_cachable = 0;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
305 v->not_found = 0;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
306 v->data = value.data;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
307
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
308 } else {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
309 v->not_found = 1;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
310 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
311
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
312 ctx->filename = NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
313 ctx->redirect_uri.len = 0;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
314
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
315 return rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
316 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
317
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
318
166
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
319 #if (NGX_HTTP_SSI)
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
320
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
321 static ngx_int_t
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
322 ngx_http_perl_ssi(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ssi_ctx,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
323 ngx_str_t **params)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
324 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
325 SV *sv;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
326 ngx_int_t rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
327 ngx_str_t *handler;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
328 ngx_http_perl_ctx_t *ctx;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
329 ngx_http_perl_main_conf_t *pmcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
330
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
331 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
332 "perl ssi handler");
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
333
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
334 pmcf = ngx_http_get_module_main_conf(r, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
335
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
336 ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
337
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
338 if (ctx == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
339 ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_perl_ctx_t));
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
340 if (ctx == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
341 return NGX_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
342 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
343
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
344 ngx_http_set_ctx(r, ctx, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
345 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
346
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
347 rc = ngx_http_perl_get_interpreter(pmcf, &ctx->perl, r->connection->log);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
348
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
349 if (rc != NGX_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
350 return rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
351 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
352
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
353 ctx->ssi = ssi_ctx;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
354
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
355 handler = params[NGX_HTTP_PERL_SSI_SUB];
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
356 handler->data[handler->len] = '\0';
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
357
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
358 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
359
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
360 dTHXa(ctx->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
361
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
362 #if 0
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
363
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
364 ngx_http_perl_eval_anon_sub(aTHX_ handler, &sv);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
365
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
366 if (sv == &PL_sv_undef) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
367 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
368 "eval_pv(\"%V\") failed", handler);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
369 return NGX_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
370 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
371
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
372 if (sv == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
373 sv = newSVpvn((char *) handler->data, handler->len);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
374 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
375
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
376 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
377
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
378 sv = newSVpvn((char *) handler->data, handler->len);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
379
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
380 rc = ngx_http_perl_call_handler(aTHX_ r, sv, &params[NGX_HTTP_PERL_SSI_ARG],
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
381 handler, NULL);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
382
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
383 SvREFCNT_dec(sv);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
384
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
385 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
386
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
387 ngx_http_perl_free_interpreter(pmcf, ctx->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
388
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
389 ctx->filename = NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
390 ctx->redirect_uri.len = 0;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
391 ctx->ssi = NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
392
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
393 return rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
394 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
395
166
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
396 #endif
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
397
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
398
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
399 static ngx_int_t
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
400 ngx_http_perl_get_interpreter(ngx_http_perl_main_conf_t *pmcf,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
401 PerlInterpreter **perl, ngx_log_t *log)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
402 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
403 if (pmcf->interp) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
404 pmcf->interp--;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
405
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
406 *perl = pmcf->free_perls[pmcf->interp];
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
407
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
408 return NGX_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
409 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
410
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
411 if (pmcf->nalloc < pmcf->interp_max) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
412 *perl = ngx_http_perl_create_interpreter(pmcf, log);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
413
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
414 if (*perl) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
415 return NGX_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
416 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
417
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
418 return NGX_HTTP_INTERNAL_SERVER_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
419 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
420
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
421 ngx_log_error(NGX_LOG_ALERT, log, 0, "no free perl interpreter");
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
422
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
423 return NGX_HTTP_SERVICE_UNAVAILABLE;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
424 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
425
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
426
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
427 static ngx_inline void
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
428 ngx_http_perl_free_interpreter(ngx_http_perl_main_conf_t *pmcf,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
429 PerlInterpreter *perl)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
430 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
431 pmcf->free_perls[pmcf->interp++] = perl;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
432 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
433
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
434
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
435 static char *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
436 ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
437 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
438 ngx_pool_cleanup_t *cln;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
439
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
440 cln = ngx_pool_cleanup_add(cf->pool, 0);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
441 if (cln == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
442 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
443 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
444
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
445 #ifdef NGX_PERL_MODULES
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
446 if (pmcf->modules.data == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
447 pmcf->modules.data = NGX_PERL_MODULES;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
448 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
449 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
450
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
451 PERL_SYS_INIT(&ngx_argc, &ngx_argv);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
452
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
453 pmcf->perl = ngx_http_perl_create_interpreter(pmcf, cf->log);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
454
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
455 if (pmcf->perl == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
456 PERL_SYS_TERM();
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
457 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
458 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
459
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
460 cln->handler = ngx_http_perl_cleanup_perl;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
461 cln->data = pmcf->perl;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
462
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
463 return NGX_CONF_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
464 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
465
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
466
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
467 static PerlInterpreter *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
468 ngx_http_perl_create_interpreter(ngx_http_perl_main_conf_t *pmcf,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
469 ngx_log_t *log)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
470 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
471 int n;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
472 char *embedding[6];
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
473 char **script;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
474 STRLEN len;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
475 ngx_str_t err;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
476 ngx_uint_t i;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
477 PerlInterpreter *perl;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
478
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
479 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "create perl interpreter");
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
480
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
481 #if (NGX_HAVE_PERL_CLONE)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
482
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
483 if (pmcf->perl) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
484
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
485 perl = perl_clone(pmcf->perl, CLONEf_KEEP_PTR_TABLE);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
486 if (perl == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
487 ngx_log_error(NGX_LOG_ALERT, log, 0, "perl_clone() failed");
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
488 return NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
489 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
490
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
491 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
492
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
493 dTHXa(perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
494
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
495 ptr_table_free(PL_ptr_table);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
496 PL_ptr_table = NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
497
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
498 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
499
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
500 pmcf->nalloc++;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
501
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
502 return perl;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
503 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
504
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
505 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
506
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
507 perl = perl_alloc();
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
508 if (perl == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
509 ngx_log_error(NGX_LOG_ALERT, log, 0, "perl_alloc() failed");
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
510 return NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
511 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
512
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
513 perl_construct(perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
514
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
515 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
516
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
517 dTHXa(perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
518
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
519 #ifdef PERL_EXIT_DESTRUCT_END
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
520 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
521 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
522
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
523 embedding[0] = "";
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
524
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
525 if (pmcf->modules.data) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
526 embedding[1] = "-I";
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
527 embedding[2] = (char *) pmcf->modules.data;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
528 n = 3;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
529
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
530 } else {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
531 n = 1;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
532 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
533
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
534 embedding[n++] = "-Mnginx";
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
535 embedding[n++] = "-e";
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
536 embedding[n++] = "0";
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
537
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
538 n = perl_parse(perl, ngx_http_perl_xs_init, n, embedding, NULL);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
539
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
540 if (n != 0) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
541 ngx_log_error(NGX_LOG_ALERT, log, 0, "perl_parse() failed: %d", n);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
542 goto fail;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
543 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
544
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
545 script = pmcf->requires.elts;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
546 for (i = 0; i < pmcf->requires.nelts; i++) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
547 require_pv(script[i]);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
548
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
549 if (SvTRUE(ERRSV)) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
550
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
551 err.data = (u_char *) SvPV(ERRSV, len);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
552 for (len--; err.data[len] == LF || err.data[len] == CR; len--) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
553 /* void */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
554 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
555 err.len = len + 1;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
556
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
557 ngx_log_error(NGX_LOG_EMERG, log, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
558 "require_pv(\"%s\") failed: \"%V\"", script[i], &err);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
559 goto fail;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
560 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
561 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
562
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
563 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
564
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
565 pmcf->nalloc++;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
566
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
567 return perl;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
568
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
569 fail:
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
570
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
571 (void) perl_destruct(perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
572
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
573 perl_free(perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
574
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
575 return NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
576 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
577
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
578
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
579 #if (__INTEL_COMPILER)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
580 /*
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
581 * disable 'declaration hides parameter "my_perl"' warning for ENTER and LEAVE
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
582 */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
583 #pragma warning(disable:1599)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
584 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
585
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
586
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
587 static ngx_int_t
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
588 ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, SV *sub,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
589 ngx_str_t **args, ngx_str_t *handler, ngx_str_t *rv)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
590 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
591 SV *sv;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
592 int n, status;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
593 char *line;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
594 STRLEN len, n_a;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
595 ngx_str_t err;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
596 ngx_uint_t i;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
597
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
598 dSP;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
599
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
600 status = 0;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
601
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
602 ENTER;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
603 SAVETMPS;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
604
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
605 PUSHMARK(sp);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
606
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
607 sv = sv_newmortal();
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
608 sv_setref_pv(sv, "nginx", r);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
609 XPUSHs(sv);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
610
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
611 if (args) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
612 for (i = 0; args[i]; i++) { /* void */ }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
613
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
614 EXTEND(sp, (int) i);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
615
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
616 for (i = 0; args[i]; i++) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
617 PUSHs(sv_2mortal(newSVpvn((char *) args[i]->data, args[i]->len)));
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
618 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
619 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
620
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
621 PUTBACK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
622
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
623 n = call_sv(sub, G_EVAL);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
624
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
625 SPAGAIN;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
626
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
627 if (n) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
628 if (rv == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
629 status = POPi;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
630
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
631 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
632 "call_sv: %d", status);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
633
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
634 } else {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
635 line = POPpx;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
636 rv->len = n_a;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
637
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
638 rv->data = ngx_palloc(r->pool, n_a);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
639 if (rv->data == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
640 return NGX_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
641 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
642
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
643 ngx_memcpy(rv->data, line, n_a);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
644 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
645 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
646
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
647 PUTBACK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
648
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
649 FREETMPS;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
650 LEAVE;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
651
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
652 /* check $@ */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
653
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
654 if (SvTRUE(ERRSV)) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
655
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
656 err.data = (u_char *) SvPV(ERRSV, len);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
657 for (len--; err.data[len] == LF || err.data[len] == CR; len--) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
658 /* void */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
659 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
660 err.len = len + 1;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
661
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
662 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
663 "call_sv(\"%V\") failed: \"%V\"",
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
664 handler, &err);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
665
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
666 if (rv) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
667 return NGX_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
668 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
669
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
670 return NGX_HTTP_INTERNAL_SERVER_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
671 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
672
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
673 if (n != 1) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
674 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
675 "call_sv(\"%V\") returned %d results", handler, n);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
676 status = NGX_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
677 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
678
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
679 if (rv) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
680 return NGX_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
681 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
682
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
683 return (ngx_int_t) status;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
684 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
685
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
686
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
687 #if (__INTEL_COMPILER)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
688 #pragma warning(default:1599)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
689 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
690
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
691
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
692 static void
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
693 ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
694 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
695 if (ngx_strncmp(handler->data, "sub ", 4) == 0
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
696 || ngx_strncmp(handler->data, "use ", 4) == 0)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
697 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
698 *sv = eval_pv((char *) handler->data, FALSE);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
699
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
700 return;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
701 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
702
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
703 *sv = NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
704 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
705
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
706
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
707 static void *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
708 ngx_http_perl_create_main_conf(ngx_conf_t *cf)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
709 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
710 ngx_http_perl_main_conf_t *pmcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
711
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
712 pmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_perl_main_conf_t));
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
713 if (pmcf == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
714 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
715 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
716
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
717 pmcf->interp_max = NGX_CONF_UNSET_UINT;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
718
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
719 if (ngx_array_init(&pmcf->requires, cf->pool, 1, sizeof(u_char *))
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
720 != NGX_OK)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
721 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
722 return NULL;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
723 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
724
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
725 return pmcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
726 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
727
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
728
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
729 static char *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
730 ngx_http_perl_init_main_conf(ngx_conf_t *cf, void *conf)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
731 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
732 ngx_http_perl_main_conf_t *pmcf = conf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
733
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
734 #if (NGX_HAVE_PERL_CLONE || NGX_HAVE_PERL_MULTIPLICITY)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
735 ngx_conf_init_unsigned_value(pmcf->interp_max, 10);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
736 #else
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
737 ngx_conf_init_unsigned_value(pmcf->interp_max, 1);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
738 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
739
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
740 pmcf->free_perls = ngx_pcalloc(cf->pool,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
741 pmcf->interp_max * sizeof(PerlInterpreter *));
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
742 if (pmcf->free_perls == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
743 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
744 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
745
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
746 if (pmcf->perl == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
747 if (ngx_http_perl_init_interpreter(cf, pmcf) != NGX_CONF_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
748 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
749 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
750 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
751
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
752 #if !(NGX_HAVE_PERL_CLONE)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
753 ngx_http_perl_free_interpreter(pmcf, pmcf->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
754 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
755
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
756 return NGX_CONF_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
757 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
758
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
759
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
760 static void
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
761 ngx_http_perl_cleanup_perl(void *data)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
762 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
763 PerlInterpreter *perl = data;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
764
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
765 (void) perl_destruct(perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
766
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
767 perl_free(perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
768
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
769 PERL_SYS_TERM();
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
770 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
771
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
772
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
773 static ngx_int_t
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
774 ngx_http_perl_preconfiguration(ngx_conf_t *cf)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
775 {
166
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
776 #if (NGX_HTTP_SSI)
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
777 ngx_int_t rc;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
778 ngx_http_ssi_main_conf_t *smcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
779
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
780 smcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_ssi_filter_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
781
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
782 rc = ngx_hash_add_key(&smcf->commands, &ngx_http_perl_ssi_command.name,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
783 &ngx_http_perl_ssi_command, NGX_HASH_READONLY_KEY);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
784
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
785 if (rc != NGX_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
786 if (rc == NGX_BUSY) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
787 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
788 "conflicting SSI command \"%V\"",
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
789 &ngx_http_perl_ssi_command.name);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
790 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
791
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
792 return NGX_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
793 }
166
fef68f68bcfd nginx 0.3.30
Igor Sysoev <http://sysoev.ru>
parents: 148
diff changeset
794 #endif
148
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
795
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
796 return NGX_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
797 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
798
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
799
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
800 static void *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
801 ngx_http_perl_create_loc_conf(ngx_conf_t *cf)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
802 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
803 ngx_http_perl_loc_conf_t *plcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
804
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
805 plcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_perl_loc_conf_t));
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
806 if (plcf == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
807 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
808 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
809
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
810 /*
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
811 * set by ngx_pcalloc():
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
812 *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
813 * plcf->handler = { 0, NULL };
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
814 */
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
815
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
816 return plcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
817 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
818
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
819
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
820 static char *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
821 ngx_http_perl_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
822 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
823 ngx_http_perl_loc_conf_t *prev = parent;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
824 ngx_http_perl_loc_conf_t *conf = child;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
825
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
826 if (conf->sub == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
827 conf->sub = prev->sub;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
828 conf->handler = prev->handler;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
829 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
830
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
831 return NGX_CONF_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
832 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
833
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
834
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
835 static char *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
836 ngx_http_perl_require(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
837 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
838 ngx_http_perl_main_conf_t *pmcf = conf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
839
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
840 u_char **p;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
841 ngx_str_t *value;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
842
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
843 value = cf->args->elts;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
844
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
845 p = ngx_array_push(&pmcf->requires);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
846
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
847 if (p == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
848 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
849 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
850
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
851 *p = value[1].data;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
852
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
853 return NGX_CONF_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
854 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
855
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
856
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
857 static char *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
858 ngx_http_perl(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
859 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
860 ngx_http_perl_loc_conf_t *plcf = conf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
861
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
862 ngx_str_t *value;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
863 ngx_http_core_loc_conf_t *clcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
864 ngx_http_perl_main_conf_t *pmcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
865
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
866 value = cf->args->elts;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
867
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
868 if (plcf->handler.data) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
869 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
870 "duplicate perl handler \"%V\"", &value[1]);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
871 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
872 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
873
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
874 pmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
875
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
876 if (pmcf->perl == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
877 if (ngx_http_perl_init_interpreter(cf, pmcf) != NGX_CONF_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
878 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
879 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
880 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
881
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
882 plcf->handler = value[1];
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
883
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
884 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
885
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
886 dTHXa(pmcf->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
887
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
888 ngx_http_perl_eval_anon_sub(aTHX_ &value[1], &plcf->sub);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
889
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
890 if (plcf->sub == &PL_sv_undef) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
891 ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
892 "eval_pv(\"%V\") failed", &value[1]);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
893 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
894 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
895
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
896 if (plcf->sub == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
897 plcf->sub = newSVpvn((char *) value[1].data, value[1].len);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
898 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
899
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
900 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
901
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
902 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
903 clcf->handler = ngx_http_perl_handler;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
904
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
905 return NGX_CONF_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
906 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
907
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
908
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
909 static char *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
910 ngx_http_perl_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
911 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
912 ngx_int_t index;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
913 ngx_str_t *value;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
914 ngx_http_variable_t *v;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
915 ngx_http_perl_variable_t *pv;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
916 ngx_http_perl_main_conf_t *pmcf;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
917
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
918 value = cf->args->elts;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
919
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
920 if (value[1].data[0] != '$') {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
921 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
922 "invalid variable name \"%V\"", &value[1]);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
923 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
924 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
925
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
926 value[1].len--;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
927 value[1].data++;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
928
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
929 v = ngx_http_add_variable(cf, &value[1], NGX_HTTP_VAR_CHANGABLE);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
930 if (v == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
931 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
932 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
933
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
934 pv = ngx_palloc(cf->pool, sizeof(ngx_http_perl_variable_t));
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
935 if (pv == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
936 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
937 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
938
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
939 index = ngx_http_get_variable_index(cf, &value[1]);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
940 if (index == NGX_ERROR) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
941 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
942 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
943
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
944 pmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_perl_module);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
945
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
946 if (pmcf->perl == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
947 if (ngx_http_perl_init_interpreter(cf, pmcf) != NGX_CONF_OK) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
948 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
949 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
950 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
951
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
952 pv->handler = value[2];
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
953
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
954 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
955
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
956 dTHXa(pmcf->perl);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
957
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
958 ngx_http_perl_eval_anon_sub(aTHX_ &value[2], &pv->sub);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
959
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
960 if (pv->sub == &PL_sv_undef) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
961 ngx_conf_log_error(NGX_LOG_ERR, cf, 0,
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
962 "eval_pv(\"%V\") failed", &value[2]);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
963 return NGX_CONF_ERROR;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
964 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
965
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
966 if (pv->sub == NULL) {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
967 pv->sub = newSVpvn((char *) value[2].data, value[2].len);
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
968 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
969
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
970 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
971
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
972 v->handler = ngx_http_perl_variable;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
973 v->data = (uintptr_t) pv;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
974
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
975 return NGX_CONF_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
976 }
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
977
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
978
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
979 static char *
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
980 ngx_http_perl_interp_max_unsupported(ngx_conf_t *cf, void *post, void *data)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
981 {
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
982 #if (NGX_HAVE_PERL_CLONE || NGX_HAVE_PERL_MULTIPLICITY)
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
983
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
984 return NGX_CONF_OK;
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
985
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
986 #else
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
987
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
988 return "to use perl_interp_max you have to build perl with "
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
989 "-Dusemultiplicity or -Dusethreads options";
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
990
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
991 #endif
ea622d8acb38 nginx 0.3.21
Igor Sysoev <http://sysoev.ru>
parents:
diff changeset
992 }