#include "http_config.h"
#include "http_core.h"
#include "http_request.h"
+#include "http_log.h"
module AP_MODULE_DECLARE_DATA usertrack_module;
if ((cookie_header = apr_table_get(r->headers_in, "Cookie"))) {
if (!ap_regexec(dcfg->regexp, cookie_header, NUM_SUBS, regm, 0)) {
char *cookieval = NULL;
+ int err = 0;
/* Our regexp,
* ^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+)
* only allows for $1 or $2 to be available. ($0 is always
if (regm[1].rm_so != -1) {
cookieval = ap_pregsub(r->pool, "$1", cookie_header,
NUM_SUBS, regm);
+ if (cookieval == NULL)
+ err = 1;
}
if (regm[2].rm_so != -1) {
cookieval = ap_pregsub(r->pool, "$2", cookie_header,
NUM_SUBS, regm);
+ if (cookieval == NULL)
+ err = 1;
+ }
+ if (err) {
+ ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r,
+ "Failed to extract cookie value (out of mem?)");
+ return HTTP_INTERNAL_SERVER_ERROR;
}
/* Set the cookie in a note, for logging */
apr_table_setn(r->notes, "cookie", cookieval);