~ubuntu-branches/ubuntu/saucy/nginx/saucy-proposed

« back to all changes in this revision

Viewing changes to debian/modules/nginx-echo/src/ngx_http_echo_module.c

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Kartik Mistry, Cyril Lavier, Michael Lustfield
  • Date: 2012-12-18 10:29:18 UTC
  • mfrom: (4.2.56 sid)
  • Revision ID: package-import@ubuntu.com-20121218102918-dxtwj9vj89sbj8dz
Tags: 1.2.6-1
[ Kartik Mistry ]
* New upstream release.
* debian/nginx-common.nginx.init:
  + Used log_*_msg instead of echo for better init messages.
  + Added patch to check start-stop-daemon exit status, Thanks to
    Sergey B Kirpichev <skirpichev@gmail.com> (Closes: #695374).
* debian/po/ja.po:
  + Added new Japanese translation. Thanks to victory <victory.deb@gmail.com>
    (Closes: #692481).
* debian/po/pt_BR.po:
  + Added new Brazilian Portuguese translation. Thanks to
    Adriano Rafael Gomes <adrianorg@gmail.com> (Closes: #692481).

[ Cyril Lavier ]
* debian/rules
  + Added RealIP module in nginx-naxsi (Closes: #693302).
* debian/modules/nginx-cache-purge/
  + Updated nginx-cache-purge module with the 2.0 version.
* debian/modules/nginx-lua/
  + Updated nginx-lua module with the 0.7.8 version.
* debian/modules/nginx-echo/
  + Updated the nginx-echo module with the 0.41 version.
* debian/modules/headers-more-nginx-module/
  + Updated the Headers-more module with the 0.19 version.
* debian/modules/README.Modules-versions
  + Updated the current version of modules following the updates.

[ Michael Lustfield ]
* debian/conf/sites-available/default
  + Uncommented listen lines to make server block default.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#include <ngx_log.h>
13
13
 
14
14
/* config init handler */
15
 
static void * ngx_http_echo_create_conf(ngx_conf_t *cf);
 
15
static void * ngx_http_echo_create_loc_conf(ngx_conf_t *cf);
 
16
static char * ngx_http_echo_merge_loc_conf(ngx_conf_t *cf, void *parent,
 
17
        void *child);
16
18
 
17
19
/* config directive handlers */
18
20
static char * ngx_http_echo_echo(ngx_conf_t *cf, ngx_command_t *cmd,
19
21
        void *conf);
20
 
 
21
22
static char * ngx_http_echo_echo_request_body(ngx_conf_t *cf,
22
23
        ngx_command_t *cmd, void *conf);
23
 
 
24
24
static char * ngx_http_echo_echo_sleep(ngx_conf_t *cf, ngx_command_t *cmd,
25
25
        void *conf);
26
 
 
27
26
static char * ngx_http_echo_echo_flush(ngx_conf_t *cf, ngx_command_t *cmd,
28
27
        void *conf);
29
 
 
30
28
static char * ngx_http_echo_echo_blocking_sleep(ngx_conf_t *cf,
31
29
        ngx_command_t *cmd, void *conf);
32
 
 
33
30
static char * ngx_http_echo_echo_reset_timer(ngx_conf_t *cf,
34
31
        ngx_command_t *cmd, void *conf);
35
 
 
36
32
static char * ngx_http_echo_echo_before_body(ngx_conf_t *cf,
37
33
        ngx_command_t *cmd, void *conf);
38
 
 
39
34
static char * ngx_http_echo_echo_after_body(ngx_conf_t *cf,
40
35
        ngx_command_t *cmd, void *conf);
41
 
 
42
36
static char * ngx_http_echo_echo_location_async(ngx_conf_t *cf,
43
37
        ngx_command_t *cmd, void *conf);
44
 
 
45
38
static char * ngx_http_echo_echo_location(ngx_conf_t *cf,
46
39
        ngx_command_t *cmd, void *conf);
47
 
 
48
40
static char * ngx_http_echo_echo_subrequest_async(ngx_conf_t *cf,
49
41
        ngx_command_t *cmd, void *conf);
50
 
 
51
42
static char * ngx_http_echo_echo_subrequest(ngx_conf_t *cf,
52
43
        ngx_command_t *cmd, void *conf);
53
 
 
54
44
static char * ngx_http_echo_echo_duplicate(ngx_conf_t *cf,
55
45
        ngx_command_t *cmd, void *conf);
56
 
 
57
46
static char * ngx_http_echo_echo_read_request_body(ngx_conf_t *cf,
58
47
        ngx_command_t *cmd, void *conf);
59
 
 
60
48
static char * ngx_http_echo_echo_foreach_split(ngx_conf_t *cf,
61
49
        ngx_command_t *cmd, void *conf);
62
 
 
63
50
static char * ngx_http_echo_echo_end(ngx_conf_t *cf,
64
51
        ngx_command_t *cmd, void *conf);
65
 
 
66
52
static char * ngx_http_echo_echo_abort_parent(ngx_conf_t *cf,
67
53
        ngx_command_t *cmd, void *conf);
68
 
 
69
54
static char * ngx_http_echo_echo_exec(ngx_conf_t *cf,
70
55
        ngx_command_t *cmd, void *conf);
71
 
 
72
56
static char * ngx_http_echo_helper(ngx_http_echo_opcode_t opcode,
73
57
        ngx_http_echo_cmd_category_t cat,
74
 
        ngx_conf_t *cf, ngx_command_t *cmd, void* conf);
 
58
        ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
75
59
 
76
60
 
77
61
static ngx_http_module_t ngx_http_echo_module_ctx = {
78
 
    /* TODO we could add our own variables here... */
79
 
    ngx_http_echo_handler_init,                 /* preconfiguration */
80
 
    ngx_http_echo_filter_init,                  /* postconfiguration */
 
62
    ngx_http_echo_handler_init,    /* preconfiguration */
 
63
    ngx_http_echo_filter_init,     /* postconfiguration */
81
64
 
82
65
    NULL,                          /* create main configuration */
83
66
    NULL,                          /* init main configuration */
85
68
    NULL,                          /* create server configuration */
86
69
    NULL,                          /* merge server configuration */
87
70
 
88
 
    ngx_http_echo_create_conf, /* create location configuration */
89
 
    NULL                           /* merge location configuration */
 
71
    ngx_http_echo_create_loc_conf, /* create location configuration */
 
72
    ngx_http_echo_merge_loc_conf   /* merge location configuration */
90
73
};
91
74
 
92
75
 
218
201
      offsetof(ngx_http_echo_loc_conf_t, handler_cmds),
219
202
      NULL },
220
203
 
 
204
    { ngx_string("echo_status"),
 
205
      NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1,
 
206
      ngx_conf_set_num_slot,
 
207
      NGX_HTTP_LOC_CONF_OFFSET,
 
208
      offsetof(ngx_http_echo_loc_conf_t, status),
 
209
      NULL },
 
210
 
221
211
      ngx_null_command
222
212
};
223
213
 
224
214
 
225
215
ngx_module_t ngx_http_echo_module = {
226
216
    NGX_MODULE_V1,
227
 
    &ngx_http_echo_module_ctx, /* module context */
228
 
    ngx_http_echo_commands,   /* module directives */
 
217
    &ngx_http_echo_module_ctx,     /* module context */
 
218
    ngx_http_echo_commands,        /* module directives */
229
219
    NGX_HTTP_MODULE,               /* module type */
230
220
    NULL,                          /* init master */
231
221
    NULL,                          /* init module */
239
229
 
240
230
 
241
231
static void *
242
 
ngx_http_echo_create_conf(ngx_conf_t *cf)
 
232
ngx_http_echo_create_loc_conf(ngx_conf_t *cf)
243
233
{
244
234
    ngx_http_echo_loc_conf_t        *conf;
245
235
 
256
246
     *  conf->seen_trailing_output = 0
257
247
     */
258
248
 
 
249
    conf->status = NGX_CONF_UNSET;
 
250
 
259
251
    return conf;
260
252
}
261
253
 
262
254
 
263
255
static char *
 
256
ngx_http_echo_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
 
257
{
 
258
    ngx_http_echo_loc_conf_t    *prev = parent;
 
259
    ngx_http_echo_loc_conf_t    *conf = child;
 
260
 
 
261
    if (conf->handler_cmds == NULL) {
 
262
        conf->handler_cmds = prev->handler_cmds;
 
263
        conf->seen_leading_output = prev->seen_leading_output;
 
264
    }
 
265
 
 
266
    if (conf->before_body_cmds == NULL) {
 
267
        conf->before_body_cmds = prev->before_body_cmds;
 
268
    }
 
269
 
 
270
    if (conf->after_body_cmds == NULL) {
 
271
        conf->after_body_cmds = prev->after_body_cmds;
 
272
    }
 
273
 
 
274
    ngx_conf_merge_value(conf->status, prev->status, 200);
 
275
 
 
276
    return NGX_CONF_OK;
 
277
}
 
278
 
 
279
 
 
280
static char *
264
281
ngx_http_echo_helper(ngx_http_echo_opcode_t opcode,
265
282
        ngx_http_echo_cmd_category_t cat,
266
283
        ngx_conf_t *cf, ngx_command_t *cmd, void* conf)
267
284
{
268
285
    ngx_http_core_loc_conf_t        *clcf;
269
 
    /* ngx_http_echo_loc_conf_t        *elcf = conf; */
270
286
    ngx_array_t                    **args_ptr;
271
287
    ngx_http_script_compile_t        sc;
272
288
    ngx_str_t                       *raw_args;