Could you  use the nginx interface? like ngx_strlen?
Thanks.