Skip to content

Commit 494ce38

Browse files
committed
Add args escaping if parse_args is on
1 parent 07b4ad0 commit 494ce38

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

src/ngx_http_tnt_handlers.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,16 @@ ngx_http_tnt_encode_query_args(
405405
if (arg.value && value_len > 0) {
406406

407407
++(*args_items);
408-
if (!tp_encode_str_map_item(tp,
409-
(const char *)arg_begin,
410-
arg.value - arg_begin - 1,
411-
(const char *)arg.value, value_len))
408+
409+
if (ngx_http_tnt_encode_str_map_item(r, tlcf, tp,
410+
arg_begin,
411+
arg.value - arg_begin - 1,
412+
arg.value,
413+
value_len) != NGX_OK)
412414
{
413-
dd("parse args: tp_encode_str_map_item failed");
414415
return NGX_ERROR;
415416
}
417+
416418
}
417419
arg_begin = ++arg.it;
418420
}
@@ -516,6 +518,11 @@ ngx_http_tnt_get_request_data(ngx_http_request_t *r,
516518
return NGX_ERROR;
517519
}
518520

521+
// XXX set_header
522+
#if 0
523+
ngx_http_script_flush_no_cacheable_variables(r, tlcf->headers.flushes);
524+
#endif
525+
519526
if (ngx_http_tnt_copy_headers(tp, &r->headers_in.headers, &map_items) ==
520527
NGX_ERROR)
521528
{

src/ngx_http_tnt_handlers.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* Copyright (C) 2015-2016 Tarantool AUTHORS:
29+
* Copyright (C) 2015-2017 Tarantool AUTHORS:
3030
* please see AUTHORS file.
3131
*/
3232

@@ -47,6 +47,13 @@ typedef enum ngx_tnt_conf_states {
4747
NGX_TNT_CONF_PASS_HEADERS_OUT = 32,
4848
} ngx_tnt_conf_states_e;
4949

50+
typedef struct {
51+
ngx_array_t *flushes;
52+
ngx_array_t *lengths;
53+
ngx_array_t *values;
54+
ngx_hash_t hash;
55+
} ngx_http_tnt_headers_t;
56+
5057
/** The structure hold the nginx location variables, e.g. loc_conf.
5158
*/
5259
typedef struct {
@@ -118,6 +125,8 @@ typedef struct {
118125

119126
ngx_array_t *headers_source;
120127

128+
ngx_http_tnt_headers_t headers;
129+
121130
} ngx_http_tnt_loc_conf_t;
122131

123132

src/ngx_http_tnt_module.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* Copyright (C) 2015-2016 Tarantool AUTHORS:
29+
* Copyright (C) 2015-2017 Tarantool AUTHORS:
3030
* please see AUTHORS file.
3131
*/
3232

@@ -36,7 +36,6 @@
3636
#include <ngx_http_tnt_version.h>
3737
#include <ngx_http_tnt_handlers.h>
3838

39-
4039
/** Filters
4140
*/
4241

@@ -111,6 +110,7 @@ static ngx_conf_bitmask_t ngx_http_tnt_methods[] = {
111110
{ ngx_null_string, 0 }
112111
};
113112

113+
114114
static ngx_command_t ngx_http_tnt_commands[] = {
115115

116116
{ ngx_string("tnt_pass"),
@@ -473,6 +473,11 @@ ngx_http_tnt_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
473473
(NGX_HTTP_POST
474474
|NGX_HTTP_DELETE));
475475

476+
if (conf->headers_source == NULL) {
477+
conf->headers = prev->headers;
478+
conf->headers_source = prev->headers_source;
479+
}
480+
476481
/** Experimental, see conf commands description [[
477482
*/
478483
ngx_conf_merge_bitmask_value(conf->pure_result,

src/ngx_http_tnt_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
#ifndef NGX_HTTP_TNT_VERSION_H
3434
#define NGX_HTTP_TNT_VERSION_H 1
3535

36-
#define NGX_HTTP_TNT_MODULE_VERSION_STRING "v2.3.2"
36+
#define NGX_HTTP_TNT_MODULE_VERSION_STRING "v2.3.5"
3737

3838
#endif

0 commit comments

Comments
 (0)