Cancel ongoing ngx_http_request_t

donatasm nginx-forum at nginx.us
Thu May 21 14:19:32 UTC 2015


So I'm continuing to work on my simple timeout module:
http://forum.nginx.org/read.php?2,259019

Now, when timer elapses, I want to cancel ongoing http request, here's my
timer handler:

static void simple_timeout_handler(ngx_event_t* timeout_event)
{
  ngx_http_request_t* request = (ngx_http_request_t*)timeout_event->data;

  ngx_log_debug0(NGX_LOG_DEBUG_HTTP, timeout_event->log, 0,
       "SIMPLE TIMEOUT TIMER END"); 

  ngx_http_finalize_request(request, NGX_HTTP_REQUEST_TIME_OUT); // this
does not seem to work,
  // as request stays in progress
}

This does not work as request still continues to be in progress. Is it
possible to terminate it immediately, and return http timeout response?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,259045,259045#msg-259045



More information about the nginx mailing list