Permalink
Browse files

tweaked 3 alert-level log messages.

  • Loading branch information...
1 parent 845ff07 commit 69b0c930b137e1cd433bee3fe8f3bf7b06622ef2 @agentzh agentzh committed Sep 2, 2013
Showing with 14 additions and 9 deletions.
  1. +7 −8 src/ngx_http_memc_handler.c
  2. +7 −1 t/cmd.t
@@ -115,10 +115,9 @@ ngx_http_memc_handler(ngx_http_request_t *r)
memc_cmd = ngx_http_memc_cmd_delete;
} else {
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- "ngx_memc: $memc_cmd variable requires explicit "
- "assignment for HTTP request method %V",
- &r->method_name);
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "ngx_memc: $memc_cmd variable not found for HTTP "
+ "%V requests", &r->method_name);
return NGX_HTTP_BAD_REQUEST;
}
@@ -127,7 +126,7 @@ ngx_http_memc_handler(ngx_http_request_t *r)
&is_storage_cmd);
if (memc_cmd == ngx_http_memc_cmd_unknown) {
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"ngx_memc: unknown $memc_cmd \"%v\"", cmd_vv);
return NGX_HTTP_BAD_REQUEST;
}
@@ -138,9 +137,9 @@ ngx_http_memc_handler(ngx_http_request_t *r)
dd("XXX connect timeout %d", (int) mlcf->upstream.connect_timeout);
if (!ngx_http_memc_in_cmds_allowed(mlcf, memc_cmd)) {
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
- "ngx_memc: User requests to run memcached command "
- "\"%v\"", cmd_vv);
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "ngx_memc: memcached command \"%v\" not allowed",
+ cmd_vv);
return NGX_HTTP_FORBIDDEN;
}
View
@@ -3,7 +3,7 @@
use lib 'lib';
use Test::Nginx::Socket;
-plan tests => repeat_each() * 2 * blocks();
+plan tests => repeat_each() * (2 * blocks() + 3);
$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;
@@ -24,6 +24,8 @@ __DATA__
GET /foo
--- response_body_like: 400 Bad Request
--- error_code: 400
+--- error_log
+ngx_memc: unknown $memc_cmd "blah"
@@ -37,6 +39,8 @@ __DATA__
COPY /foo
--- response_body_like: 400 Bad Request
--- error_code: 400
+--- error_log
+ngx_memc: $memc_cmd variable not found for HTTP COPY requests
@@ -94,6 +98,8 @@ __DATA__
GET /allow
--- response_body_like: 403 Forbidden
--- error_code: 403
+--- error_log
+ngx_memc: memcached command "version" not allowed

0 comments on commit 69b0c93

Please sign in to comment.