Skip to content

Commit d791d36

Browse files
wpjunioru5surf
authored andcommitted
fix: adjust status code slot calculation to reserve slot for other status codes
1 parent febcf07 commit d791d36

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ngx_http_vhost_traffic_status_shm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ ngx_http_vhost_traffic_status_shm_add_node(ngx_http_request_t *r,
109109
status_code_slot = 0;
110110
if (ctx->measure_all_status_codes) {
111111
if (r->headers_out.status >= 100 && r->headers_out.status < 600) {
112-
status_code_slot = r->headers_out.status - 100;
112+
// slot 0 is reserved to other status codes <100 and >600
113+
status_code_slot = r->headers_out.status - 99;
113114
}
114115
} else if (ctx->measure_status_codes != NULL) {
115116
status_code_slot = ngx_http_vhost_traffic_status_find_status_code_slot(r->headers_out.status,

0 commit comments

Comments
 (0)