Post action after client closes connection

Mobczynski Mobczynski lists at ruby-forum.com
Wed Apr 29 18:48:53 MSD 2009


Hello,
This is my scenario:
* client connects to nginx (proxy_ignore_client_abort is on at this
location)
* nginx sends data from upstream (received by subrequests) back to
client
* when request finishes I want to send confirmation using GET method to
other upstream
Everything is ok when client downloads all data, then I'm using:
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
clcf->post_action = location of upstream
and rest is done during finalization of main request. Great.

The problem is when client closes connection during download. If it
happens during main request it is handled properly:

2009/04/29 15:09:46 [debug] 13740#0: *7 http test reading
2009/04/29 15:09:46 [info] 13740#0: *7 client closed prematurely
connection, client: 127.0.0.1, server: localhost, request: "GET
/download/plik2 HTTP/1.0", upstream:
"http://192.168.0.3:80/prox.php?file=plik2", host: "localhost"
2009/04/29 15:09:46 [debug] 13740#0: *7 http finalize request: 0,
"/prox.php?file=plik2"
2009/04/29 15:09:46 [debug] 13740#0: *7 post action:
"/postdownload/file/user/status"
2009/04/29 15:09:46 [debug] 13740#0: *7 internal redirect:
"/postdownload/file/user/status?"

But if it happens during subrequest, post action isn't activated:

2009/04/29 13:55:06 [debug] 12147#0: *13 http test reading
2009/04/29 13:55:06 [info] 12147#0: *13 client closed prematurely
connection, client: 127.0.0.1, server: localhost, request: "GET
/download/plik2 HTTP/1.0", subrequest: "/send", host: "localhost"
2009/04/29 13:55:06 [debug] 12147#0: *13 http finalize request: 0,
"/send?"
2009/04/29 13:55:06 [debug] 12147#0: *13 http close request
2009/04/29 13:55:06 [debug] 12147#0: *13 http log handler
2009/04/29 13:55:06 [debug] 12147#0: *13 free: 08FA3660

I have even tried setting own handler for ngx_http_post_subrequest_t in
subrequest and initate from it another subrequest to upstream to confirm
download status, but then it doesn't seem to work (nothing is sent).

Any ideas?

Thanks in advance,
mobczynski
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list