diff --git a/src/hlua.c b/src/hlua.c index f3f41aae5..53ed89521 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -6209,7 +6209,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) } if (!sl) { hlua_pusherror(L, "Lua applet http '%s': Failed to create response.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name); + luactx->appctx->applet->name); WILL_LJMP(lua_error(L)); } sl->info.res.status = http_ctx->status; @@ -6217,7 +6217,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) /* Get the array associated to the field "response" in the object AppletHTTP. */ if (lua_getfield(L, 1, "response") != LUA_TTABLE) { hlua_pusherror(L, "Lua applet http '%s': AppletHTTP['response'] missing.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name); + luactx->appctx->applet->name); WILL_LJMP(lua_error(L)); } @@ -6227,7 +6227,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) /* We expect a string as -2. */ if (lua_type(L, -2) != LUA_TSTRING) { hlua_pusherror(L, "Lua applet http '%s': AppletHTTP['response'][] element must be a string. got %s.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name, + luactx->appctx->applet->name, lua_typename(L, lua_type(L, -2))); WILL_LJMP(lua_error(L)); } @@ -6236,7 +6236,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) /* We expect an array as -1. */ if (lua_type(L, -1) != LUA_TTABLE) { hlua_pusherror(L, "Lua applet http '%s': AppletHTTP['response']['%s'] element must be an table. got %s.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name, + luactx->appctx->applet->name, name, lua_typename(L, lua_type(L, -1))); WILL_LJMP(lua_error(L)); @@ -6250,7 +6250,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) /* We expect a number as -2. */ if (lua_type(L, -2) != LUA_TNUMBER) { hlua_pusherror(L, "Lua applet http '%s': AppletHTTP['response']['%s'][] element must be a number. got %s.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name, + luactx->appctx->applet->name, name, lua_typename(L, lua_type(L, -2))); WILL_LJMP(lua_error(L)); @@ -6260,7 +6260,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) /* We expect a string as -2. */ if (lua_type(L, -1) != LUA_TSTRING) { hlua_pusherror(L, "Lua applet http '%s': AppletHTTP['response']['%s'][%d] element must be a string. got %s.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name, + luactx->appctx->applet->name, name, id, lua_typename(L, lua_type(L, -1))); WILL_LJMP(lua_error(L)); @@ -6274,7 +6274,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) ret = h1_parse_xfer_enc_header(&h1m, ist2(value, vlen)); if (ret < 0) { hlua_pusherror(L, "Lua applet http '%s': Invalid '%s' header.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name, + luactx->appctx->applet->name, name); WILL_LJMP(lua_error(L)); } @@ -6289,7 +6289,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) ret = http_parse_cont_len_header(&v, &body_len, (h1m.flags & H1_MF_CLEN)); if (ret < 0) { hlua_pusherror(L, "Lua applet http '%s': Invalid '%s' header.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name, + luactx->appctx->applet->name, name); WILL_LJMP(lua_error(L)); } @@ -6302,7 +6302,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) /* Add a new header */ if (!htx_add_header(htx, ist2(name, nlen), ist2(value, vlen))) { hlua_pusherror(L, "Lua applet http '%s': Failed to add header '%s' in the response.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name, + luactx->appctx->applet->name, name); WILL_LJMP(lua_error(L)); } @@ -6346,7 +6346,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) sl->flags |= (HTX_SL_F_XFER_ENC|H1_MF_CHNK|H1_MF_XFER_LEN); if (!htx_add_header(htx, ist("transfer-encoding"), ist("chunked"))) { hlua_pusherror(L, "Lua applet http '%s': Failed to add header 'transfer-encoding' in the response.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name); + luactx->appctx->applet->name); WILL_LJMP(lua_error(L)); } } @@ -6354,7 +6354,7 @@ __LJMP static int hlua_applet_http_send_response(lua_State *L) /* Finalize headers. */ if (!htx_add_endof(htx, HTX_BLK_EOH)) { hlua_pusherror(L, "Lua applet http '%s': Failed create the response.\n", - luactx->appctx->rule->arg.hlua_rule->fcn->name); + luactx->appctx->applet->name); WILL_LJMP(lua_error(L)); } @@ -10933,7 +10933,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx) hlua = pool_alloc(pool_head_hlua); if (!hlua) { SEND_ERR(strm->be, "Lua applet tcp '%s': out of memory.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); return -1; } HLUA_INIT(hlua); @@ -10944,7 +10944,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx) task = task_new_here(); if (!task) { SEND_ERR(strm->be, "Lua applet tcp '%s': out of memory.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); return -1; } task->nice = 0; @@ -10959,7 +10959,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx) */ if (!hlua_ctx_init(hlua, fcn_ref_to_stack_id(ctx->rule->arg.hlua_rule->fcn), task)) { SEND_ERR(strm->be, "Lua applet tcp '%s': can't initialize Lua context.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); return -1; } @@ -10974,7 +10974,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx) else error = "critical error"; SEND_ERR(strm->be, "Lua applet tcp '%s': %s.\n", - ctx->rule->arg.hlua_rule->fcn->name, error); + ctx->applet->name, error); hlua_unlock(hlua); return -1; } @@ -10982,7 +10982,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx) /* Check stack available size. */ if (!lua_checkstack(hlua->T, 1)) { SEND_ERR(strm->be, "Lua applet tcp '%s': full stack.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); RESET_SAFE_LJMP(hlua); return -1; } @@ -10993,7 +10993,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx) /* Create and and push object stream in the stack. */ if (!hlua_applet_tcp_new(hlua->T, ctx)) { SEND_ERR(strm->be, "Lua applet tcp '%s': full stack.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); RESET_SAFE_LJMP(hlua); return -1; } @@ -11003,7 +11003,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx) for (arg = ctx->rule->arg.hlua_rule->args; arg && *arg; arg++) { if (!lua_checkstack(hlua->T, 1)) { SEND_ERR(strm->be, "Lua applet tcp '%s': full stack.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); RESET_SAFE_LJMP(hlua); return -1; } @@ -11025,7 +11025,6 @@ void hlua_applet_tcp_fct(struct appctx *ctx) struct hlua_tcp_ctx *tcp_ctx = ctx->svcctx; struct stconn *sc = appctx_sc(ctx); struct stream *strm = __sc_strm(sc); - struct act_rule *rule = ctx->rule; struct proxy *px = strm->be; struct hlua *hlua = tcp_ctx->hlua; int yield = 0; @@ -11057,35 +11056,35 @@ void hlua_applet_tcp_fct(struct appctx *ctx) /* Display log. */ hlua_lock(hlua); SEND_ERR(px, "Lua applet tcp '%s': %s.\n", - rule->arg.hlua_rule->fcn->name, hlua_tostring_safe(hlua->T, -1)); + ctx->applet->name, hlua_tostring_safe(hlua->T, -1)); lua_pop(hlua->T, 1); hlua_unlock(hlua); goto error; case HLUA_E_ETMOUT: SEND_ERR(px, "Lua applet tcp '%s': execution timeout.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; case HLUA_E_BTMOUT: SEND_ERR(px, "Lua applet tcp '%s': burst timeout.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; case HLUA_E_NOMEM: SEND_ERR(px, "Lua applet tcp '%s': out of memory error.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; case HLUA_E_YIELD: /* unexpected */ SEND_ERR(px, "Lua applet tcp '%s': yield not allowed.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; case HLUA_E_ERR: /* Display log. */ SEND_ERR(px, "Lua applet tcp '%s' return an unknown error.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; default: @@ -11139,7 +11138,7 @@ static int hlua_applet_http_init(struct appctx *ctx) hlua = pool_alloc(pool_head_hlua); if (!hlua) { SEND_ERR(strm->be, "Lua applet http '%s': out of memory.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); return -1; } HLUA_INIT(hlua); @@ -11154,7 +11153,7 @@ static int hlua_applet_http_init(struct appctx *ctx) task = task_new_here(); if (!task) { SEND_ERR(strm->be, "Lua applet http '%s': out of memory.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); return -1; } task->nice = 0; @@ -11169,7 +11168,7 @@ static int hlua_applet_http_init(struct appctx *ctx) */ if (!hlua_ctx_init(hlua, fcn_ref_to_stack_id(ctx->rule->arg.hlua_rule->fcn), task)) { SEND_ERR(strm->be, "Lua applet http '%s': can't initialize Lua context.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); return -1; } @@ -11184,7 +11183,7 @@ static int hlua_applet_http_init(struct appctx *ctx) else error = "critical error"; SEND_ERR(strm->be, "Lua applet http '%s': %s.\n", - ctx->rule->arg.hlua_rule->fcn->name, error); + ctx->applet->name, error); hlua_unlock(hlua); return -1; } @@ -11192,7 +11191,7 @@ static int hlua_applet_http_init(struct appctx *ctx) /* Check stack available size. */ if (!lua_checkstack(hlua->T, 1)) { SEND_ERR(strm->be, "Lua applet http '%s': full stack.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); RESET_SAFE_LJMP(hlua); return -1; } @@ -11203,7 +11202,7 @@ static int hlua_applet_http_init(struct appctx *ctx) /* Create and and push object stream in the stack. */ if (!hlua_applet_http_new(hlua->T, ctx)) { SEND_ERR(strm->be, "Lua applet http '%s': full stack.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); RESET_SAFE_LJMP(hlua); return -1; } @@ -11213,7 +11212,7 @@ static int hlua_applet_http_init(struct appctx *ctx) for (arg = ctx->rule->arg.hlua_rule->args; arg && *arg; arg++) { if (!lua_checkstack(hlua->T, 1)) { SEND_ERR(strm->be, "Lua applet http '%s': full stack.\n", - ctx->rule->arg.hlua_rule->fcn->name); + ctx->applet->name); RESET_SAFE_LJMP(hlua); return -1; } @@ -11236,7 +11235,6 @@ void hlua_applet_http_fct(struct appctx *ctx) struct stream *strm = __sc_strm(sc); struct channel *req = sc_oc(sc); struct channel *res = sc_ic(sc); - struct act_rule *rule = ctx->rule; struct proxy *px = strm->be; struct hlua *hlua = http_ctx->hlua; struct htx *req_htx, *res_htx; @@ -11285,35 +11283,35 @@ void hlua_applet_http_fct(struct appctx *ctx) /* Display log. */ hlua_lock(hlua); SEND_ERR(px, "Lua applet http '%s': %s.\n", - rule->arg.hlua_rule->fcn->name, hlua_tostring_safe(hlua->T, -1)); + ctx->applet->name, hlua_tostring_safe(hlua->T, -1)); lua_pop(hlua->T, 1); hlua_unlock(hlua); goto error; case HLUA_E_ETMOUT: SEND_ERR(px, "Lua applet http '%s': execution timeout.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; case HLUA_E_BTMOUT: SEND_ERR(px, "Lua applet http '%s': burst timeout.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; case HLUA_E_NOMEM: SEND_ERR(px, "Lua applet http '%s': out of memory error.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; case HLUA_E_YIELD: /* unexpected */ SEND_ERR(px, "Lua applet http '%s': yield not allowed.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; case HLUA_E_ERR: /* Display log. */ SEND_ERR(px, "Lua applet http '%s' return an unknown error.\n", - rule->arg.hlua_rule->fcn->name); + ctx->applet->name); goto error; default: