aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2001-04-03 11:52:30 +0000
committertradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2001-04-03 11:52:30 +0000
commit9440c6b2556d012a91c44eee00c56790819b722f (patch)
tree570ff51e6484286a8aef911fd7e1e3670b4f989b /src
parentf205b15ff648ff94aa3c3ab40a66a2cc9404f864 (diff)
Fixed most of the compiler warnings.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@120 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src')
-rw-r--r--src/Authorisation.c13
-rw-r--r--src/Content.c61
-rw-r--r--src/Cookies.c2
-rw-r--r--src/Expression.c21
-rw-r--r--src/Groups.c5
-rw-r--r--src/Headers.c24
-rw-r--r--src/Parameters.c485
-rw-r--r--src/Server.c6
-rw-r--r--src/Startup.c22
-rw-r--r--src/Steer.c12
-rw-r--r--src/Thorns.c69
-rw-r--r--src/http.c12
12 files changed, 394 insertions, 338 deletions
diff --git a/src/Authorisation.c b/src/Authorisation.c
index 5b10df7..3f40ebe 100644
--- a/src/Authorisation.c
+++ b/src/Authorisation.c
@@ -96,6 +96,9 @@ int HTTP_AuthAddUser(const char *database,
int retcode;
uHash *this_database;
+ retcode = -1;
+ this_database = NULL;
+
/* Create the master database if necessary */
if(!AuthDatabase)
{
@@ -165,16 +168,15 @@ int HTTP_AuthenticateBasic(httpRequest *request,
int length)
{
int retval;
- char message[1024];
const char *value;
char *auth_string;
char *token;
int decoded_size;
- unsigned char decoded[DECODED_SIZE+1];
+ char decoded[DECODED_SIZE+1];
- unsigned char *password;
+ char *password;
int authorised;
@@ -202,7 +204,8 @@ int HTTP_AuthenticateBasic(httpRequest *request,
if(CCTK_Equals(token, "Basic"))
{
token = strtok(NULL, " ,\t");
- decoded_size = HTTP_b64_pton(token, decoded, DECODED_SIZE);
+ decoded_size = HTTP_b64_pton(token, (unsigned char *) decoded,
+ DECODED_SIZE);
/* Null terminate string */
decoded[decoded_size] = 0;
@@ -215,7 +218,7 @@ int HTTP_AuthenticateBasic(httpRequest *request,
password++;
authorised = VerifyPassword(database, decoded, password);
- if(user && strlen(user) < decoded_size)
+ if(user && (int) strlen(user) < decoded_size)
{
sprintf(user,"%s", decoded);
}
diff --git a/src/Content.c b/src/Content.c
index 8745f26..3563a53 100644
--- a/src/Content.c
+++ b/src/Content.c
@@ -11,6 +11,8 @@
@version $Header$
@@*/
+#include "cctk.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -19,7 +21,7 @@
#include <unistd.h>
#endif
-#include "cctk.h"
+#include "cctk_Version.h"
#include "cctk_Parameter.h"
#include "cctk_ActiveThorns.h"
@@ -84,6 +86,8 @@ static int CookieTestPage(cGH *cctkGH, httpRequest *request, void *data);
********************* Other Routine Prototypes *********************
********************************************************************/
+void HTTP_ContentWork(cGH *GH);
+int HTTP_RegisterPages(void);
int HTTPi_RegisterGroupsPages(void);
int HTTPi_RegisterThornPages(void);
int HTTPi_RegisterParameterPages(void);
@@ -119,8 +123,11 @@ static const char *notauthorized_page =
@endhistory
@@*/
-void HTTP_ContentWork(CCTK_ARGUMENTS)
+void HTTP_ContentWork(cGH *GH)
{
+ /* avoid compiler warning about unused parameter */
+ GH = GH;
+
#if 0
HTTP_SteerDispatch();
#endif
@@ -202,19 +209,19 @@ int HTTP_ContentLink(const char *URL,
int flags)
{
int retval;
- struct httpLink *link;
+ struct httpLink *hlink;
struct httpLink *last;
struct httpLink *current;
- link = (struct httpLink *)malloc(sizeof(struct httpLink));
+ hlink = (struct httpLink *)malloc(sizeof(struct httpLink));
- if(link)
+ if(hlink)
{
- link->URL = Util_Strdup(URL);
- link->name = Util_Strdup(name);
- link->description = Util_Strdup(description);
- link->flags = flags;
- link->next = NULL;
+ hlink->URL = Util_Strdup(URL);
+ hlink->name = Util_Strdup(name);
+ hlink->description = Util_Strdup(description);
+ hlink->flags = flags;
+ hlink->next = NULL;
/* Put on list */
if(ContentLinks)
@@ -223,11 +230,11 @@ int HTTP_ContentLink(const char *URL,
{
last = current;
}
- last->next = link;
+ last->next = hlink;
}
else
{
- ContentLinks = link;
+ ContentLinks = hlink;
}
retval = 0;
@@ -292,15 +299,17 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
DECLARE_CCTK_PARAMETERS
int retval;
- int filelen;
char message[10098];
char title[4098];
char menu[4098];
char *dir;
char *file;
- struct httpLink *link;
+ struct httpLink *hlink;
int seconds,minutes,hours,days,weeks,months,years,millenia;
+ /* avoid compiler warning about unused parameter */
+ data = data;
+
/* Status message */
strcpy(message,"HTTP/1.0 200 OK\r\n");
@@ -393,11 +402,11 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
"<H3>Available options:</H3>\n"
"<dl>\n");
- for(link = ContentLinks; link; link=link->next)
+ for(hlink = ContentLinks; hlink; hlink=hlink->next)
{
sprintf(message,
"%s<dt> <A HREF=\"%s\">%s</a> <dd>%s \n",
- message, link->URL, link->name, link->description);
+ message, hlink->URL, hlink->name, hlink->description);
}
@@ -484,7 +493,7 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
strcat(message,"</ul><li> Parameter filename <font color=red>");
HTTP_Write(request, message, strlen(message));
- filelen = CCTK_ParameterFilename(4098,message);
+ CCTK_ParameterFilename(4098,message);
Util_SplitFilename(&dir,&file,message);
HTTP_Write(request, file, strlen(file));
@@ -496,7 +505,7 @@ static int MainPage(cGH *cctkGH, httpRequest *request, void *data)
strcpy(message,"<li>Estimated time per iteration:<UL> ");
sprintf(message,"%s <LI><font color=red>%f</font> seconds</UL>",
- message,((float)CCTK_RunTime()/(float)cctkGH->cctk_iteration));
+ message,CCTK_RunTime()/(double)cctkGH->cctk_iteration);
HTTP_Write(request, message, strlen(message));
strcpy(message,"<li>Estimated time to completion:<UL> ");
@@ -688,6 +697,9 @@ static int ShowStaticPage(cGH *cctkGH, httpRequest *request, void *data)
char message[1024];
struct httpStaticPage *page;
+ /* avoid compiler warning about unused parameter */
+ cctkGH = cctkGH;
+
if(data)
{
page = (struct httpStaticPage *)data;
@@ -730,13 +742,15 @@ static int ControlPage(cGH *cctkGH, httpRequest *request, void *data)
{
DECLARE_CCTK_PARAMETERS
- int retval;
char message[4098];
int notauthorised;
char thisuser[USER_LENGTH+1];
+ /* avoid compiler warning about unused parameter */
+ data = data;
+
notauthorised = HTTP_AuthenticateBasic(request, "user", thisuser, USER_LENGTH);
if(!notauthorised)
@@ -863,7 +877,7 @@ static int ControlPage(cGH *cctkGH, httpRequest *request, void *data)
/* Write out the footer part. */
HTTP_ContentFooter(cctkGH, 0, 4098, message);
- retval = HTTP_Write(request, message, strlen(message));
+ HTTP_Write(request, message, strlen(message));
}
else
{
@@ -1298,6 +1312,9 @@ static int AboutPage(cGH *cctkGH, httpRequest *request, void *data)
int retval;
char message[4098];
+ /* avoid compiler warning about unused parameter */
+ data = data;
+
/* Status message */
strcpy(message,"HTTP/1.0 200 OK\r\n");
@@ -1369,10 +1386,12 @@ static int CookieTestPage(cGH *cctkGH, httpRequest *request, void *data)
{
int retval;
char message[4098];
- struct httpuFileList *list;
const char *value;
char *value2;
+ /* avoid compiler warning about unused parameter */
+ data = data;
+
/* Status message */
strcpy(message,"HTTP/1.0 200 OK\r\n");
diff --git a/src/Cookies.c b/src/Cookies.c
index b5e996e..3fa4e2d 100644
--- a/src/Cookies.c
+++ b/src/Cookies.c
@@ -168,7 +168,7 @@ char *HTTP_CookieGet(httpRequest *request,
position = copy;
/* Search for name=value */
- while(position = strstr(position, name))
+ while((position = strstr(position, name)) != NULL)
{
position += strlen(name);
if(*position == '=')
diff --git a/src/Expression.c b/src/Expression.c
index 9876417..bed5d74 100644
--- a/src/Expression.c
+++ b/src/Expression.c
@@ -48,11 +48,16 @@ static int cmpprecendence(const char *op1, const char *op2);
static pToken *newtoken(const char *tokenstart, const char *tokenend);
+#if 0
static void insertbefore(pToken *base, pToken *this);
-static void insertafter(pToken *base, pToken *this);
-static void FreeTokens(pToken *list);
+#endif
+#ifdef TEST_HTTP_EVALUATE
static void printtokens(pToken *start);
+#endif
+
+static void insertafter(pToken *base, pToken *this);
+static void FreeTokens(pToken *list);
/********************************************************************
********************* Other Routine Prototypes *********************
@@ -328,9 +333,11 @@ static pToken *Tokenise(const char *expression)
@@*/
#define PUSH(stack, stacklength, value) do \
{ \
- if(strlen(stack)+strlen(value)+3 > (stacklength)) \
+ int len = strlen(stack)+strlen(value)+3; \
+ \
+ if(len > stacklength) \
{ \
- stack = (char *)realloc(stack, strlen(stack)+strlen(value)+3);\
+ stack = (char *)realloc(stack, len); \
} \
sprintf(stack,"%s@%s",stack,value); \
} while(0)
@@ -693,6 +700,7 @@ static pToken *newtoken(const char *tokenstart, const char *tokenend)
@endhistory
@@*/
+#if 0
static void insertbefore(pToken *base, pToken *this)
{
if(base && this)
@@ -707,6 +715,7 @@ static void insertbefore(pToken *base, pToken *this)
}
}
}
+#endif
/*@@
@routine insertafter
@@ -751,6 +760,7 @@ static void insertafter(pToken *base, pToken *this)
@endhistory
@@*/
+#if TEST_HTTP_EVALUATE
static void printtokens(pToken *start)
{
pToken *token;
@@ -762,6 +772,7 @@ static void printtokens(pToken *start)
printf("\n");
}
+#endif /* TEST_HTTP_EVALUATE */
/*@@
@routine printstack
@@ -779,6 +790,7 @@ static void printtokens(pToken *start)
@endhistory
@@*/
+#if 0
static void printstack(char *stack)
{
char *first;
@@ -792,6 +804,7 @@ static void printstack(char *stack)
printf("Token is %s\n", token);
}
}
+#endif
/********************************************************************
diff --git a/src/Groups.c b/src/Groups.c
index 3e13ba7..1d4cc92 100644
--- a/src/Groups.c
+++ b/src/Groups.c
@@ -102,9 +102,8 @@ static int GroupsPage(cGH *cctkGH, httpRequest *request, void *data)
cGroup gdata;
char *groupname;
- /* Avoid warnings */
- void *cctk_dummy_pointer=NULL;
- cctk_dummy_pointer=(void *)data;
+ /* avoid compiler warning about unused parameter */
+ data = data;
/* Status message */
strcpy(message,"HTTP/1.0 200 OK\r\n");
diff --git a/src/Headers.c b/src/Headers.c
index 50d6700..ac2f135 100644
--- a/src/Headers.c
+++ b/src/Headers.c
@@ -10,6 +10,8 @@
#include "cctk.h"
+#include "util_String.h"
+
#include <string.h>
@@ -40,6 +42,9 @@ struct httpLink
********************* Other Routine Prototypes *********************
********************************************************************/
+int HTTP_ContentHeader(cGH *GH, int choice, int len, char *header, char *menu);
+int HTTP_ContentFooter(cGH *GH, int choice, int len, char *footer);
+
/********************************************************************
********************* Local Data *****************************
********************************************************************/
@@ -102,7 +107,9 @@ int HTTP_ContentHeader(cGH *GH, int choice, int len, char *header, char *menu)
char *file;
char *dir;
- int titlelen,datelen,timelen,parlen;
+
+ /* avoid compiler warning about unused parameter */
+ len = len;
if(ContentLinks)
{
@@ -121,12 +128,12 @@ int HTTP_ContentHeader(cGH *GH, int choice, int len, char *header, char *menu)
if (choice == 0)
{
/* Find strings needed for nonmain-page headers */
- titlelen = CCTK_RunTitle(TITLE_ARRAY_SIZE,title);
- parlen = CCTK_ParameterFilename(200,parfile);
+ CCTK_RunTitle(TITLE_ARRAY_SIZE,title);
+ CCTK_ParameterFilename(200,parfile);
Util_SplitFilename(&dir,&file,parfile);
- datelen = Util_CurrentDate(50,currentdate);
- timelen = Util_CurrentTime(50,currenttime);
+ Util_CurrentDate(50,currentdate);
+ Util_CurrentTime(50,currenttime);
/* Build the header */
sprintf( header,
@@ -207,8 +214,11 @@ int HTTP_ContentHeader(cGH *GH, int choice, int len, char *header, char *menu)
@@*/
int HTTP_ContentFooter(cGH *GH, int choice, int len, char *footer)
{
+ /* avoid compiler warnings about unused parameters */
+ GH = GH;
+ choice = choice;
+ len = len;
+
strcpy(footer,cactus_footer);
return strlen(footer);
}
-
-
diff --git a/src/Parameters.c b/src/Parameters.c
index f8f2420..1130d85 100644
--- a/src/Parameters.c
+++ b/src/Parameters.c
@@ -55,6 +55,7 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data);
********************* Other Routine Prototypes *********************
********************************************************************/
+int HTTPi_RegisterParameterPages(void);
/********************************************************************
********************* Local Data *****************************
@@ -92,10 +93,9 @@ int HTTPi_RegisterParameterPages(void)
int first;
const char *thorn;
char pagename[27+20+100]; /* Thorns have maximum length
- then added 100 for parameters */
+ then added 100 for parameters */
char *namecopy;
const cParamData *pData;
- cParamData *datacopy;
/* Two ways to do this - can either just have one function
* registered as /Parameters which then checks request->residual,
@@ -126,9 +126,8 @@ int HTTPi_RegisterParameterPages(void)
while(CCTK_ParameterWalk(first, thorn, NULL, &pData) == 0)
{
first = 0;
- sprintf(pagename,"/Parameters/%s/%s",thorn,pData->name);
- datacopy = (cParamData *)pData;
- HTTP_RegisterPage(pagename, ParameterPage, datacopy);
+ sprintf(pagename,"/Parameters/%s/%s",thorn,pData->name);
+ HTTP_RegisterPage(pagename, ParameterPage, pData);
}
}
@@ -170,6 +169,9 @@ static int MainParameterPage(cGH *cctkGH, httpRequest *request, void *data)
int i;
const char *thorn;
+ /* avoid compiler warning about unused parameter */
+ data = data;
+
/* Status message */
strcpy(message,"HTTP/1.0 200 OK\r\n");
@@ -218,9 +220,9 @@ static int MainParameterPage(cGH *cctkGH, httpRequest *request, void *data)
{
sprintf(message,
"<TR>\n"
- "<TD VALIGN=TOP ALIGN=CENTER><A HREF=\"/Parameters/%s/\">%s</A></td>\n"
+ "<TD VALIGN=TOP ALIGN=CENTER><A HREF=\"/Parameters/%s/\">%s</A></td>\n"
"<TD VALIGN=TOP ALIGN=CENTER>%s</TD>\n"
- "</TR>\n",
+ "</TR>\n",
thorn, thorn,CCTK_ThornImplementation(thorn));
HTTP_Write(request, message, strlen(message));
@@ -279,7 +281,6 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
int param_type;
int param_bool;
- char *param_keyword;
int nsteerable=0;
int nfixed=0;
@@ -299,7 +300,7 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
{
/* Queue parameters for steering */
first = 1;
- while(argument = HTTP_ArgumentWalk(request, first))
+ while((argument = HTTP_ArgumentWalk(request, first)) != NULL)
{
first = 0;
fprintf(stderr, "Setting %s::%s to %s\n", thorn, argument->arg, argument->value);
@@ -390,9 +391,9 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
menuthorn = CCTK_CompiledThorn (i);
if (CCTK_IsThornActive (menuthorn))
{
- sprintf(menu,
- "%s<DT> <A HREF=\"/Parameters/%s/\">%s</A>\n",
- menu,menuthorn, menuthorn);
+ sprintf(menu,
+ "%s<DT> <A HREF=\"/Parameters/%s/\">%s</A>\n",
+ menu,menuthorn, menuthorn);
}
}
HTTP_ContentHeader(cctkGH,0,4098,message,menu);
@@ -410,27 +411,27 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
/* Steerable parameters can be edited in a FORM. */
sprintf(message,
"<center><H1>Check/Modify Parameters</H1>"
- "<H2>Thorn %s</H2></center>\n",
+ "<H2>Thorn %s</H2></center>\n",
thorn);
strcat(message,
"<p>Parameters in Cactus can be either <i>fixed</i> or <i>steerable</i>. "
- "Steerable parameters are those which can be modified during a "
- "simulation"
- "To change steerable parameters, edit the values and press \n"
+ "Steerable parameters are those which can be modified during a "
+ "simulation"
+ "To change steerable parameters, edit the values and press \n"
" the submit button."
- "Before applying the new parameter value, Cactus will check that"
- " the parameter lies in the allowed range. Note that there"
- " is currently no log of parameters which have been modified.</p>\n"
- "<p>The tables below show the parameter name, current value and description."
- "The default value of each parameter is shown in brackets at the end of the description.</p>"
+ "Before applying the new parameter value, Cactus will check that"
+ " the parameter lies in the allowed range. Note that there"
+ " is currently no log of parameters which have been modified.</p>\n"
+ "<p>The tables below show the parameter name, current value and description."
+ "The default value of each parameter is shown in brackets at the end of the description.</p>"
"<center>\n");
HTTP_Write(request, message, strlen(message));
if(!readonly )
{
- sprintf(message,"<FORM ACTION=\"/Parameters/%s/\">",thorn);
- HTTP_Write(request, message, strlen(message));
+ sprintf(message,"<FORM ACTION=\"/Parameters/%s/\">",thorn);
+ HTTP_Write(request, message, strlen(message));
}
/* Walk through all steerable parameters of given implementation. */
@@ -445,105 +446,104 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
if(value)
{
if (pData->steerable == CCTK_STEERABLE_ALWAYS)
- {
-
- if (nsteerable == 0)
- {
- strcat(message,"<h2>Steerable Parameters</h2>");
- if (readonly)
- {
- strcat(message,"<p><i>The following parameters are steerable, "
- "but you do not have authorisation to change them. "
- "To change parameters you must first register on the "
- "<a href=\"/control.html\">Simulation Control Page</a>."
- "</i></p>");
- }
- strcat(message,"<table cellpadding=5 cellspacing=5>");
- }
- nsteerable++;
-
- if (!readonly)
- {
- if (pData->type == PARAMETER_BOOLEAN)
- {
- /* Steerable boolean */
- param_bool =
- *((CCTK_INT *)CCTK_ParameterGet(pData->name,thorn,&param_type));
- sprintf(message,
- "%s<TR>\n"
- "<TD ALIGN=LEFT VALIGN=CENTER>"
- "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
- "<TD ALIGN=LEFT VALIGN=CENTER>"
- "Yes <INPUT TYPE=\"RADIO\" NAME=\"%s\" %s VALUE=\"1\">"
- "&nbsp;"
- "No <INPUT type=\"RADIO\" name=\"%s\" %s VALUE=\"0\">"
- "</TD>\n"
- "<TD><SMALL>%s (%s)</SMALL></TD>\n"
- "</TR>\n",
- message,pData->thorn,pData->name,
- pData->name,pData->name,
- param_bool ? "checked" : "", pData->name,
- param_bool ? "" : "checked",pData->description,pData->defval);
- }
- else if (pData->type == PARAMETER_KEYWORD)
- {
- /* Steerable keyword */
- param_keyword =
- ((char *)CCTK_ParameterGet(pData->name,thorn,&param_type));
-
- sprintf(message,"%s<TR>\n"
- "<TD ALIGN=LEFT VALIGN=CENTER>"
- "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
- "<TD ALIGN=LEFT VALIGN=CENTER>\n",
- message,pData->thorn,pData->name,pData->name);
- sprintf(message,"%s <SELECT name=%s size=1>\n",
- message,pData->name);
- for(range = pData->range; range ; range = range->next)
- {
- if (CCTK_Equals(value,range->range))
- {
- sprintf(message,"%s<OPTION SELECTED>%s\n",
- message, range->range);
- }
- else
- {
- sprintf(message,"%s<OPTION>%s\n",
- message,range->range);
- }
- }
- strcat(message,"</SELECT>\n");
- sprintf(message,"%s</TD>\n"
- "<TD><SMALL>%s (%s)</SMALL></TD>\n"
- "</TR>\n",
- message,pData->description,pData->defval);
- }
- else
- {
- /* Steerable nonboolean */
- sprintf(message,
- "%s<TR>\n"
- "<TD align=left valign=center>"
- "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
- "<TD align=left valign=center>"
- "<INPUT TYPE=TEXT NAME=\"%s\" VALUE=\"%s\"></TD>\n"
- "<TD><SMALL>%s (%s)</SMALL></TD>\n</TR>\n",
- message, pData->thorn, pData->name,
- pData->name, pData->name,
- value, pData->description,pData->defval);
- }
- }
- else
- {
- /* Steerable but no authority */
- sprintf(message,
- "%s<TR><TD align=left valign=center>"
- "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
- "<TD align=left valign=center>%s</TD><TD>"
- "<SMALL>%s (%s)</SMALL></TD></TR>\n",
- message, pData->thorn, pData->name,
- pData->name, value, pData->description,pData->defval);
- }
- }
+ {
+
+ if (nsteerable == 0)
+ {
+ strcat(message,"<h2>Steerable Parameters</h2>");
+ if (readonly)
+ {
+ strcat(message,"<p><i>The following parameters are steerable, "
+ "but you do not have authorisation to change them. "
+ "To change parameters you must first register on the "
+ "<a href=\"/control.html\">Simulation Control Page</a>."
+ "</i></p>");
+ }
+ strcat(message,"<table cellpadding=5 cellspacing=5>");
+ }
+ nsteerable++;
+
+ if (!readonly)
+ {
+ if (pData->type == PARAMETER_BOOLEAN)
+ {
+ /* Steerable boolean */
+ param_bool =
+ *((CCTK_INT *)CCTK_ParameterGet(pData->name,thorn,&param_type));
+ sprintf(message,
+ "%s<TR>\n"
+ "<TD ALIGN=LEFT VALIGN=CENTER>"
+ "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
+ "<TD ALIGN=LEFT VALIGN=CENTER>"
+ "Yes <INPUT TYPE=\"RADIO\" NAME=\"%s\" %s VALUE=\"1\">"
+ "&nbsp;"
+ "No <INPUT type=\"RADIO\" name=\"%s\" %s VALUE=\"0\">"
+ "</TD>\n"
+ "<TD><SMALL>%s (%s)</SMALL></TD>\n"
+ "</TR>\n",
+ message,pData->thorn,pData->name,
+ pData->name,pData->name,
+ param_bool ? "checked" : "", pData->name,
+ param_bool ? "" : "checked",pData->description,pData->defval);
+ }
+ else if (pData->type == PARAMETER_KEYWORD)
+ {
+ /* Steerable keyword */
+ CCTK_ParameterGet(pData->name,thorn,&param_type);
+
+ sprintf(message,"%s<TR>\n"
+ "<TD ALIGN=LEFT VALIGN=CENTER>"
+ "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
+ "<TD ALIGN=LEFT VALIGN=CENTER>\n",
+ message,pData->thorn,pData->name,pData->name);
+ sprintf(message,"%s <SELECT name=%s size=1>\n",
+ message,pData->name);
+ for(range = pData->range; range ; range = range->next)
+ {
+ if (CCTK_Equals(value,range->range))
+ {
+ sprintf(message,"%s<OPTION SELECTED>%s\n",
+ message, range->range);
+ }
+ else
+ {
+ sprintf(message,"%s<OPTION>%s\n",
+ message,range->range);
+ }
+ }
+ strcat(message,"</SELECT>\n");
+ sprintf(message,"%s</TD>\n"
+ "<TD><SMALL>%s (%s)</SMALL></TD>\n"
+ "</TR>\n",
+ message,pData->description,pData->defval);
+ }
+ else
+ {
+ /* Steerable nonboolean */
+ sprintf(message,
+ "%s<TR>\n"
+ "<TD align=left valign=center>"
+ "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
+ "<TD align=left valign=center>"
+ "<INPUT TYPE=TEXT NAME=\"%s\" VALUE=\"%s\"></TD>\n"
+ "<TD><SMALL>%s (%s)</SMALL></TD>\n</TR>\n",
+ message, pData->thorn, pData->name,
+ pData->name, pData->name,
+ value, pData->description,pData->defval);
+ }
+ }
+ else
+ {
+ /* Steerable but no authority */
+ sprintf(message,
+ "%s<TR><TD align=left valign=center>"
+ "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
+ "<TD align=left valign=center>%s</TD><TD>"
+ "<SMALL>%s (%s)</SMALL></TD></TR>\n",
+ message, pData->thorn, pData->name,
+ pData->name, value, pData->description,pData->defval);
+ }
+ }
free (value);
}
HTTP_Write(request, message, strlen(message));
@@ -552,18 +552,18 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
if (nsteerable>0)
{
- strcpy(message, "</TABLE>\n");
+ strcpy(message, "</TABLE>\n");
}
else
{
- strcpy(message, "<P>This thorn has no steerable parameters.</P>\n");
+ strcpy(message, "<P>This thorn has no steerable parameters.</P>\n");
}
HTTP_Write(request, message, strlen(message));
if(!readonly && nsteerable>0)
{
strcpy(message,
- "<INPUT TYPE=SUBMIT VALUE=\"Update all parameters\">\n"
+ "<INPUT TYPE=SUBMIT VALUE=\"Update all parameters\">\n"
"</FORM>\n");
HTTP_Write(request, message, strlen(message));
}
@@ -582,33 +582,33 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
{
if (!(pData->steerable == CCTK_STEERABLE_ALWAYS))
{
-
- if (nfixed == 0)
- {
- strcat(message,"<h2>Fixed Parameters</h2>"
- "<table cellpadding=5 cellspacing=5>");
- }
- nfixed++;
-
- /* FIXME: This is a hack - should put in parameter tags. */
- if(strcmp(thorn,CCTK_THORNSTRING) ||
- (strcmp(pData->name,"user") &&
- strcmp(pData->name,"password") &&
- strcmp(pData->name,"encryption_scheme")))
- {
-
- sprintf(message,
- "%s<TR>\n"
- "<TD align=left valign=center>"
- "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
- "<TD>%s</TD>\n"
- "<TD><SMALL>%s (%s)</SMALL></TD>\n"
- "</TR>\n",
- message, pData->thorn, pData->name,
- pData->name, value, pData->description,pData->defval);
- }
- }
- free(value);
+
+ if (nfixed == 0)
+ {
+ strcat(message,"<h2>Fixed Parameters</h2>"
+ "<table cellpadding=5 cellspacing=5>");
+ }
+ nfixed++;
+
+ /* FIXME: This is a hack - should put in parameter tags. */
+ if(strcmp(thorn,CCTK_THORNSTRING) ||
+ (strcmp(pData->name,"user") &&
+ strcmp(pData->name,"password") &&
+ strcmp(pData->name,"encryption_scheme")))
+ {
+
+ sprintf(message,
+ "%s<TR>\n"
+ "<TD align=left valign=center>"
+ "<A HREF=\"/Parameters/%s/%s\">%s</A></TD>\n"
+ "<TD>%s</TD>\n"
+ "<TD><SMALL>%s (%s)</SMALL></TD>\n"
+ "</TR>\n",
+ message, pData->thorn, pData->name,
+ pData->name, value, pData->description,pData->defval);
+ }
+ }
+ free(value);
}
HTTP_Write(request, message, strlen(message));
@@ -616,11 +616,11 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
if (nfixed>0)
{
- strcpy(message, "</TABLE>\n");
+ strcpy(message, "</TABLE>\n");
}
else
{
- strcpy(message, "<p>This thorn has no fixed parameters.</p>\n");
+ strcpy(message, "<p>This thorn has no fixed parameters.</p>\n");
}
HTTP_Write(request, message, strlen(message));
@@ -660,10 +660,8 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
{
int retval=0;
- int i;
char message[10000];
char menu[10000];
- const char *thorn, *menuthorn;
int first;
const cParamData *pData;
const cParamData *pDataWalk=NULL;
@@ -675,11 +673,6 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
int notauthorised;
int readonly;
- int param_type;
- int param_bool;
- char *param_keyword;
- int nsteerable=0;
- int nfixed=0;
pData = (cParamData *)data;
@@ -697,7 +690,7 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
{
/* Queue parameters for steering */
first = 1;
- while(argument = HTTP_ArgumentWalk(request, first))
+ while((argument = HTTP_ArgumentWalk(request, first)) != NULL)
{
first = 0;
fprintf(stderr, "Setting %s::%s to %s\n", pData->thorn, argument->arg, argument->value);
@@ -775,7 +768,7 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
/* Start the page */
sprintf(message,
"<HTML><HEAD><TITLE>Cactus Parameter Request : %s</TITLE>"
- "</HEAD>\n", pData->name);
+ "</HEAD>\n", pData->name);
HTTP_Write(request, message, strlen(message));
@@ -786,12 +779,12 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
{
if (first==1)
{
- sprintf(menu,"<DT><B>%s:</B>\n",pDataWalk->thorn);
+ sprintf(menu,"<DT><B>%s:</B>\n",pDataWalk->thorn);
}
first = 0;
sprintf(menu,
- "%s <DT> <A HREF=\"/Parameters/%s/%s\">%s</A>\n",
- menu,pDataWalk->thorn,pDataWalk->name,pDataWalk->name);
+ "%s <DT> <A HREF=\"/Parameters/%s/%s\">%s</A>\n",
+ menu,pDataWalk->thorn,pDataWalk->name,pDataWalk->name);
}
HTTP_ContentHeader(cctkGH,0,4098,message,menu);
@@ -801,95 +794,95 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
HTTP_Write(request, message, strlen(message));
sprintf(message,
- "<CENTER><P>Return to all parameters for this "
- "<A HREF=\"Parameters/%s\">thorn</A>.</P></CENTER> ",
- pData->name, pData->thorn, CCTK_ThornImplementation(pData->thorn));
+ "<CENTER><P>Return to all parameters for this "
+ "<A HREF=\"Parameters/%s\">thorn</A>.</P></CENTER> ",
+ CCTK_ThornImplementation(pData->thorn));
HTTP_Write(request, message, strlen(message));
-
+
value = CCTK_ParameterValString (pData->name, pData->thorn);
/* FIXME: HACK need a tag on parameter definition */
if(strcmp(pData->thorn,CCTK_THORNSTRING) ||
(strcmp(pData->name,"user") &&
- strcmp(pData->name,"password") &&
- strcmp(pData->name,"encryption_scheme")))
+ strcmp(pData->name,"password") &&
+ strcmp(pData->name,"encryption_scheme")))
{
sprintf(message,"<CENTER><TABLE CELLPADDING=5 CELLSPACING=5 "
- " BORDER=1 NOSHADE>\n"
- "<TR>\n"
- "<TD ALIGN=RIGHT VALIGN=TOP><B>Name:</B></TD>\n"
- "<TD>%s</TD>\n"
- "</TR>\n"
- "<TR>\n"
- "<TD ALIGN=RIGHT VALIGN=TOP><B>Thorn:</B></TD>\n"
- "<TD>%s</TD>\n"
- "</TR>\n"
- "<TR>\n"
- "<TD ALIGN=RIGHT VALIGN=TOP><B>Implementation:</B></TD>\n"
- "<TD>%s</TD>\n"
- "</TR>\n"
- "<TR>\n"
- "<TD ALIGN=RIGHT VALIGN=TOP><B>Current value:</B></TD>\n"
- "<TD>%s</TD>\n"
- "</TR>"
- "<TR>\n"
- "<TD ALIGN=RIGHT VALIGN=TOP><B>Description:</B></TD>\n"
- "<TD>%s</TD>\n"
- "</TR>"
- "<TR>"
- "<TD ALIGN=RIGHT VALIGN=TOP><B>Default:</B></TD>\n"
- "<TD>%s</TD>\n"
- "</TR>",
- pData->name,pData->thorn,CCTK_ThornImplementation(pData->thorn),
- value,pData->description,pData->defval);
+ " BORDER=1 NOSHADE>\n"
+ "<TR>\n"
+ "<TD ALIGN=RIGHT VALIGN=TOP><B>Name:</B></TD>\n"
+ "<TD>%s</TD>\n"
+ "</TR>\n"
+ "<TR>\n"
+ "<TD ALIGN=RIGHT VALIGN=TOP><B>Thorn:</B></TD>\n"
+ "<TD>%s</TD>\n"
+ "</TR>\n"
+ "<TR>\n"
+ "<TD ALIGN=RIGHT VALIGN=TOP><B>Implementation:</B></TD>\n"
+ "<TD>%s</TD>\n"
+ "</TR>\n"
+ "<TR>\n"
+ "<TD ALIGN=RIGHT VALIGN=TOP><B>Current value:</B></TD>\n"
+ "<TD>%s</TD>\n"
+ "</TR>"
+ "<TR>\n"
+ "<TD ALIGN=RIGHT VALIGN=TOP><B>Description:</B></TD>\n"
+ "<TD>%s</TD>\n"
+ "</TR>"
+ "<TR>"
+ "<TD ALIGN=RIGHT VALIGN=TOP><B>Default:</B></TD>\n"
+ "<TD>%s</TD>\n"
+ "</TR>",
+ pData->name,pData->thorn,CCTK_ThornImplementation(pData->thorn),
+ value,pData->description,pData->defval);
HTTP_Write(request, message, strlen(message));
strcpy(message,"<TR>\n<TD ALIGN=RIGHT VALIGN=TOP>\n"
- "<B>Steerable:</B></TD>\n<TD>");
+ "<B>Steerable:</B></TD>\n<TD>");
switch(pData->steerable)
{
case CCTK_STEERABLE_ALWAYS :
- strcat(message,"Always");
- break;
+ strcat(message,"Always");
+ break;
case CCTK_STEERABLE_NEVER :
- strcat(message,"Never");
- break;
+ strcat(message,"Never");
+ break;
case CCTK_STEERABLE_RECOVER :
- strcat(message,"Recovery");
- break;
+ strcat(message,"Recovery");
+ break;
default :
- strcat(message,"Not matched");
+ strcat(message,"Not matched");
}
strcat(message,"</TD>\n</TR>\n");
HTTP_Write(request, message, strlen(message));
strcpy(message,"<TR>\n"
- "<TD ALIGN=RIGHT VALIGN=TOP><B>Type:</B></TD>\n<TD>\n");
+ "<TD ALIGN=RIGHT VALIGN=TOP><B>Type:</B></TD>\n<TD>\n");
switch(pData->type)
{
case PARAMETER_BOOLEAN :
- strcat(message,"Boolean");
- break;
+ strcat(message,"Boolean");
+ break;
case PARAMETER_REAL :
- strcat(message,"Real");
- break;
+ strcat(message,"Real");
+ break;
case PARAMETER_INTEGER :
- strcat(message,"Integer");
- break;
+ strcat(message,"Integer");
+ break;
case PARAMETER_SENTENCE :
- strcat(message,"Sentence");
- break;
+ strcat(message,"Sentence");
+ break;
case PARAMETER_STRING :
- strcat(message,"String");
- break;
+ strcat(message,"String");
+ break;
case PARAMETER_KEYWORD :
- strcat(message,"Keyword");
- break;
+ strcat(message,"Keyword");
+ break;
default :
- strcat(message,"Not matched");
+ strcat(message,"Not matched");
}
strcat(message,"</TD>\n</TR>\n");
@@ -900,16 +893,16 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
switch(pData->scope)
{
case SCOPE_GLOBAL :
- strcat(message,"Global</TD></TR>");
- break;
+ strcat(message,"Global</TD></TR>");
+ break;
case SCOPE_RESTRICTED :
- strcat(message,"Restricted</TD></TR>");
- break;
+ strcat(message,"Restricted</TD></TR>");
+ break;
case SCOPE_PRIVATE :
- strcat(message,"Private</TD></TR>");
- break;
+ strcat(message,"Private</TD></TR>");
+ break;
default :
- strcat(message,"Not matched</TD></TR>");
+ strcat(message,"Not matched</TD></TR>");
}
HTTP_Write(request, message, strlen(message));
@@ -920,22 +913,22 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
{
if (first==1)
{
- sprintf(message,
- "%s<TR>\n"
- "<TD ALIGN=RIGHT VALIGN=TOP>\n"
- "<B>Range:</B>"
- "</TD>\n<TD><DL>\n",
- message,range->range);
+ sprintf(message,
+ "%s<TR>\n"
+ "<TD ALIGN=RIGHT VALIGN=TOP>\n"
+ "<B>Range:</B>"
+ "</TD>\n<TD><DL>\n",
+ message);
}
first = 0;
sprintf(message,"%s<DT>%s\n<DD>%s\n",
- message,range->range,range->description);
+ message,range->range,range->description);
if (!CCTK_Equals(range->origin,pData->thorn))
{
- sprintf(message,"%s<BR>[Extended by thorn %s]\n",
- message,range->origin);
+ sprintf(message,"%s<BR>[Extended by thorn %s]\n",
+ message,range->origin);
}
- }
+ }
if(first==0)
{
strcat(message,"</DL></TD>\n</TR>\n");
@@ -944,12 +937,12 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
HTTP_Write(request, message, strlen(message));
sprintf(message,
- "<TR>\n"
- "<TD ALIGN=RIGHT VALIGN=TOP><B>Times Set:</B></TD>\n"
- "<TD>%d</TD>\n"
- "</TR>\n"
- "</TABLE></CENTER>\n",
- pData->n_set);
+ "<TR>\n"
+ "<TD ALIGN=RIGHT VALIGN=TOP><B>Times Set:</B></TD>\n"
+ "<TD>%d</TD>\n"
+ "</TR>\n"
+ "</TABLE></CENTER>\n",
+ pData->n_set);
HTTP_Write(request, message, strlen(message));
}
@@ -964,7 +957,7 @@ static int ParameterPage(cGH *cctkGH, httpRequest *request, void *data)
HTTP_ContentFooter(cctkGH, 0, 4098, message);
retval = HTTP_Write(request, message, strlen(message));
-
- return retval;
}
+
+ return retval;
}
diff --git a/src/Server.c b/src/Server.c
index 70db391..42d841e 100644
--- a/src/Server.c
+++ b/src/Server.c
@@ -144,6 +144,10 @@ int HTTP_RequestUnsupported(cGH *cctkGH, httpRequest *request)
{
char message[1024];
+
+ /* avoid compiler warning about unused parameter */
+ cctkGH = cctkGH;
+
strcpy(message,"HTTP/1.0 501 Not Implemented\r\n");
HTTP_Write(request, message, strlen(message));
@@ -203,7 +207,7 @@ int HTTP_RegisterPage(const char *path, int (*function)(cGH *, httpRequest *, vo
}
}
- return 0;
+ return retval;
}
diff --git a/src/Startup.c b/src/Startup.c
index 5c3034d..e288d95 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -8,22 +8,22 @@
@version $Header$
@@*/
+#include "cctk.h"
+
+#ifdef PTHREADS
+#include <pthread.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
-#include "cctk.h"
#include "cctk_Parameter.h"
-
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
#include "httpd.h"
#include "http_Steer.h"
-#ifdef PTHREADS
-#include <pthread.h>
-#endif
-
static char *rcsid = "$Header$";
CCTK_FILEVERSION(CactusConnect_HTTPD_Startup_c)
@@ -36,8 +36,10 @@ CCTK_FILEVERSION(CactusConnect_HTTPD_Startup_c)
********************* Local Routine Prototypes *********************
********************************************************************/
+#ifdef PTHREADS
static void * HTTP_Thread(void *cctkGH);
static void HTTP_SetupPollingThread(cGH *cctkGH);
+#endif
/********************************************************************
***************** Scheduled Routine Prototypes *********************
@@ -242,6 +244,7 @@ int HTTP_Shutdown(void)
@endvar
@@*/
+#ifdef PTHREADS
static void * HTTP_Thread(void *cctkGH)
{
CCTK_INT *terminate;
@@ -282,15 +285,14 @@ static void * HTTP_Thread(void *cctkGH)
@@*/
static void HTTP_SetupPollingThread(cGH *cctkGH)
{
-#ifdef PTHREADS
if(pthread_create(&polling_thread, NULL, HTTP_Thread, (void *)cctkGH))
- {
+ {
perror("pthread_create: ");
CCTK_Exit(cctkGH,99);
}
else
- {
+ {
thread_started = 1;
}
-#endif
}
+#endif /* PTHREADS */
diff --git a/src/Steer.c b/src/Steer.c
index 0fdea7f..61db400 100644
--- a/src/Steer.c
+++ b/src/Steer.c
@@ -13,14 +13,14 @@
#include "cctk.h"
#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
#ifdef PTHREADS
#include <pthread.h>
#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#ifdef CCTK_MPI
#include "mpi.h"
#endif
@@ -47,7 +47,9 @@ CCTK_FILEVERSION(CactusConnect_HTTPD_Steer_c)
static int CommunicateBuffer(void);
static int SteerParameters(void);
+#ifdef CCTK_MPI
static void ByteSwap(void *buf,int nelements,int elementsize);
+#endif /* CCTK_MPI */
/********************************************************************
********************* Other Routine Prototypes *********************
@@ -375,6 +377,7 @@ static int SteerParameters(void)
@endvar
@@*/
+#ifdef CCTK_MPI
static void ByteSwap(void *buf,int nelements,int elementsize)
{
#ifndef WORDS_BIGENDIAN
@@ -396,6 +399,7 @@ static void ByteSwap(void *buf,int nelements,int elementsize)
}
#endif
}
+#endif /* CCTK_MPI */
#ifdef TEST_HTTP_STEER
diff --git a/src/Thorns.c b/src/Thorns.c
index caec028..d0177c2 100644
--- a/src/Thorns.c
+++ b/src/Thorns.c
@@ -38,6 +38,8 @@ static int ThornPage(cGH *cctkGH, httpRequest *request, void *data);
********************* Other Routine Prototypes *********************
********************************************************************/
+int HTTPi_RegisterThornPages(void);
+
/********************************************************************
********************* Local Data *****************************
********************************************************************/
@@ -115,6 +117,9 @@ static int ThornMainPage(cGH *cctkGH, httpRequest *request, void *data)
const char *thorn;
char message[4098];
+ /* avoid compiler warning about unused parameter */
+ data = data;
+
/* Status message */
strcpy(message,"HTTP/1.0 200 OK\r\n");
@@ -138,7 +143,7 @@ static int ThornMainPage(cGH *cctkGH, httpRequest *request, void *data)
retval = HTTP_Write(request, message, strlen(message));
strcpy(message, "<center><h1>Thorns</h1></center>"
- "<p>These pages describe the thorns used in this simulation.</p>");
+ "<p>These pages describe the thorns used in this simulation.</p>");
retval = HTTP_Write(request, message, strlen(message));
@@ -153,22 +158,22 @@ static int ThornMainPage(cGH *cctkGH, httpRequest *request, void *data)
{
if (!foundone)
{
- strcpy(message,
- "<H2>Active Thorns</H2>\n"
- "<CENTER>\n"
- "<TABLE ALIGN=TOP cellspacing=0 cellpadding=5 border=0\n>"
- "<TR>\n"
- "<TH ALIGN=LEFT>Thorn Name</TH>\n"
- "<TH ALIGN=LEFT>Implementation</TH>\n"
- "</TR>\n");
- HTTP_Write(request, message, strlen(message));
- foundone++;
+ strcpy(message,
+ "<H2>Active Thorns</H2>\n"
+ "<CENTER>\n"
+ "<TABLE ALIGN=TOP cellspacing=0 cellpadding=5 border=0\n>"
+ "<TR>\n"
+ "<TH ALIGN=LEFT>Thorn Name</TH>\n"
+ "<TH ALIGN=LEFT>Implementation</TH>\n"
+ "</TR>\n");
+ HTTP_Write(request, message, strlen(message));
+ foundone++;
}
sprintf(message,
"<TR>\n"
- "<TD VALIGN=TOP ALIGN=LEFT><A HREF=\"/Thorns/%s/\">%s</A></td>\n"
+ "<TD VALIGN=TOP ALIGN=LEFT><A HREF=\"/Thorns/%s/\">%s</A></td>\n"
"<TD VALIGN=TOP ALIGN=LEFT>%s</TD>\n"
- "</TR>\n",
+ "</TR>\n",
thorn, thorn,CCTK_ThornImplementation(thorn));
HTTP_Write(request, message, strlen(message));
}
@@ -194,24 +199,24 @@ static int ThornMainPage(cGH *cctkGH, httpRequest *request, void *data)
if (!foundone)
{
- strcpy(message,
- "<H2>Dormant Thorns</H2>\n"
- "<CENTER><TABLE CELL SPACING=0 cellpadding=5 border=0\n>"
- "<TR>\n"
- "<TH ALIGN=LEFT>Thorn Name</TH>\n"
- "<TH ALIGN=LEFT>Implementation</TH>\n"
- "</TR>\n");
- HTTP_Write(request, message, strlen(message));
- foundone++;
+ strcpy(message,
+ "<H2>Dormant Thorns</H2>\n"
+ "<CENTER><TABLE CELL SPACING=0 cellpadding=5 border=0\n>"
+ "<TR>\n"
+ "<TH ALIGN=LEFT>Thorn Name</TH>\n"
+ "<TH ALIGN=LEFT>Implementation</TH>\n"
+ "</TR>\n");
+ HTTP_Write(request, message, strlen(message));
+ foundone++;
}
sprintf(message,
"<TR>\n"
- "<TD VALIGN=TOP ALIGN=LEFT>\n"
- "%s</td>\n"
+ "<TD VALIGN=TOP ALIGN=LEFT>\n"
+ "%s</td>\n"
"<TD VALIGN=TOP ALIGN=LEFT>%s</TD>\n"
- "</TR>\n",
- thorn, thorn,CCTK_ThornImplementation(thorn));
+ "</TR>\n",
+ thorn, CCTK_ThornImplementation(thorn));
HTTP_Write(request, message, strlen(message));
}
@@ -270,7 +275,7 @@ static int ThornPage(cGH *cctkGH, httpRequest *request, void *data)
/* Start the page */
sprintf(message,
- "<HTML><HEAD><TITLE>Thorn Page : %s</TITLE></HEAD>\n", thorn);
+ "<HTML><HEAD><TITLE>Thorn Page : %s</TITLE></HEAD>\n", thorn);
HTTP_Write(request, message, strlen(message));
@@ -283,13 +288,13 @@ static int ThornPage(cGH *cctkGH, httpRequest *request, void *data)
HTTP_Write(request, message, strlen(message));
sprintf(message,"<P>This page will include all the information about thorn"
- "%s. For now, only information about the parameters is given.</p>",
- thorn);
+ "%s. For now, only information about the parameters is given.</p>",
+ thorn);
sprintf(message,"%s<UL>\n"
- "<LI> <A HREF=\"/Parameters/%s\">Parameters</A>\n"
- "</UL>\n",
- message,thorn);
+ "<LI> <A HREF=\"/Parameters/%s\">Parameters</A>\n"
+ "</UL>\n",
+ message,thorn);
HTTP_Write(request, message, strlen(message));
/* Write out the footer part. */
diff --git a/src/http.c b/src/http.c
index 298cfe2..546ba7d 100644
--- a/src/http.c
+++ b/src/http.c
@@ -112,6 +112,10 @@ int HTTP_ReadFromClient(cGH *cctkGH, void *connection)
{
keepalive = DealWithRequest(cctkGH, &request, buffer, nbytes);
}
+ else
+ {
+ keepalive = 0;
+ }
if(keepalive)
{
@@ -301,9 +305,7 @@ static int DealWithRequest(cGH *cctkGH, httpRequest *request, char *buffer, int
{
char *line;
char *tmp;
- int size;
int start;
- char *token;
char *method;
char *request_uri;
char *http_version;
@@ -382,7 +384,7 @@ static int DealWithRequest(cGH *cctkGH, httpRequest *request, char *buffer, int
printf("Start of request header\n");
#endif
- while(line = NextLine(tmp, &start, bufsize))
+ while((line = NextLine(tmp, &start, bufsize)) != NULL)
{
if(! request->body && *line != 0)
{
@@ -456,6 +458,8 @@ static int AddHeader(httpRequest *request, const char *line)
char *temp;
struct httpHeader *header_line;
+ keylength = -1;
+
/* Split the string */
value = strchr(line, ':');
@@ -557,7 +561,7 @@ static int StripArgs(httpRequest *request, char *request_uri)
request->arguments = Util_HashCreate(INITIAL_SIZE);
/* Parse the argument list */
- *position++;
+ position++;
token = strtok(position, "&");