aboutsummaryrefslogtreecommitdiff
path: root/src/Server.c
diff options
context:
space:
mode:
authortradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2002-01-04 13:00:56 +0000
committertradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2002-01-04 13:00:56 +0000
commitbf0001377ee0765926ae1848ccab76f5cdb5608a (patch)
tree708237a069b1617cdf33adf88286195d7d8e7044 /src/Server.c
parentaf5a1374223b0bd5f5041fd9d7ca38765c1be95d (diff)
Callback functions, which serve registered pages, take a 'const cGH *'
argument now. Also fixed a small memory leak in redirection code. git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@145 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src/Server.c')
-rw-r--r--src/Server.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Server.c b/src/Server.c
index 53f170d..f014ebd 100644
--- a/src/Server.c
+++ b/src/Server.c
@@ -38,7 +38,7 @@ CCTK_FILEVERSION(CactusConnect_HTTPD_Server_c)
typedef struct
{
- int (*function)(cGH *, httpRequest *, void *);
+ int (*function)(const cGH *, httpRequest *, void *);
void *data;
} httpPage;
@@ -46,7 +46,7 @@ typedef struct
********************* Local Routine Prototypes *********************
********************************************************************/
-static httpPage *CreatePageData(int (*function)(cGH *,httpRequest *, void *), void *data);
+static httpPage *CreatePageData(int (*function)(const cGH *,httpRequest *, void *), void *data);
static httpPage *FindPage(char *path, char **residual);
static int StatusUntilIt (const cGH *cctkGH);
@@ -68,7 +68,7 @@ static uHash *pages = NULL;
static const char *notfound_page =
"<HTML>\n<HEAD><TITLE>Error 404: Not Found</TITLE></HEAD>\
-<BODY>The URI you requested could not be found</BODY>\n<HTML>\n";
+<BODY>The URI you requested could not be found</BODY>\n</HTML>\n";
static const char *notimplemented_page =
"<HTML>\n<HEAD><TITLE>Error 501: Not Implemented</TITLE></HEAD>\
@@ -177,7 +177,7 @@ int HTTP_RequestUnsupported(cGH *cctkGH, httpRequest *request)
@endhistory
@@*/
-int HTTP_RegisterPage(const char *path, int (*function)(cGH *, httpRequest *, void *), void *data)
+int HTTP_RegisterPage(const char *path, int (*function)(const cGH *, httpRequest *, void *), void *data)
{
int retval;
@@ -331,7 +331,7 @@ int HTTP_Terminate(cGH *cctkGH)
@endhistory
@@*/
-static httpPage *CreatePageData(int (*function)(cGH *, httpRequest *, void *), void *data)
+static httpPage *CreatePageData(int (*function)(const cGH *, httpRequest *, void *), void *data)
{
httpPage *pagedata;
@@ -368,11 +368,13 @@ static httpPage *FindPage(char *path, char **residual)
pagedata = NULL;
+printf ("Searching for '%s'\n", path);
if(pages)
{
/* Check for index.html */
if(path[strlen(path)-1] == '/')
{
+#define HTTP_DEBUG 1
#ifdef HTTP_DEBUG
printf("Looking for '%sindex.html'\n", path);
#endif