Skip to content

Commit

Permalink
Merge branch 'master' of github.com:agentzh/memc-nginx-module
Browse files Browse the repository at this point in the history
  • Loading branch information
agentzh committed Dec 17, 2010
2 parents fff295d + 15c9303 commit ceb6a06
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -42,4 +42,3 @@ src/request.h
src/request.c
ctags
nginx
t
4 changes: 3 additions & 1 deletion src/ngx_http_memc_handler.c
Expand Up @@ -195,7 +195,9 @@ ngx_http_memc_handler(ngx_http_request_t *r)
mlcf->upstream.upstream = ngx_http_memc_upstream_add(r, &url);

if (mlcf->upstream.upstream == NULL) {
dd("memc: upstream \"%.*s\" not found", target.len, target.data);
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"memc: upstream \"%V\" not found", &target);

return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ngx_http_memc_module.c
Expand Up @@ -247,7 +247,7 @@ ngx_http_memc_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
static char *
ngx_http_memc_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_memc_loc_conf_t *mlcf = conf;
ngx_http_memc_loc_conf_t *mlcf = conf;

ngx_str_t *value;
ngx_url_t url;
Expand Down
30 changes: 30 additions & 0 deletions test/t/errors.t
@@ -0,0 +1,30 @@
# vi:filetype=perl

use lib 'lib';
use Test::Nginx::LWP;

plan tests => repeat_each() * 2 * blocks();

$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;

#no_diff;

run_tests();

__DATA__
=== TEST 1: empty pass
little-endian systems only
--- http_config eval: $::http_config
--- config
location /memc {
set $memc_key foo;
set $backend "not-exist";
memc_pass $backend;
}
--- request
GET /memc
--- error_code: 500
--- response_body_like: 500 Internal Server Error
3 changes: 2 additions & 1 deletion test/t/stats.t
Expand Up @@ -27,7 +27,8 @@ __DATA__
--- response_body_like: ^(?:STAT [^\r]*\r\n)*END\r\n$
=== TEST 1: timeout
=== TEST 2: timeout
--- config
memc_connect_timeout 10ms;
memc_send_timeout 10ms;
Expand Down
8 changes: 4 additions & 4 deletions util/build.sh
Expand Up @@ -2,7 +2,7 @@

# this file is mostly meant to be used by the author himself.

ragel -I src -G2 src/ngx_http_memc_response.rl
#ragel -I src -G2 src/ngx_http_memc_response.rl

if [ $? != 0 ]; then
echo 'Failed to generate the memcached response parser.' 1>&2
Expand All @@ -25,8 +25,8 @@ if [ ! -s "nginx-$version.tar.gz" ]; then
fi

#tar -xzvf nginx-$version.tar.gz || exit 1
#cp $root/../no-pool-nginx/nginx-0.8.41-no_pool.patch ./
#patch -p0 < nginx-0.8.41-no_pool.patch
#cp $root/../no-pool-nginx/nginx-0.8.53-no_pool.patch ./
#patch -p0 < nginx-0.8.53-no_pool.patch

if [ -n "$2" ]; then
cd nginx-$version-$2/
Expand All @@ -41,7 +41,7 @@ if [[ "$BUILD_CLEAN" -eq 1 || ! -f Makefile || "$root/config" -nt Makefile || "$
--add-module=$root/../ndk-nginx-module \
--add-module=$root/../eval-nginx-module \
--add-module=$root/../echo-nginx-module \
--add-module=$home/work/nginx/ngx_http_upstream_keepalive-2ce9d8a1ca93 \
--add-module=$home/work/nginx/ngx_http_upstream_keepalive-cad8bc39d98d \
--with-debug
#--add-module=$home/work/nginx/nginx_upstream_hash-0.3 \
#--without-http_ssi_module # we cannot disable ssi because echo_location_async depends on it (i dunno why?!)
Expand Down

0 comments on commit ceb6a06

Please sign in to comment.