nginx字节发送和请求长度变量是否包括tcp和tls头?
nginx字节发送和请求长度变量是否包括tcp和tls头 $bytes_sent:发送到客户端的字节数(1.3.8、1.2.5) $request_length:请求长度(包括请求行、标题和请求正文)(1.3.12、1.2.7) 若并没有,那个么如何获得从客户端接收到的准确字节和发送到客户端的字节呢nginx字节发送和请求长度变量是否包括tcp和tls头?,nginx,Nginx,nginx字节发送和请求长度变量是否包括tcp和tls头 $bytes_sent:发送到客户端的字节数(1.3.8、1.2.5) $request_length:请求长度(包括请求行、标题和请求正文)(1.3.12、1.2.7) 若并没有,那个么如何获得从客户端接收到的准确字节和发送到客户端的字节呢 static ngx_int_t ngx_http_variable_bytes_sent(ngx_http_request_t *r, ngx_http_variable_value_t
static ngx_int_t
ngx_http_variable_bytes_sent(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
u_char *p;
p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
if (p == NULL) {
return NGX_ERROR;
}
v->len = ngx_sprintf(p, "%O", r->connection->sent) - p;
v->valid = 1;
v->no_cacheable = 0;
v->not_found = 0;
v->data = p;
return NGX_OK;
}
static ngx_int_t
ngx_http_variable_request_length(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
u_char *p;
p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
if (p == NULL) {
return NGX_ERROR;
}
v->len = ngx_sprintf(p, "%O", r->request_length) - p;
v->valid = 1;
v->no_cacheable = 0;
v->not_found = 0;
v->data = p;
return NGX_OK;
}