summaryrefslogtreecommitdiff
path: root/apache2x/mod_httpauth.c
diff options
context:
space:
mode:
Diffstat (limited to 'apache2x/mod_httpauth.c')
-rw-r--r--apache2x/mod_httpauth.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/apache2x/mod_httpauth.c b/apache2x/mod_httpauth.c
index 9e8a95a..9d3854b 100644
--- a/apache2x/mod_httpauth.c
+++ b/apache2x/mod_httpauth.c
@@ -54,6 +54,12 @@
module AP_MODULE_DECLARE_DATA 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;
@@ -614,6 +620,14 @@ finally:
return ret;
}
+/* Make sure our connection identifier is unique */
+static apr_status_t connection_gone (void *data)
+{
+ conn_current = NULL;
+ conn_seen++;
+ return APR_SUCCESS;
+}
+
int write_request(httpauth_context_t* ctx, request_rec* r)
{
char pidid[40];
@@ -623,9 +637,17 @@ int write_request(httpauth_context_t* ctx, request_rec* r)
const apr_array_header_t* hdrs_arr;
const apr_table_entry_t* elts;
+ /* When the connection goes away, call our handler */
+ if(conn_current != r->connection)
+ {
+ conn_current = r->connection;
+ apr_pool_cleanup_register(r->connection->pool, r,
+ connection_gone, apr_pool_cleanup_null);
+ }
+
/* A unique per connection id */
- snprintf(connid, sizeof(connid), "0x%X-%X",
- (unsigned int)r->connection, (unsigned int)r->connection->id);
+ snprintf(connid, sizeof(connid), "0x%X-%X-%X",
+ (unsigned int)r->connection, conn_seen, (unsigned int)r->connection->id);
connid[sizeof(connid) - 1] = 0;
snprintf(pidid, sizeof(pidid), "%d", (unsigned int)getpid());
pidid[sizeof(pidid) - 1] = 0;