perl help

Igor Sysoev is at rambler-co.ru
Sat Feb 7 12:57:06 MSK 2009


On Fri, Feb 06, 2009 at 09:36:41PM +1030, Kingsley Foreman wrote:

> getting there,
> 
> I have a new error now :)
> 
> 2009/02/06 21:35:23 [emerg] 10444#0: "proxy_set_header" directive is not 
> allowed here in /etc/nginx/nginx.conf:112
> 2009/02/06 21:35:23 [emerg] 10444#0: the configuration file 
> /etc/nginx/nginx.conf test failed
> 
> however it works if the if statement isn't there.

Something like this:

       set  $range  $http_range;

       if ($arg_bitstart ~ ^[1-9]\d+$) {
           set   $range  $arg_bitstart;
       }

       proxy_pass  ...;

       proxy_set_header  Content-Range  $range;
       proxy_set_header  Range          $range;

> Kingsley
> 
> --------------------------------------------------
> From: "Igor Sysoev" <is at rambler-co.ru>
> Sent: Friday, February 06, 2009 8:53 PM
> To: <nginx at sysoev.ru>
> Subject: Re: perl help
> 
> >On Fri, Feb 06, 2009 at 01:12:50PM +0300, Igor Sysoev wrote:
> >
> >>On Fri, Feb 06, 2009 at 11:16:02AM +1030, kingsley at internode.com.au 
> >>wrote:
> >>
> >>> Great that mostly helped however
> >>>
> >>>
> >>>                        if ($arg_bitstart && $arg_bitstart != 0){
> >>>                                proxy_set_header  Content-Range
> >>> bytes=$arg_bitstart-;
> >>>                                proxy_set_header  Range
> >>> bytes=$arg_bitstart-;
> >>>                        }
> >>>
> >>> I get this error
> >>>
> >>> 2009/02/06 11:12:38 [emerg] 31739#0: invalid condition "$arg_bitstart" 
> >>> in
> >>> /etc/nginx/nginx.conf:111
> >>> 2009/02/06 11:12:38 [emerg] 31739#0: the configuration file
> >>> /etc/nginx/nginx.conf test failed
> >>
> >>nginx curerently does not support "&&", etc inside "if".
> >>
> >>However, in this case
> >>
> >>       if ($arg_bitstart) {
> >>
> >>is enough as both "" and "0" are false.
> >>The more stronger test is:
> >>
> >>       if ($arg_bitstart ~ [1-9]\d+) {
> >
> >-        if ($arg_bitstart ~ [1-9]\d+) {
> >+        if ($arg_bitstart ~ ^[1-9]\d+$) {
> >
> >
> >-- 
> >Igor Sysoev
> >http://sysoev.ru/en/
> >
> >

-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list