~spuul/nginx/trunk

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Christos Trochalakis, Christos Trochalakis
  • Date: 2014-02-13 11:41:49 UTC
  • mfrom: (1.3.32)
  • mto: This revision was merged to the branch mainline in revision 72.
  • Revision ID: package-import@ubuntu.com-20140213114149-tkp78c45rzu3wr6y
Tags: 1.4.5-1
[ Christos Trochalakis ]
* New upstream release.
* debian/modules/nginx-lua:
  + Update nginx-lua to v0.9.4
* debian/nginx-naxsi-ui.preinst:
  + Fix exit status issue (Closes: #735152)
* debian/control:
  + Fix arch:all to arch:any dependencies
  + Make nginx depend on specific flavor version
* debian/nginx-*.postinst:
  + Make nginx start by default (Closes: #735551)
* debian/nginx-*.prerm:
  + No need to check for invoke-rc.d,
    correctly set the exit code on error
* debian/nginx-common.nginx.init:
  + Rewrite some parts of the initscript
  + Introduce rotate command
  + Introduce upgrade command

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
ngx_int_t
144
144
ngx_http_lua_access_handler_inline(ngx_http_request_t *r)
145
145
{
146
 
    char                      *err;
147
146
    ngx_int_t                  rc;
148
147
    lua_State                 *L;
149
148
    ngx_http_lua_loc_conf_t   *llcf;
150
 
    ngx_http_lua_main_conf_t  *lmcf;
151
149
 
152
150
    llcf = ngx_http_get_module_loc_conf(r, ngx_http_lua_module);
153
 
    lmcf = ngx_http_get_module_main_conf(r, ngx_http_lua_module);
154
151
 
155
 
    L = lmcf->lua;
 
152
    L = ngx_http_lua_get_lua_vm(r, NULL);
156
153
 
157
154
    /*  load Lua inline script (w/ cache) sp = 1 */
158
155
    rc = ngx_http_lua_cache_loadbuffer(L, llcf->access_src.value.data,
159
156
                                       llcf->access_src.value.len,
160
157
                                       llcf->access_src_key,
161
 
                                       "access_by_lua", &err,
162
 
                                       llcf->enable_code_cache ? 1 : 0);
 
158
                                       "access_by_lua");
163
159
 
164
160
    if (rc != NGX_OK) {
165
 
        if (err == NULL) {
166
 
            err = "unknown error";
167
 
        }
168
 
 
169
 
        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
170
 
                      "failed to load Lua inlined code: %s", err);
171
 
 
172
161
        return NGX_HTTP_INTERNAL_SERVER_ERROR;
173
162
    }
174
163
 
179
168
ngx_int_t
180
169
ngx_http_lua_access_handler_file(ngx_http_request_t *r)
181
170
{
182
 
    char                      *err;
183
171
    u_char                    *script_path;
184
172
    ngx_int_t                  rc;
185
173
    ngx_str_t                  eval_src;
186
174
    lua_State                 *L;
187
175
    ngx_http_lua_loc_conf_t   *llcf;
188
 
    ngx_http_lua_main_conf_t  *lmcf;
189
176
 
190
177
    llcf = ngx_http_get_module_loc_conf(r, ngx_http_lua_module);
191
178
 
201
188
        return NGX_ERROR;
202
189
    }
203
190
 
204
 
    lmcf = ngx_http_get_module_main_conf(r, ngx_http_lua_module);
205
 
    L = lmcf->lua;
 
191
    L = ngx_http_lua_get_lua_vm(r, NULL);
206
192
 
207
193
    /*  load Lua script file (w/ cache)        sp = 1 */
208
 
    rc = ngx_http_lua_cache_loadfile(L, script_path, llcf->access_src_key,
209
 
                                     &err, llcf->enable_code_cache ? 1 : 0);
210
 
 
 
194
    rc = ngx_http_lua_cache_loadfile(L, script_path, llcf->access_src_key);
211
195
    if (rc != NGX_OK) {
212
 
        if (err == NULL) {
213
 
            err = "unknown error";
214
 
        }
215
 
 
216
 
        ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
217
 
                      "failed to load lua inlined code: %s", err);
218
 
 
219
196
        return NGX_HTTP_INTERNAL_SERVER_ERROR;
220
197
    }
221
198
 
257
234
    lua_setfenv(co, -2);
258
235
 
259
236
    /*  save nginx request in coroutine globals table */
260
 
    lua_pushlightuserdata(co, &ngx_http_lua_request_key);
261
 
    lua_pushlightuserdata(co, r);
262
 
    lua_rawset(co, LUA_GLOBALSINDEX);
263
 
    /*  }}} */
 
237
    ngx_http_lua_set_req(co, r);
264
238
 
265
239
    /*  {{{ initialize request context */
266
240
    ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module);
288
262
            return NGX_HTTP_INTERNAL_SERVER_ERROR;
289
263
        }
290
264
 
291
 
        cln->handler = ngx_http_lua_request_cleanup;
292
 
        cln->data = r;
 
265
        cln->handler = ngx_http_lua_request_cleanup_handler;
 
266
        cln->data = ctx;
293
267
        ctx->cleanup = &cln->handler;
294
268
    }
295
269
    /*  }}} */