ngx_http_upstream_response_length_variable, 0,
NGX_HTTP_VAR_NOCACHEABLE, 0 },
+ { ngx_string("upstream_bytes_received"), NULL,
+ ngx_http_upstream_response_length_variable, 1,
+ NGX_HTTP_VAR_NOCACHEABLE, 0 },
+
#if (NGX_HTTP_CACHE)
{ ngx_string("upstream_cache_status"), NULL,
return;
}
+ u->state->bytes_received += n;
+
u->buffer.last += n;
#if 0
return;
}
+ u->state->bytes_received += n;
u->state->response_length += n;
if (u->input_filter(u->input_filter_ctx, n) == NGX_ERROR) {
do_write = 1;
b->last += n;
+ if (from_upstream) {
+ u->state->bytes_received += n;
+ }
+
continue;
}
}
if (n > 0) {
+ u->state->bytes_received += n;
u->state->response_length += n;
if (u->input_filter(u->input_filter_ctx, n) == NGX_ERROR) {
u->state->response_time = ngx_current_msec - u->state->response_time;
if (u->pipe && u->pipe->read_length) {
+ u->state->bytes_received += u->pipe->read_length
+ - u->pipe->preread_size;
u->state->response_length = u->pipe->read_length;
}
}
state = r->upstream_states->elts;
for ( ;; ) {
- p = ngx_sprintf(p, "%O", state[i].response_length);
+
+ if (data == 1) {
+ p = ngx_sprintf(p, "%O", state[i].bytes_received);
+
+ } else {
+ p = ngx_sprintf(p, "%O", state[i].response_length);
+ }
if (++i == r->upstream_states->nelts) {
break;