Skip to content

Commit 7fc4159

Browse files
author
Felipe Zimmerle
committed
Fix owasp-modsecurity#142, Uses addn instead of apr_table_setn
The headers are represented in the format of an apr_table, which is able to handle elements with the same key, however the function apr_table_setn checks if the key exists before add the element, if so it replaces the old value with the new one. This was making our implementation to just keep the last added Cookie. The apr_table_addn function, which is now used, just add a new item without check for olders one.
1 parent 61e54f2 commit 7fc4159

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nginx/modsecurity/ngx_http_modsecurity.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ ngx_http_modsecurity_load_headers_out(ngx_http_request_t *r)
652652
buf = ngx_cpymem(buf, h[i].value.data, h[i].value.len);
653653
*buf++ = '\0';
654654

655-
apr_table_setn(req->headers_out, key, value);
655+
apr_table_addn(req->headers_out, key, value);
656656
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
657657
"ModSecurity: load headers out: \"%V: %V\"",
658658
&h[i].key, &h[i].value);

0 commit comments

Comments
 (0)