Skip to content

Commit 25f716c

Browse files
committed
update planned version 3.0
Remove respTo feature Add inputs headers feature add output header feature
1 parent 01647c6 commit 25f716c

File tree

5 files changed

+196
-175
lines changed

5 files changed

+196
-175
lines changed

build_test_resources/cfuntest.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,35 @@ void my_app_simple_get_header_param(ngx_http_c_func_ctx_t *ctx) {
8787
}
8888
}
8989

90+
void my_simple_extra_foo_header_input(ngx_http_c_func_ctx_t *ctx) {
91+
92+
ngx_http_c_func_add_header_in(ctx, "foo", sizeof("foo")-1, "foovalue", sizeof("foovalue")-1);
93+
94+
ngx_http_c_func_write_resp(
95+
ctx,
96+
200,
97+
"200 OK",
98+
"text/plain",
99+
"Extra Header foo",
100+
sizeof("Extra Header foo") - 1
101+
);
102+
}
103+
104+
void my_simple_extra_foo_header_output(ngx_http_c_func_ctx_t *ctx) {
105+
106+
ngx_http_c_func_add_header_out(ctx, "foo", sizeof("foo")-1, "foovalue", sizeof("foovalue")-1);
107+
108+
ngx_http_c_func_write_resp(
109+
ctx,
110+
200,
111+
"200 OK",
112+
"text/plain",
113+
"Extra Header foo",
114+
sizeof("Extra Header foo") - 1
115+
);
116+
}
117+
118+
90119
void my_app_simple_get_token_args(ngx_http_c_func_ctx_t *ctx) {
91120
ngx_http_c_func_log(info, ctx, "Calling back and log from my_app_simple_get_token_args");
92121

build_test_resources/sanity_test_raw_parse.t

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ Content-Type: text/plain
132132
qr/This is cache value$/
133133

134134

135-
=== TEST 9: Set C_FUNC_TEST_VARIABLE
135+
=== TEST 9: Set C_FUNC_AIO_THREADS_TEST
136136
--- config
137+
aio threads;
137138
ngx_http_c_func_link_lib "NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH/libcfuntest.so";
138139
location = /testCFunGreeting {
139-
ngx_http_c_func_call "my_app_simple_get_greeting" respTo=myRespVariable;
140-
return 200 $myRespVariable;
140+
ngx_http_c_func_call "my_app_simple_get_greeting";
141141
}
142142
--- request
143143
GET /testCFunGreeting
@@ -148,50 +148,16 @@ Content-Type: text/plain
148148
qr/greeting from ngx_http_c_func testing$/
149149

150150

151-
=== TEST 10: Set C_FUNC_TEST_ARGS_AND_VARIABLE
152-
--- config
153-
ngx_http_c_func_link_lib "NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH/libcfuntest.so";
154-
location = /testCFunARGS {
155-
ngx_http_c_func_call "my_app_simple_get_args" respTo=simpleRespVariable;
156-
return 200 $simpleRespVariable;
157-
}
158-
--- request
159-
GET /testCFunARGS?greeting=hello_nginx?id=129310923
160-
--- error_code: 200
161-
--- response_headers
162-
Content-Type: text/plain
163-
--- response_body_like eval
164-
qr/greeting=hello_nginx\?id=129310923$/
165-
166-
167-
=== TEST 11: Set C_FUNC_AIO_THREADS_TEST_ARGS_AND_VARIABLE
151+
=== TEST 10: Test output headers
168152
--- config
169153
aio threads;
170154
ngx_http_c_func_link_lib "NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH/libcfuntest.so";
171-
location = /testCFunARGS {
172-
ngx_http_c_func_call "my_app_simple_get_args" respTo=simpleRespVariable;
173-
return 200 $simpleRespVariable;
155+
location = /ext_header_foo {
156+
ngx_http_c_func_call "my_simple_extra_foo_header_output";
174157
}
175158
--- request
176-
GET /testCFunARGS?greeting=hello_nginx?id=129310923
159+
GET /ext_header_foo
177160
--- error_code: 200
178161
--- response_headers
179-
Content-Type: text/plain
180-
--- response_body_like eval
181-
qr/greeting=hello_nginx\?id=129310923$/
182-
162+
foo: foovalue
183163

184-
=== TEST 12: Set C_FUNC_AIO_THREADS_TEST
185-
--- config
186-
aio threads;
187-
ngx_http_c_func_link_lib "NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH/libcfuntest.so";
188-
location = /testCFunGreeting {
189-
ngx_http_c_func_call "my_app_simple_get_greeting";
190-
}
191-
--- request
192-
GET /testCFunGreeting
193-
--- error_code: 200
194-
--- response_headers
195-
Content-Type: text/plain
196-
--- response_body_like eval
197-
qr/greeting from ngx_http_c_func testing$/

config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ngx_feature_incs="#include <ngx_http_c_func_module.h>"
2424
ngx_feature_path=
2525
ngx_feature_libs=
2626
# ngx_feature_exit_if_not_found=yes
27-
ngx_feature_test="int ngx_http_c_func_module_current_version_=ngx_http_c_func_module_version_12;"
27+
ngx_feature_test="int ngx_http_c_func_module_current_version_=ngx_http_c_func_module_version_20;"
2828
. auto/feature
2929

3030
if [ $ngx_found != yes ]; then

0 commit comments

Comments
 (0)