Browse Source

small workaround to make this module work on apache 2.2.x as well as 2.4.x

master
Georg Hopp 14 years ago
parent
commit
d452726bfe
  1. 25
      mod_entropy.c

25
mod_entropy.c

@ -70,15 +70,19 @@ entropy_filter_in(
apr_read_type_e block,
apr_off_t readbytes)
{
apr_bucket * bucket;
apr_status_t status;
request_rec * request = filter->r;
conn_rec * connection = filter->c;
apr_sha1_ctx_t sha1_ctx;
unsigned char digest[APR_SHA1_DIGESTSIZE];
apr_bucket * bucket;
apr_status_t status;
request_rec * request = filter->r;
conn_rec * connection = filter->c;
apr_sha1_ctx_t sha1_ctx;
unsigned char digest[APR_SHA1_DIGESTSIZE];
ap_version_t ap_version;
char * remote_ip;
struct timespec ts;
ap_get_server_revision(&ap_version);
clock_gettime(CLOCK_REALTIME, &ts);
apr_sha1_init(&sha1_ctx);
@ -94,10 +98,11 @@ entropy_filter_in(
/**
* add client ip to sha1
*/
apr_sha1_update(
&sha1_ctx,
connection->remote_ip,
strlen(connection->remote_ip));
remote_ip = (ap_version.minor < 4)?
connection->remote_ip:
connection->client_ip;
apr_sha1_update(&sha1_ctx, remote_ip, strlen(remote_ip));
/**
* add request line to sha1

Loading…
Cancel
Save