Skip to content

Commit b610f1a

Browse files
committed
#69 - is not a bug, but I've implemented a test case, I dunno why I did this
1 parent d477881 commit b610f1a

File tree

4 files changed

+51
-13
lines changed

4 files changed

+51
-13
lines changed

test/basic_features.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,10 @@ def batch_cases():
210210
'id': 555
211211
})
212212

213-
## TODO fix
214-
#(rc, res) = request({
215-
# 'params': [],
216-
# 'id': 555
217-
# })
218-
219-
print '[OK] Regualr cases'
213+
print '[+] Regular cases'
220214

221215
## Segfault regress
222216
print "[+] Regualr regress cases"
223-
224217
(rc, res) = request_raw('[{"method":"call", "params":["name"], "i');
225218
assert(rc == 400), 'expected 400'
226219
assert_if_not_error(res, -32700)
@@ -229,13 +222,12 @@ def batch_cases():
229222
assert(rc == 400), 'expected 400'
230223
assert_if_not_error(res, -32700)
231224

232-
print '[OK] Segfautl regress cases'
233-
225+
print '[+] Segfautl regress cases'
234226
(rc, res) = request_raw('[{"');
235227
assert(rc == 400), 'expected 400'
236228
assert_if_not_error(res, -32700)
237229

238-
print '[OK] PWN cases'
230+
print '[+] PWN cases'
239231
(rc, res) = request_raw('[]');
240232
assert(rc == 400), 'expected 400'
241233

test/large_request.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/python
2+
# -_- encoding: utf8 -_-
3+
4+
import sys
5+
sys.path.append('./test')
6+
from http_utils import *
7+
8+
BASE_URL = "http://0.0.0.0:8081/issue_59"
9+
err_msg = { 'error': { 'message':
10+
"Request too large, consider increasing your " +
11+
"server's setting 'client_body_buffer_size'",
12+
'code': -32001 } }
13+
14+
preset_method_location = BASE_URL + '/rest_api_parse_query_args'
15+
16+
obj = {}
17+
for i in range(1, 10000):
18+
obj[str(i) + 'some_key_name'] = [ i, { 'n': i,
19+
'some_key_name': [[1,2,3],[4]]}]
20+
for i in range(1, 10000):
21+
code, result = post(preset_method_location, { 'params': [obj] }, {})
22+
assert(code == 400), 'expected 400'
23+
assert(result == err_msg), 'expected error msg (too large)'
24+
25+
expected = obj[str(i) + 'some_key_name']
26+
result = post_success(preset_method_location, { 'params': expected }, {})
27+
assert(result[1] == expected), 'expected != result (too large)'

test/ngx_confs/tnt_server_test.conf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
http {
22

3-
autoindex off;
3+
autoindex off;
44
access_log off;
55

66
include mime.types;
@@ -18,7 +18,7 @@ http {
1818

1919
upstream tnt {
2020
server 127.0.0.1:9999 max_fails=1 fail_timeout=1s;
21-
keepalive 1;
21+
keepalive 10;
2222
}
2323

2424
server {
@@ -174,5 +174,15 @@ http {
174174
tnt_pass tnt;
175175
}
176176
# ]]
177+
178+
# QUASTION, BUG --
179+
# https://github.com/tarantool/nginx_upstream_module/issues/69 [[
180+
location /issue_59 {
181+
tnt_pass_http_request on parse_args;
182+
tnt_http_rest_methods post get;
183+
tnt_pass tnt;
184+
}
185+
# ]]
186+
177187
}
178188
}

test/test.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,12 @@ function update(request)
109109
return request
110110
end
111111
-- ]]
112+
113+
function delete()
114+
return "ok"
115+
end
116+
117+
function issue_59(request, ...)
118+
return { request, {...} }
119+
end
120+

0 commit comments

Comments
 (0)