# Added variables to keep track of the variables to be substituted in

.html files displayed to the client [Steven Young]
This commit is contained in:
Robert James Kaes 2003-03-13 21:27:29 +00:00
parent a830af5097
commit 056bbf84bd
2 changed files with 29 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $Id: conns.c,v 1.13 2002-11-13 17:47:40 rjkaes Exp $
/* $Id: conns.c,v 1.14 2003-03-13 21:27:29 rjkaes Exp $
*
* Create and free the connection structure. One day there could be
* other connection related tasks put here, but for now the header
@ -59,6 +59,8 @@ initialize_conn(int client_fd, const char* ipaddr, const char* string_addr)
connptr->request_line = NULL;
/* These store any error strings */
connptr->error_variables = NULL;
connptr->error_variable_count = 0;
connptr->error_string = NULL;
connptr->error_number = -1;
@ -110,6 +112,18 @@ destroy_conn(struct conn_s *connptr)
if (connptr->request_line)
safefree(connptr->request_line);
if (connptr->error_variables) {
int i;
for(i = 0; connptr->error_variables[i]; i++) {
safefree(connptr->error_variables[i]->error_key);
safefree(connptr->error_variables[i]->error_val);
safefree(connptr->error_variables[i]);
}
safefree(connptr->error_variables);
}
if (connptr->error_string)
safefree(connptr->error_string);

View File

@ -1,4 +1,4 @@
/* $Id: conns.h,v 1.11 2002-12-04 17:06:13 rjkaes Exp $
/* $Id: conns.h,v 1.12 2003-03-13 21:27:29 rjkaes Exp $
*
* See 'conns.c' for a detailed description.
*
@ -37,9 +37,20 @@ struct conn_s {
unsigned int connect_method;
unsigned int show_stats;
/* Store the error response if there is one */
char *error_string;
/*
* Store the error response if there is one.
* This structure stores key -> value mappings for substitution
* in the error HTML files. a NULL pointer indicates the end of
* the array
*/
struct error_variable_s {
char *error_key;
char *error_val;
} **error_variables;
int error_variable_count;
int error_number;
char *error_string;
/* A Content-Length value from the remote server */
long remote_content_length;