Permalink
Browse files

report an error message when upstream name not found for drizzle_pass.

  • Loading branch information...
1 parent c7332ab commit abc92d1916bde941e2d885e6638386b2dd834c0b @agentzh agentzh committed Dec 2, 2010
Showing with 20 additions and 0 deletions.
  1. +3 −0 src/ngx_http_drizzle_handler.c
  2. +17 −0 test/t/errors.t
View
3 src/ngx_http_drizzle_handler.c
@@ -118,6 +118,9 @@ ngx_http_drizzle_handler(ngx_http_request_t *r)
dlcf->upstream.upstream = ngx_http_upstream_drizzle_add(r, &url);
if (dlcf->upstream.upstream == NULL) {
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
+ "upstream \"%V\" not found", &target);
+
//dd("upstream \"%.*s\" not found", target.len, target.data);
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
View
17 test/t/errors.t
@@ -156,3 +156,20 @@ little-endian systems only
GET /mysql
--- error_code: 500
+
+
+=== TEST 8: empty pass
+little-endian systems only
+
+--- http_config eval: $::http_config
+--- config
+ location /mysql {
+ set $backend "not-exist";
+ drizzle_pass $backend;
+ drizzle_module_header off;
+ drizzle_query "update cats set name='bob' where name='bob'";
+ }
+--- request
+GET /mysql
+--- error_code: 500
+

0 comments on commit abc92d1

Please sign in to comment.