(gdb) bt
#0 ngx_http_run_posted_requests (c=0x78c2c0e0) at src/http/ngx_http_request.c:2211
#1 0x0808f8f3 in ngx_http_process_request (r=0x8873e38) at src/http/ngx_http_request.c:1913
#2 0x0808e87c in ngx_http_process_request_headers (rev=0x78bb3068) at src/http/ngx_http_request.c:1342
#3 0x0808de66 in ngx_http_process_request_line (rev=0x78bb3068) at src/http/ngx_http_request.c:1022
#4 0x08091a04 in ngx_http_keepalive_handler (rev=0x78bb3068) at src/http/ngx_http_request.c:3196
#5 0x0807f709 in ngx_epoll_process_events (cycle=0x886e5e8, timer=65000, flags=1) at src/event/modules/ngx_epoll_module.c:822
#6 0x0807368b in ngx_process_events_and_timers (cycle=0x886e5e8) at src/event/ngx_event.c:242
#7 0x0807da01 in ngx_worker_process_cycle (cycle=0x886e5e8, data=0x0) at src/os/unix/ngx_process_cycle.c:753
#8 0x0807af4b in ngx_spawn_process (cycle=0x886e5e8, proc=0x807d93e <ngx_worker_process_cycle>, data=0x0, name=0x80fc3cf "worker process",
respawn=-3) at src/os/unix/ngx_process.c:198
#9 0x0807cd08 in ngx_start_worker_processes (cycle=0x886e5e8, n=1, type=-3) at src/os/unix/ngx_process_cycle.c:358
#10 0x0807c56e in ngx_master_process_cycle (cycle=0x886e5e8) at src/os/unix/ngx_process_cycle.c:130
#11 0x08051626 in main (argc=1, argv=0xbff35874) at src/core/nginx.c:367
追踪之后处理流程如上,观察下向浏览器是怎么返回所请求的文件的
<pre name="code" class="cpp">void
ngx_http_run_posted_requests(ngx_connection_t *c)
{
ngx_http_request_t *r;
ngx_http_posted_request_t *pr;
for ( ;; ) {
if (c->destroyed) {
return;
}
r = c->data;
pr = r->main->posted_requests;
if (pr == NULL) {
return;
}
r->main->posted_requests = pr->next;
r = pr->request;
ngx_http_set_log_request(c->log, r);
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
"http posted request: \"%V?%V\"", &r->uri, &r->args);
r->write_event_handler(r);
}
}