Profil de agentzhHuman & MachinePhotosBlogListesPlus ![]() | Aide |
|
15 octobre Hacking on the Nginx echo module Over the recent weeks, I've been reading a lot of Nginx and its modules' C source code and it's really enjoyable. I've got lots of good ideas in implementing the next generation of OpenResty server based on the Nginx architecture. Well, it's currently my full-time $work anyway. For the sake of testing other modules, experimenting the Nginx internals, and for fun, I've started my first Nginx module named "echo": http://github.com/agentzh/echo-nginx-module It's already quite usable, and it also has a declarative test suite based on Perl's Test::Base. At the moment, LWP is used for simplicity and it's rather weak in testing streaming behavior of Nginx (I'm using "curl" to test these aspects manually for now). I'm considering coding up my own Perl HTTP client library based on IO::Select and IO::Socket (there might be already one around?). Along the way, I'm intentionally heavily commenting my C source in this "echo" module in the hope that newcomers would find it a "live tutorial" or something like that. I'll write more about the details here in subsequent posts. After all, it's able to do a lot more thingies other than just "echo" stuffs directly, such as sleeping and flushing output buffer. And it will be capable of outputing subrequests' responses as well. Happy hacking Nginx C modules and stay tuned! Update: I've also added a wiki page for it: http://wiki.nginx.org/NginxHttpEchoModule |
|
|