首页 > 系统相关 >Nginx读取后端服务响应数据流程

Nginx读取后端服务响应数据流程

时间:2023-01-26 21:57:35浏览次数:37  
标签:src http 读取 流程 Nginx handler upstream ngx

gdb attach [worker进程号]

在指定文件的898行打上断点
b src/event/modules/ngx_epoll_module.c:898

客户端发送请求

按3次c以后,按n(函数单行执行)和s(函数逐行执行)单步调试

确定函数调用过程

上一步调用函数代码

下一步被调函数位置

rev->handler(rev);

src/http/ngx_http_upstream.c

ngx_http_upstream_handler

u->read_event_handler(r, u);

src/http/ngx_http_upstream.c

ngx_http_upstream_process_header

n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last);

src/os/unix/ngx_recv.c

ngx_unix_recv

n的值是119

具体内容是

确定响应结果开始位置

src/http/ngx_http_upstream.c

说明Nginx响应客户端body数据来自epoll_wait。

标签:src,http,读取,流程,Nginx,handler,upstream,ngx
From: https://www.cnblogs.com/WJQ2017/p/17068287.html

相关文章