Skip to content

Commit

Permalink
now we disable subrequest in memory by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
agentzh committed Jan 12, 2011
1 parent 2e12518 commit 501c9e4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
9 changes: 6 additions & 3 deletions ngx_http_eval_module.c
Expand Up @@ -211,11 +211,14 @@ ngx_http_eval_handler(ngx_http_request_t *r)
return NGX_DECLINED;
}

dd("status: %d", (int) ctx->status);

return ctx->status;
}

if(ctx->in_progress) {
return NGX_AGAIN;
dd("still in progress");
return NGX_DONE;
}

psr = ngx_palloc(r->pool, sizeof(ngx_http_post_subrequest_t));
Expand Down Expand Up @@ -248,7 +251,7 @@ ngx_http_eval_handler(ngx_http_request_t *r)
psr->handler = ngx_http_eval_post_subrequest_handler;
psr->data = ctx;

flags |= NGX_HTTP_SUBREQUEST_WAITED;
/* flags |= NGX_HTTP_SUBREQUEST_WAITED; */

if (ecf->subrequest_in_memory) {
flags |= NGX_HTTP_SUBREQUEST_IN_MEMORY;
Expand Down Expand Up @@ -555,7 +558,7 @@ ngx_http_eval_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_str_value(conf->override_content_type, prev->override_content_type, "");
ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size, (size_t) ngx_pagesize);
ngx_conf_merge_value(conf->subrequest_in_memory,
prev->subrequest_in_memory, 1);
prev->subrequest_in_memory, 0);

return NGX_CONF_OK;
}
Expand Down
23 changes: 22 additions & 1 deletion test/t/sanity.t
@@ -1,4 +1,4 @@
# vi:filetype=perl
# vi:ft=

use lib 'lib';
use Test::Nginx::Socket;
Expand Down Expand Up @@ -220,3 +220,24 @@ GET /echo
!!! [helloooooooooooooooooooo]
--- timeout: 10
=== TEST 11: eval with subrequest in memory
--- config
location /echo {
eval_subrequest_in_memory on;
eval $a {
proxy_connect_timeout 10ms;
proxy_pass http://www.taobao.com:1234;
}
echo '!!! [$a]';
}
location /hi {
echo hi;
}
--- request
GET /echo
--- response_body
!!! [hi]
--- SKIP

0 comments on commit 501c9e4

Please sign in to comment.