summaryrefslogtreecommitdiff
path: root/apache1x/mod_httpauth.c
diff options
context:
space:
mode:
Diffstat (limited to 'apache1x/mod_httpauth.c')
-rw-r--r--apache1x/mod_httpauth.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/apache1x/mod_httpauth.c b/apache1x/mod_httpauth.c
index 4443c81..4cb3e3f 100644
--- a/apache1x/mod_httpauth.c
+++ b/apache1x/mod_httpauth.c
@@ -51,6 +51,12 @@
module MODULE_VAR_EXPORT httpauth_module;
+/* Keep track of a unique identifier */
+static void* conn_current = NULL;
+
+/* And increment this when it goes out of scope */
+static unsigned int conn_seen = 0;
+
typedef struct httpauth_context
{
const char* socketname;
@@ -609,6 +615,13 @@ finally:
return ret;
}
+/* Make sure our connection identifier is unique */
+static void connection_gone (void *data)
+{
+ conn_current = NULL;
+ conn_seen++;
+}
+
int write_request(httpauth_context_t* ctx, request_rec* r)
{
char pidid[40];
@@ -618,8 +631,17 @@ int write_request(httpauth_context_t* ctx, request_rec* r)
const array_header* hdrs_arr;
const table_entry* elts;
+ /* When the connection goes away, call our handler */
+ if(conn_current != r->connection)
+ {
+ conn_current = r->connection;
+ ap_register_cleanup(r->connection->pool, r,
+ connection_gone, ap_null_cleanup);
+ }
+
/* A unique per connection id */
- snprintf(connid, sizeof(connid), "0x%X", (unsigned int)r->connection);
+ snprintf(connid, sizeof(connid), "0x%X-%X",
+ (unsigned int)r->connection, conn_seen);
connid[sizeof(connid) - 1] = 0;
snprintf(pidid, sizeof(pidid), "%d", (unsigned int)getpid());
pidid[sizeof(pidid) - 1] = 0;