

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
12 messages in ru.sysoev.nginxRe: NGX_AGAIN and POST data| From | Sent On | Attachments |
|---|---|---|
| Brian Bruns | Oct 5, 2008 6:58 pm | |
| Valery Kholodkov | Oct 6, 2008 4:29 am | |
| Brian Bruns | Oct 6, 2008 5:35 am | |
| Valery Kholodkov | Oct 6, 2008 6:53 am | |
| Brian Bruns | Oct 6, 2008 8:05 am | |
| Valery Kholodkov | Oct 6, 2008 8:58 am | |
| Brian Bruns | Oct 7, 2008 10:16 am | |
| Valery Kholodkov | Oct 8, 2008 1:09 am | |
| Brian Bruns | Oct 9, 2008 7:14 am | |
| Valery Kholodkov | Oct 9, 2008 8:18 am | |
| Brian Bruns | Oct 14, 2008 8:08 pm | |
| Brian Bruns | Oct 14, 2008 8:42 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: NGX_AGAIN and POST data | Actions... |
|---|---|---|
| From: | Brian Bruns (bria...@gmail.com) | |
| Date: | Oct 6, 2008 5:35:08 am | |
| List: | ru.sysoev.nginx | |
Ok, now I'm really confused, here is my call to ngx_http_read_client_request_body:
rc = ngx_http_read_client_request_body(r, ngx_http_mymodule_request_body_handler);
If I use any other client (firefox, links, wget) then ngx_http_mymodule_request_body_handler gets called.
Using urllib, which causes the NGX_AGAIN return, I get the following in the log (the first statement is mine after the call to ngx_http_read_client_request_body prior to returning NGX_AGAIN to the caller).
2008/10/06 07:23:37 [alert] 34159#0: *5 failed to read client request body, client: 192.168.16.1, server: localhost, request: "POST /sql HTTP/1.0", host: "192.168.16.1:8081" 2008/10/06 07:23:37 [debug] 34159#0: *5 http finalize request: -2, "/sql?" 2008/10/06 07:23:37 [debug] 34159#0: *5 event timer add: 6: 60000:3525165053 2008/10/06 07:23:37 [debug] 34159#0: timer delta: 1 2008/10/06 07:23:37 [debug] 34159#0: posted events 00000000 2008/10/06 07:23:37 [debug] 34159#0: worker cycle 2008/10/06 07:23:37 [debug] 34159#0: kevent timer: 60000, changes: 0 2008/10/06 07:23:37 [debug] 34159#0: kevent events: 1 2008/10/06 07:23:37 [debug] 34159#0: kevent: 6: ft:-1 fl:0025 ff:00000000 d:84 ud:002280B5 2008/10/06 07:23:37 [debug] 34159#0: *5 http test reading 2008/10/06 07:23:37 [debug] 34159#0: timer delta: 1 2008/10/06 07:23:37 [debug] 34159#0: posted events 00000000 2008/10/06 07:23:37 [debug] 34159#0: worker cycle 2008/10/06 07:23:37 [debug] 34159#0: kevent timer: 59999, changes: 0
My request_body_handler never gets called and the client eventually times out.
Thanks again,
Brian
2008/10/6 Valery Kholodkov <valery+ngin...@grid.net.ru>:
The confusing part to me is the following lines from src/http/ngx_http_core_module.c:
if (r->content_handler) { r->write_event_handler = ngx_http_request_empty_handler; ngx_http_finalize_request(r, r->content_handler(r)); return NGX_OK; }
which appears to (according the debug stuff in the log) simply close out the connection regardless of the return value from content_handler(). Shouldn't my module be getting re-called when more data is available from the connection or am I misunderstanding something?
No. post_handler (the second argument of ngx_http_read_client_request_body) should be called when the body will be successfully received.
ngx_http_finalize_request does not close the connection whenever rc == NGX_AGAIN. Instead ngx_http_read_client_request_body sets read handler to ngx_http_read_client_request_body_handler. Therefore the read handler will be recalled, not your handler.
-- Best regards, Valery Kholodkov







