Re: Flushing responses in nginx modules

2017-07-12 Thread Zhang Chao
Hi! I think you can debug your code with gdb, maybe some other modules or filters prevent sending the data. On 11 July 2017 at 22:57:50, Johan Andersson (n...@firemail.cc) wrote: Hi Andreas and Zhang, Thank you for your hint with the http_echo_module! I read through their code to get a hang of

Re: Flushing responses in nginx modules

2017-07-11 Thread Johan Andersson
Hi Andreas and Zhang, Thank you for your hint with the http_echo_module! I read through their code to get a hang of how the event loop and the event handling actually works. If I replace the hello_world command in my config files with the echo/echo_flush/echo_sleep commands, everything works

Re: Flushing responses in nginx modules

2017-07-09 Thread Zhang Chao
Hello! You mustn’t use standard sleep function for it will block Nginx’s events loop, alternatively, you need to put your write event to a timer, set the proper handler when the timer expires. BTW, you should always check the return value of ngx_http_send_header and ngx_http_output_filter. On 10

Re: Flushing responses in nginx modules

2017-07-09 Thread A. Schulze
Am 09.07.2017 um 19:43 schrieb Johan Andersson: > Actually I was flushing each response, so I expected each "hello world" > message to appear one after the other, with one second pause between them. You may have a look at https://github.com/openresty/echo-nginx-module As far as I know they solv

Flushing responses in nginx modules

2017-07-09 Thread Johan Andersson
Hi everyone, I have some issues writing my nginx modules. I am on Debian Stretch, installed nginx with the default configuration, and took the hello_world module. It works without a hitch. Then I changed the handler to send three "hello world" responses, and sleep for one second between each