Forum: NGINX ngx_http_upstream_status_variable question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
De7b680154f831d87d8ea48743852f14?d=identicon&s=25 gaoyan09 (Guest)
on 2016-07-20 11:33
(Received via mailing list)
ngx_http_upstream_status_variable

len = r->upstream_states->nelts * (3 + 2);

write status to string, one status str len would be 3 in most case, like
200, 302, 404....
but if upstream multi times, may be add ' : ' as separator

so, string len may be nelts*3 + (nelts-1)*3 = 6nelts - 3 != nelts * (3 +
2);

what's wrong here?

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,268369,268369#msg-268369
De7b680154f831d87d8ea48743852f14?d=identicon&s=25 gaoyan09 (Guest)
on 2016-07-20 16:04
(Received via mailing list)
also ngx_http_upstream_response_time_variable and
ngx_http_upstream_response_length_variable, + 2 for separator

if (state[i].peer) {
            *p++ = ',';
            *p++ = ' ';

        } else {
            *p++ = ' ';
            *p++ = ':';
            *p++ = ' ';

            if (++i == r->upstream_states->nelts) {
                break;
            }

            continue;
        }

it can be 3 bytes, right?

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,268369,268374#msg-268374
De7b680154f831d87d8ea48743852f14?d=identicon&s=25 gaoyan09 (Guest)
on 2016-07-20 16:40
(Received via mailing list)
figure it out, would jump one position for 3 bytes separator

Posted at Nginx Forum:
https://forum.nginx.org/read.php?2,268369,268379#msg-268379
This topic is locked and can not be replied to.