Hi
I have a module that uses r->internal for detecting if a rewrite has happened. It works fine with nginx rewrite directive or if I use ngx.req.set_uri, but if I use ngx.req.set_uri_args, it doesnt work. I saw that r->internal is not set to 1 for this API. Is there a reason? I "fixed" the code (patch attached) and it works for me but I am not very sure if this was intended or actually a bug. As for my module using r->internal, I could also fix that to use valid_unparsed_uri (or uri_changed - which again is not updated by set_uri_args), but I thought this is the correct place to fix it.
Regards,
+Fasih
diff --git a/lua-nginx-module-0.9.3/src/ngx_http_lua_args.c b/lua-nginx-module-0.9.3/src/ngx_http_lua_args.c
index 35e3d86..c919824 100644
--- a/lua-nginx-module-0.9.3/src/ngx_http_lua_args.c
+++ b/lua-nginx-module-0.9.3/src/ngx_http_lua_args.c
@@ -75,6 +75,19 @@ ngx_http_lua_ngx_req_set_uri_args(lua_State *L)
r->args.len = args.len;
r->valid_unparsed_uri = 0;
+ r->internal = 1;
+ /*
+ * Nginx would also do the following:
+ * r->uri_changed = 1;
+ * r->valid_location = 1;
+ * if uri/args are changed, however the set_uri API for nginx lua
+ * module takes an argument jump, which if not set will not cause
+ * valid_location to change and hence not trigger re-evaluation
+ * of location rules.
+ * Since the parameter is not present, we assume the default to
+ * be false (the default for set_uri). i.e. we will not
+ * re-evaluate the location rules if args are set
+ */
return 0;
}