From 2ca3f6ecfe7b731a440d5f4c772141fe57682c60 Mon Sep 17 00:00:00 2001 From: dedok Date: Thu, 22 Jun 2017 22:22:51 +0300 Subject: [PATCH] #84 - fixed. And test case added. --- src/ngx_http_tnt_version.h | 2 +- src/tp_transcode.c | 8 ++++++-- test/ngx_confs/tnt_server_test.conf | 11 ++++++++++- test/test.lua | 4 ++++ test/v24_features.py | 7 +++++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/ngx_http_tnt_version.h b/src/ngx_http_tnt_version.h index 03f5209..d672e29 100644 --- a/src/ngx_http_tnt_version.h +++ b/src/ngx_http_tnt_version.h @@ -33,6 +33,6 @@ #ifndef NGX_HTTP_TNT_VERSION_H #define NGX_HTTP_TNT_VERSION_H 1 -#define NGX_HTTP_TNT_MODULE_VERSION_STRING "v2.4.0-beta" +#define NGX_HTTP_TNT_MODULE_VERSION_STRING "v2.4.2-beta" #endif diff --git a/src/tp_transcode.c b/src/tp_transcode.c index d378590..b48a3ac 100644 --- a/src/tp_transcode.c +++ b/src/tp_transcode.c @@ -76,7 +76,7 @@ say_error_(tp_transcode_t *t, int code, const char *e, size_t len) } #define say_error(ctx, c, e) \ - dd("line:%d, code:%d, msg:%s", __LINE__, c, e); \ + dd("line:%d, code:%d, msg:%s\n", __LINE__, c, e); \ say_error_((ctx)->tc, (c), (e), sizeof(e) - 1) #define say_error_r(ctx, c, e) do { \ @@ -115,7 +115,11 @@ enum stage { typedef struct { char *ptr; - int16_t count; + /** + * The count should be more than uint16_t! + * https://github.com/tarantool/nginx_upstream_module/issues/84 + */ + int32_t count; uint16_t type; } stack_item_t; diff --git a/test/ngx_confs/tnt_server_test.conf b/test/ngx_confs/tnt_server_test.conf index e2df4ff..2876ad7 100644 --- a/test/ngx_confs/tnt_server_test.conf +++ b/test/ngx_confs/tnt_server_test.conf @@ -6,7 +6,7 @@ http { include mime.types; default_type application/octet-stream; - client_body_buffer_size 10K; + client_body_buffer_size 10m; client_header_buffer_size 1k; client_max_body_size 64m; large_client_header_buffers 2 1k; @@ -309,5 +309,14 @@ http { return 200 $tnt_res; } + location /echo_big { + tnt_pass_http_request_buffer_size 1m; + tnt_method echo_big; + tnt_pass_http_request on parse_args; + tnt_http_rest_methods all; + tnt_http_methods all; + tnt_pass tnt; + } + } } diff --git a/test/test.lua b/test/test.lua index b1de5fe..add9f67 100755 --- a/test/test.lua +++ b/test/test.lua @@ -20,6 +20,10 @@ function rest_api_get(a, b) return echo_2(a, b) end +function echo_big(...) + return ... +end + function ret_4096() local out = {} for i = 0, 801 do diff --git a/test/v24_features.py b/test/v24_features.py index 7c606cb..25070c4 100755 --- a/test/v24_features.py +++ b/test/v24_features.py @@ -78,3 +78,10 @@ key = 'a' + str(i) data[key] = 'b' #post_form_ec500(preset_method_location, data, None, default_print_f) + +data = {'params': [{'array': []}]} +for i in range(100000): + data['params'][0]['array'].append(i) +(code, ret) = post(BASE_URL + '/echo_big', data, None) +assert(code == 200), 'expected 200' +assert(ret[1] == data['params'][0])