Can not use $bytes_sent in module (complex values)

Maxim Dounin mdounin at
Thu Sep 20 07:52:59 UTC 2012


On Thu, Sep 20, 2012 at 03:43:20AM +0400, Vladimir Shebordaev wrote:

> Wed, 19 Sep 2012 23:11:57 +0200 от Benjamin Grössing <mailtogroe at>:
> >2012/9/20 Benjamin Grössing <mailtogroe at>:
> >
> >Hi Vladimir, hi Maxim!
> >
> >Thanks for your answers. I've had a look at the rewrite module -
> >unfortunately it does not support the $bytes_sent variable either as
> >configuring "if ($bytes_sent) { }" throws the error: [emerg] unknown
> >"bytes_sent" variable.
> Yes, this is what the indexed variables are. They have no name 
> at runtime and accessed by the index into the request->variables 
> array by the script engine that is to evaluate a complex value 
> and if conditionals. This is faster to do, since it helps to 
> avoid the cmcf->variables_hash lookup and a memory allocation at 
> evaluation time having the space for the value reserved at the 
> request initialization time. But the index value must be known 
> to the rewrite module at the configuration time.

No.  The $bytes_sent variable isn't actually variable at all: it's 
only available in log module via it's own machinery, not as a 
generic variable.  It's completely unrelated to indexed variables 


Maxim Dounin

More information about the nginx-devel mailing list