In my own C module I run a pre-access filter that uses `
ngx_http_read_client_request_body_handler` to load the request body on the request struct. In this case it is a multipart form.
I don't discard this body, I leave it on the request. When an openresty module runs (say, resty.upload), openresty throws an error say "request body already exists"
It is in this code in lua_socket_tcp:
if (r->request_body) {
lua_pushnil(L);
lua_pushliteral(L, "request body already exists");
return 2;
}
The request body isn't being consumed or discarded, so I'd like for it to be used by both my preaccess filter and the lua module.
Is there any way to reset the state of the request struct so the lua module doesn't throw an error? Any reason why the lua module can't use the request_body struct if it is already there?
Thanks