]> git.kaiwu.me - nginx.git/commitdiff
Limit req: rate should be non-zero.
authorValentin Bartenev <vbart@nginx.com>
Wed, 3 Apr 2013 14:13:35 +0000 (14:13 +0000)
committerValentin Bartenev <vbart@nginx.com>
Wed, 3 Apr 2013 14:13:35 +0000 (14:13 +0000)
Specifying zero rate caused division by zero when calculating delays.

src/http/modules/ngx_http_limit_req_module.c

index 934292e7f1c4e1ae6049600194647447a36706ec..90434c956a6f418b3898efdc4118474557029df0 100644 (file)
@@ -795,7 +795,7 @@ ngx_http_limit_req_zone(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
             }
 
             rate = ngx_atoi(value[i].data + 5, len - 5);
-            if (rate <= NGX_ERROR) {
+            if (rate <= 0) {
                 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                                    "invalid rate \"%V\"", &value[i]);
                 return NGX_CONF_ERROR;