diff options
-rw-r--r-- | src/conns.c | 14 | ||||
-rw-r--r-- | src/conns.h | 11 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/conns.c b/src/conns.c index 1d72bfe..2d3f8a7 100644 --- a/src/conns.c +++ b/src/conns.c @@ -1,4 +1,4 @@ -/* $Id: conns.c,v 1.10 2002-04-18 21:43:52 rjkaes Exp $ +/* $Id: conns.c,v 1.11 2002-05-23 18:23:29 rjkaes Exp $ * * Create and free the connection structure. One day there could be * other connnection related tasks put here, but for now the header @@ -22,11 +22,11 @@ #include "buffer.h" #include "conns.h" +#include "heap.h" #include "stats.h" -#include "utils.h" struct conn_s * -initialize_conn(int client_fd) +initialize_conn(int client_fd, const char* ipaddr, const char* string_addr) { struct conn_s *connptr; struct buffer_s *cbuffer, *sbuffer; @@ -68,6 +68,9 @@ initialize_conn(int client_fd) connptr->remote_content_length = -1; + connptr->client_ip_addr = safestrdup(ipaddr); + connptr->client_string_addr = safestrdup(string_addr); + update_stats(STAT_OPEN); return connptr; @@ -105,6 +108,11 @@ destroy_conn(struct conn_s *connptr) if (connptr->error_string) safefree(connptr->error_string); + if (connptr->client_ip_addr) + safefree(connptr->client_ip_addr); + if (connptr->client_string_addr) + safefree(connptr->client_string_addr); + safefree(connptr); update_stats(STAT_CLOSE); diff --git a/src/conns.h b/src/conns.h index 9fd9eea..59ec8e9 100644 --- a/src/conns.h +++ b/src/conns.h @@ -1,4 +1,4 @@ -/* $Id: conns.h,v 1.9 2002-04-18 21:43:53 rjkaes Exp $ +/* $Id: conns.h,v 1.10 2002-05-23 18:23:29 rjkaes Exp $ * * See 'conns.c' for a detailed description. * @@ -44,6 +44,12 @@ struct conn_s { long remote_content_length; /* + * Store the client's IP and hostname information + */ + char* client_ip_addr; + char* client_string_addr; + + /* * Store the incoming request's HTTP protocol. */ struct { @@ -55,7 +61,8 @@ struct conn_s { /* * Functions for the creation and destruction of a connection structure. */ -extern struct conn_s* initialize_conn(int client_fd); +extern struct conn_s* initialize_conn(int client_fd, const char* ipaddr, + const char* string_addr); extern void destroy_conn(struct conn_s *connptr); #endif |