optimized the default implementation of ngx.headers_sent a bit.