~ubuntu-branches/ubuntu/quantal/nginx/quantal-updates

« back to all changes in this revision

Viewing changes to debian/modules/nginx-lua/src/ngx_http_lua_conf.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Lustfield, Micheal Lustfield, Kartik Mistry
  • Date: 2011-03-03 23:39:07 UTC
  • mfrom: (4.2.29 sid)
  • Revision ID: james.westby@ubuntu.com-20110303233907-y48yifhfnn5qjuxz
Tags: 0.8.54-4
[Micheal Lustfield]
* debian/nginx-{full,light,extras}.default:
  + Added comment about alternative to ULIMIT.
* debian/nginx-{full,light,extras}.init.d:
  + Added quotes around a test variable. (Closes: #610946, LP: #699736)
* debian/patches/609343-log-time-iso8601.diff:
  + Added patch to add $time_iso8601 variable to logs. (Closes: #609343)
* Clean up old logrotate files. (Closes: #608983, Closes: #610289)
  + Added Files:
    - debian/nginx-common.preinst
  + Modified Files:
    - debian/rules
  + Moved debian/nginx-common.logrotate to debian/logrotate.
* Added common files to nginx-common package. (Closes: #610290)
  + Removed Files:
    - debian/nginx-full.dirs
    - debian/nginx-light.dirs
    - debian/nginx-full.install
    - debian/nginx-light.install
    - debian/nginx-extras.install
    - debian/nginx.*
  + Added Files:
    - debian/nginx-common.default
    - debian/nginx-common.dirs
    - debian/nginx-common.init.d
    - debian/nginx-common.install
    - debian/nginx-common.manpages
    - debian/logrotate
  + Modified Files:
    - debian/nginx-extras.dirs
    - debian/control
    - debian/rules
* debian/nginx-*.install: (Closes: #609797)
  + Removed NEWS.Debian from nginx-{full,light,extras}.install.
  + Added NEWS.Debian to nginx-common.install.
* nginx-common.postinst:
  + Enforce /var/log/nginx mode and user:group. (Closes: #610983)
  + Enforce /var/log/nginx/*.log mode and user:group. (Closes: #612832)
* debian/rules:
  + Added --with-file-aio to nginx-extras. (Closes: #613175)
  + Removed split clients and user id modules from nginx-light.
* debian/conf/sites-available/default:
  + Fixed a minor typo ( s/Quickstart/QuickStart/ ). (Closes: #613355)
* debian/conf/mime.types:
  + Changed xml type to application/xhtml+xml. (Closes: #613851)
* debian/help/docs/fcgiwrap:
  + Removed Ubuntu specific line in docs. (Closes: #614987)
* debian/conf/sites-available/default:
  + Fixed a pointer to a file. (Closes: #614980)

[Kartik Mistry]
* debian/*.lintian-overrides:
  + Add Lintian overrides for nginx man page. We've manpage in nginx-common
    binary

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* vim:set ft=c ts=4 sw=4 et fdm=marker: */
 
2
#include "ngx_http_lua_conf.h"
 
3
#include "ngx_http_lua_util.h"
 
4
 
 
5
 
 
6
static void ngx_http_lua_cleanup_vm(void *data);
 
7
static char * ngx_http_lua_init_vm(ngx_conf_t *cf, ngx_http_lua_main_conf_t *lmcf);
 
8
 
 
9
 
 
10
void *
 
11
ngx_http_lua_create_main_conf(ngx_conf_t *cf)
 
12
{
 
13
    ngx_http_lua_main_conf_t *lmcf;
 
14
 
 
15
    lmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_lua_main_conf_t));
 
16
    if (lmcf == NULL) {
 
17
        return NULL;
 
18
    }
 
19
 
 
20
    /* set by ngx_pcalloc:
 
21
     *      lmcf->lua = NULL;
 
22
     *      lmcf->lua_path = { 0, NULL };
 
23
     *      lmcf->lua_cpath = { 0, NULL };
 
24
     */
 
25
 
 
26
    dd("NginX Lua module main config structure initialized!");
 
27
 
 
28
    return lmcf;
 
29
}
 
30
 
 
31
 
 
32
char *
 
33
ngx_http_lua_init_main_conf(ngx_conf_t *cf, void *conf)
 
34
{
 
35
    ngx_http_lua_main_conf_t *lmcf = conf;
 
36
 
 
37
    if (lmcf->lua == NULL) {
 
38
        if (ngx_http_lua_init_vm(cf, lmcf) != NGX_CONF_OK) {
 
39
            ngx_conf_log_error(NGX_ERROR, cf, 0, "Failed to initialize Lua VM!");
 
40
            return NGX_CONF_ERROR;
 
41
        }
 
42
 
 
43
        dd("Lua VM initialized!");
 
44
    }
 
45
 
 
46
    return NGX_CONF_OK;
 
47
}
 
48
 
 
49
 
 
50
void*
 
51
ngx_http_lua_create_loc_conf(ngx_conf_t *cf)
 
52
{
 
53
    ngx_http_lua_loc_conf_t *conf;
 
54
 
 
55
    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_lua_loc_conf_t));
 
56
    if (conf == NULL) {
 
57
        return NGX_CONF_ERROR;
 
58
    }
 
59
 
 
60
    /* set by ngx_pcalloc:
 
61
     *      conf->src = { 0, NULL };
 
62
     */
 
63
 
 
64
    conf->force_read_body = NGX_CONF_UNSET;
 
65
 
 
66
    return conf;
 
67
}
 
68
 
 
69
 
 
70
char*
 
71
ngx_http_lua_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
 
72
{
 
73
    ngx_http_lua_loc_conf_t *prev = parent;
 
74
    ngx_http_lua_loc_conf_t *conf = child;
 
75
 
 
76
    ngx_conf_merge_str_value(conf->src, prev->src, "");
 
77
    ngx_conf_merge_value(conf->force_read_body, prev->force_read_body, 0);
 
78
 
 
79
    return NGX_CONF_OK;
 
80
}
 
81
 
 
82
 
 
83
static void
 
84
ngx_http_lua_cleanup_vm(void *data)
 
85
{
 
86
    lua_State *lua = data;
 
87
 
 
88
    if (lua != NULL) {
 
89
        lua_close(lua);
 
90
 
 
91
        dd("Lua VM closed!");
 
92
    }
 
93
}
 
94
 
 
95
 
 
96
static char*
 
97
ngx_http_lua_init_vm(ngx_conf_t *cf, ngx_http_lua_main_conf_t *lmcf)
 
98
{
 
99
    ngx_pool_cleanup_t *cln;
 
100
 
 
101
    /* add new cleanup handler to config mem pool */
 
102
    cln = ngx_pool_cleanup_add(cf->pool, 0);
 
103
    if (cln == NULL) {
 
104
        return NGX_CONF_ERROR;
 
105
    }
 
106
 
 
107
    /* create new Lua VM instance */
 
108
    lmcf->lua = ngx_http_lua_new_state(cf, lmcf);
 
109
    if (lmcf->lua == NULL) {
 
110
        return NGX_CONF_ERROR;
 
111
    }
 
112
 
 
113
    /* register cleanup handler for Lua VM */
 
114
    cln->handler = ngx_http_lua_cleanup_vm;
 
115
    cln->data = lmcf->lua;
 
116
 
 
117
    return NGX_CONF_OK;
 
118
}
 
119