Hello!
On Thu, Oct 4, 2012 at 11:35 PM, peter kim wrote:
>
> hi, thank you for your prompt reply.
>
> i have been checked lua_module source code. many times...
> but i look alike my source code.
> (ngx_http_read_client_request_body(r,
> ngx_testmodule_post_read_request_body)...)
> or.. i didn't find different it.
>
Not just like this. You have to take into account r->main->count and
error handling. I suggest you look *harder* at ngx_lua or
ngx_form_input's related source code. Also, if you insist in Nginx C
programming, then you're highly recommended to use my development and
testing toolchain, which consists of Test::Nginx::Socket [1],
mockeagain [2], valgrind [3], the Nginx SystemTap Toolkit [4] (if
you're on Linux), and etc. These tools have saved me huge hours in
detecting and fixing bugs in my Nginx C code.
As I've said, the standard request body reader (i.e.,
ngx_http_read_client_request_body) will always buffer the whole
request first (either in memory or on disk), so it's more efficient to
just use Lua and call the ngx.req.socket() API providied by ngx_lua.
> i wish to see something with your source code...
> Maybe.. you are very busy...
> i hope that's convenient for you.
> i was filled with the desire to see your source code(get to the post data)
>
I suggest you stop struggling with Nginx C programming and just enjoy
the efficiency and flexibility of Lua provided by ngx_lua. "C
programming is hard; let's go scripting!"
I'm still cc'ing the openresty-en mailing list:
http://groups.google.com/group/openresty-en because I don't feel like
replying to off-list emails very much ;)
Best regards,
-agentzh
[1] http://search.cpan.org/perldoc?Test::Nginx::Socket
[2] https://github.com/agentzh/mockeagain
[3] http://valgrind.org/
[4] https://github.com/agentzh/nginx-systemtap-toolkit