Skip to content

Commit 8bb515e

Browse files
author
Felipe Zimmerle
committed
Uses mod_unique if available
If mod_unique is available on the platform, the transaction ids will be labeled respecting it. Otherwise, the library will handle it internally.
1 parent 967d69a commit 8bb515e

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

CHANGES

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
v3.0.x - YYYY-MMM-DD (To be released)
22
-------------------------------------
33

4+
- Uses mod_unique if available
5+
[Issue #42 - @zimmerle, @victorhora, @Goron1606]
46
- Fix duplicate HTTP protocol strings
57
[Issue #21 - @victorhora]
68

src/mod_security3.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
#include <stdio.h>
3+
24
#include "mod_security3.h"
35
#include "msc_utils.h"
46
#include "msc_config.h"
@@ -132,6 +134,8 @@ static void store_tx_context(msc_t *msr, request_rec *r)
132134
static msc_t *create_tx_context(request_rec *r) {
133135
msc_t *msr = NULL;
134136
msc_conf_t *z = NULL;
137+
char *unique_id = NULL;
138+
135139
z = (msc_conf_t *)ap_get_module_config(r->per_dir_config,
136140
&security3_module);
137141

@@ -141,7 +145,14 @@ static msc_t *create_tx_context(request_rec *r) {
141145
}
142146

143147
msr->r = r;
144-
msr->t = msc_new_transaction(msc_apache->modsec, (Rules *)z->rules_set, (void *)r);
148+
unique_id = getenv("UNIQUE_ID");
149+
if (unique_id != NULL || strlen(unique_id) > 0) {
150+
msr->t = msc_new_transaction_with_id(msc_apache->modsec,
151+
(Rules *)z->rules_set, unique_id, (void *)r);
152+
} else {
153+
msr->t = msc_new_transaction(msc_apache->modsec,
154+
(Rules *)z->rules_set, (void *)r);
155+
}
145156

146157
store_tx_context(msr, r);
147158

0 commit comments

Comments
 (0)