diff options
author | swhite <swhite@61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1> | 2004-04-07 14:47:59 +0000 |
---|---|---|
committer | swhite <swhite@61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1> | 2004-04-07 14:47:59 +0000 |
commit | 63f4bbb61d14833559a1ba3c72496076b2ed507a (patch) | |
tree | 4e216addc73ff17c130fbb1d0506e0ac698e125c | |
parent | bf87533c8a1b0aa077f306cd9641d3f953b87c1d (diff) |
more stragglers
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPDExtra/trunk@49 61ea717e-8e0c-4c3c-b38e-e9c67f54f1f1
-rw-r--r-- | interface.ccl | 2 | ||||
-rw-r--r-- | src/Groups.c | 93 | ||||
-rw-r--r-- | src/HostNames.c | 14 | ||||
-rw-r--r-- | src/IO.c | 262 | ||||
-rw-r--r-- | src/Processors.c | 70 |
5 files changed, 205 insertions, 236 deletions
diff --git a/interface.ccl b/interface.ccl index 4bae0d5..78e878d 100644 --- a/interface.ccl +++ b/interface.ccl @@ -2,3 +2,5 @@ # $Header$ implements: http_utils + +USES INCLUDE HEADER: HTTPDUtils.h diff --git a/src/Groups.c b/src/Groups.c index cd4fa5c..eb3f248 100644 --- a/src/Groups.c +++ b/src/Groups.c @@ -14,10 +14,11 @@ #include "cctk.h" #include "util_String.h" - -#include "CactusConnect/HTTPD/src/http_Request.h" +#include "HTTPDUtils.h" +/* + * #include "CactusConnect/HTTPD/src/http_Request.h" #include "CactusConnect/HTTPD/src/http_Content.h" - +*/ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusConnect_HTTPDExtra_Groups_c) @@ -76,10 +77,10 @@ int HTTPUTILS_RegisterPages (void) @@*/ static int MessagesPage (const cGH *GH, httpRequest *request, void *data) { - int retval; - size_t message_board_len; - char message[1024], currtime[64], currdate[64]; - const char *const_string, *name, *memo; + int retval = 0; + char currtime[64], currdate[64]; + String *message = String_New(); + const char *temp, *name, *memo; static char *message_board = NULL; @@ -93,6 +94,7 @@ static int MessagesPage (const cGH *GH, httpRequest *request, void *data) if (name && *name && memo && *memo) { + size_t message_board_len = 0; /* concatenate new message, labeled with current date/time, to the message board */ Util_CurrentTime (sizeof (currtime), currtime); @@ -115,7 +117,7 @@ static int MessagesPage (const cGH *GH, httpRequest *request, void *data) if (message_board) { sprintf (message_board + message_board_len, - "<P><STRONG>%s</STRONG> %s %s<BR>\n\n<I>%s</I></P>", + "<p><strong>%s</strong> %s %s<br />\n\n<em>%s</em></p>", name, currtime, currdate, memo); } } @@ -125,60 +127,65 @@ static int MessagesPage (const cGH *GH, httpRequest *request, void *data) (request->http_major_version == 1 && request->http_minor_version < 1)) { /* Older browsers don't understand 303 */ - const_string = "HTTP/1.0 302 Found\r\n" + temp = "HTTP/1.0 302 Found\r\n" "Location: /Messages/index.html\r\n\r\n"; } else { - const_string = "HTTP/1.0 303 See Other\r\n" + temp = "HTTP/1.0 303 See Other\r\n" "Location: /Messages/index.html\r\n\r\n"; } - HTTP_Write (request, const_string, strlen (const_string)); + Send_HTTP (request, temp); return (0); } /* Status message */ - const_string = "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"; - HTTP_Write (request, const_string, strlen (const_string)); + SendHTTP_OK_Header( request ); + + SetHTML_Doctype( message ); + Send_HTTP_String(request, message); /* Start the page */ - const_string = "<HTML><HEAD><TITLE>CACTUS Messages</TITLE>\n"; - HTTP_Write (request, const_string, strlen (const_string)); + Send_HTTP (request, "<html><head><title>CACTUS Messages</title>\n" ); + + SetHTML_HeadHeader( message); + Send_HTTP_String(request, message ); /* Write out the header part */ - HTTP_ContentHeader (GH, 0, sizeof (message), message, NULL); - HTTP_Write (request, message, strlen (message)); - - const_string = "<CENTER><H1>Message Board</H1></CENTER>\n" - "<P>This page can be used to post messages during a " - "simulation. At the moment the messages will disappear " - "when the simulation finishes, but soon there will be an " - "option to save them to a file.</P>\n" - "<CENTER><TABLE><FORM ACTION=\"/Messages/\">\n" - "<TR><TD>Name:</TD>" - "<TD><INPUT TYPE=TEXT SIZE=40 MAXLENGTH=100 NAME=\"name\" " - "VALUE=\"\"></TD></TR>\n" - "<TR><TD VALIGN=TOP>Message:</TD><TD>" - "<TEXTAREA NAME=\"memo\" ROWS=10 COLS=40></TEXTAREA>\n" - "</TD></TR></TABLE>" - "<INPUT TYPE=SUBMIT VALUE=\"Submit Message\"></FORM>\n" - "<TABLE WIDTH=80%%><TR><TD><H2>Messages:</H2></TD></TR>" - "<TR><TD><TABLE WIDTH=\"100%%\" CELLPADDING=5 CELLSPACING=5>" - "<TR><TD BGCOLOR=\"#E9F4D3\">"; - HTTP_Write (request, const_string, strlen (const_string)); - - const_string = message_board ? message_board : + SetHTML_ContentHeader(GH, 0, message, NULL); + Send_HTTP_String(request, message); + + Send_HTTP (request, + "<h1>Message Board</h1>\n" + "<p>This page can be used to post messages during a \n" + "simulation. At the moment the messages will disappear \n" + "when the simulation finishes, but soon there will be an \n" + "option to save them to a file.</p>\n" + "<center><table><form action=\"/Messages/\">\n" + "<tr><td>Name:</td>" + "<td><input type=\"text\" size=\"40\" maxlength=\"100\" name=\"name\" " + "value=\"\"></td></tr>\n" + "<tr><td valign=\"top\">Message:</td><td>" + "<textarea name=\"memo\" rows=\"10\" cols=\"40\"></textarea>\n" + "</td></tr></table>\n" + "<input type=\"submit\" value=\"Submit Message\"></form>\n" + "<table width=\"80%\"><tr><td>\n" + "<h2>Messages:</h2></td></tr>\n" + "<tr><td><table width=\"100%\" cellpadding=\"5\" cellspacing=\"5\">" + "<tr><td bgcolor=\"#E9F4D3\">" ); + + temp = message_board ? message_board : "No messages yet ... use the form above to add one"; - HTTP_Write (request, const_string, strlen (const_string)); + Send_HTTP (request, temp ); - const_string = "</TD></TR></TABLE></TD></TR></TABLE></CENTER>"; - HTTP_Write (request, const_string, strlen (const_string)); + Send_HTTP (request, "</td></tr></table></td></tr></table></center>" ); /* Write out the footer part. */ - HTTP_ContentFooter (GH, 0, sizeof (message), message); - retval = HTTP_Write (request, message, strlen (message)); + SetHTML_ContentFooter(GH, 0, message); + retval = Send_HTTP_String(request, message); - return (retval); + String_Delete( message ); + return retval; } diff --git a/src/HostNames.c b/src/HostNames.c index 2ab8d20..1099883 100644 --- a/src/HostNames.c +++ b/src/HostNames.c @@ -90,8 +90,8 @@ char *hostdata = NULL; @@*/ void HTTPDExtra_CollateHostData(void) { - int rank; - int nprocs; + int rank = 0; + int nprocs = 1; char thisdata[HOSTDATALENGTH+1]; Util_GetHostName(thisdata, HOSTDATALENGTH); @@ -103,9 +103,6 @@ void HTTPDExtra_CollateHostData(void) MPI_Comm_size(MPI_COMM_WORLD, &nprocs); /* Work out if this is proc 0 or not. */ MPI_Comm_rank(MPI_COMM_WORLD, &rank); -#else - nprocs = 1; - rank = 0; #endif if(rank == 0) @@ -155,8 +152,8 @@ const char *HTTPDExtra_RemoteHostName(int host) int main(int argc, char *argv[]) { - int rank; - int nprocs; + int rank = 0; + int nprocs = 1; #ifdef CCTK_MPI MPI_Init(&argc, &argv); @@ -166,9 +163,6 @@ int main(int argc, char *argv[]) /* Work out if this is proc 0 or not. */ MPI_Comm_rank(MPI_COMM_WORLD, &rank); -#else - nprocs = 1; - rank = 0; #endif HTTPDExtra_CollateHostData(); @@ -23,9 +23,11 @@ #include "util_String.h" #include "CactusBase/IOUtil/src/ioutil_AdvertisedFiles.h" - +/* #include "CactusConnect/HTTPD/src/http_Request.h" #include "CactusConnect/HTTPD/src/http_Content.h" +*/ +#include "HTTPDUtils.h" static const char *rcsid = "$Header$"; @@ -207,77 +209,67 @@ static int IOFileListener(const cGH *GH, const char *filename, static int AdvertisedFilePage(const cGH *GH, httpRequest *request, void *data) { int retval; - char message[4098]; + String *message = String_New(); struct httpuFileList *list; + data = data; /* avoid compiler warning about unused parameter */ - /* avoid compiler warning about unused parameter */ - data = data; - - /* Status message */ - strcpy(message,"HTTP/1.0 200 OK\r\n"); - - HTTP_Write(request, message, strlen(message)); - - /* Content-Type */ - strcpy(message,"Content-Type: text/html\r\n\r\n"); - - HTTP_Write(request, message, strlen(message)); + SendHTTP_OK_Header( request ); + SetHTML_Doctype( message ); + Send_HTTP_String(request, message); /* Start the page */ - strcpy(message, "<HTML><HEAD><TITLE>Cactus Downloadable Files</TITLE>\n"); - - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "<html><head>\n" ); + Send_HTTP(request, "<title>Cactus Downloadable Files</title>\n"); + SetHTML_HeadHeader( message); + Send_HTTP_String(request, message ); + /* HTTP_Write out the header part. */ + SetHTML_ContentHeader(GH, 0, message, NULL); + Send_HTTP_String(request, message); - HTTP_ContentHeader(GH, 0, 4098, message,NULL); - - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "<h1>Downloadable Files</h1>"); - strcpy(message, "<center><h1>Downloadable Files</h1></center>"); - - HTTP_Write(request, message, strlen(message)); - - strcpy(message, + Send_HTTP(request, "<p>From this page you can download various output files \n" - "from the simulation. Depending on the software available on your" - " local machine, you can change the browser properties to launch" + "from the simulation. Depending on the software available on your\n" + " local machine, you can change the browser properties to launch\n" " files directly to visualization clients.</p> \n " - "<p>Some of these output files can be directly viewed on " - "a browser on the simulation " - "<a href=\"/Output/viewport.html\">viewport</a></p>" - "<p>Many IO methods have <i>steerable</i> parameters which " - "allow you to e.g. add fields and customise behaviour." - "Depending on your authorisation, you can access the" - " <a href=\"/Parameters/index.html\">parameter steering page</a></p>" - "<center>" - "<table cellspacing=5 cellpadding=5 border=0\n>" + "<p>Some of these output files can be directly viewed on \n" + "a browser on the simulation \n" + "<a href=\"/Output/viewport.html\">viewport</a></p>\n" + "<p>Many IO methods have <i>steerable</i> parameters which \n" + "allow you to e.g. add fields and customise behaviour.\n" + "Depending on your authorisation, you can access the \n" + "<a href=\"/Parameters/index.html\">parameter steering page</a></p>\n" + "<center>\n" + "<table cellspacing=\"5\" cellpadding=\"5\"\n>" "<tr><th>File Name</th><th>Variable</th><th>Description</th></tr>\n"); - HTTP_Write(request, message, strlen(message)); - for (list = filelist; list; list = list->next) { - sprintf(message, - "<tr><td valign=top><A HREF=\"/Output/%s\">%s</A></td>" - "<td valign=top>%s</td><td valign=top>%s</td></tr>\n", - list->linkname, list->filename, - list->data.varname, list->data.description); - HTTP_Write(request, message, strlen(message)); + SetToCString(message, "<tr><td valign=\"top\"><a href=\"/Output/" ); + ConcatCString(message, list->linkname ); + ConcatCString(message, "\">" ); + ConcatCString(message, list->filename ); + ConcatCString(message, "</a></td>" ); + ConcatCString(message, "<td valign=\"top\">" ); + ConcatCString(message, list->data.varname ); + ConcatCString(message, "</td><td valign=\"top\">" ); + ConcatCString(message, list->data.description ); + ConcatCString(message, "</td></tr>\n" ); + + Send_HTTP_String(request, message); } - strcpy(message,"</table></center>"); - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request,"</table></center>"); /* Write out the footer part. */ + SetHTML_ContentFooter(GH, 0, message); + Send_HTTP_String(request, message); - /* HTTP_Write out the footer part. */ - - HTTP_ContentFooter(GH, 0, 4098, message); - - retval = HTTP_Write(request, message, strlen(message)); - + String_Delete( message ); return retval; } @@ -292,10 +284,7 @@ static int AdvertisedFilePage(const cGH *GH, httpRequest *request, void *data) @@*/ static int SendFilePage(const cGH *GH, httpRequest *request, void *data) { - char message[4098]; struct httpuFileList *list; - int filedes; - /* avoid compiler warning about unused parameters */ (void) (GH + 0); @@ -305,16 +294,14 @@ static int SendFilePage(const cGH *GH, httpRequest *request, void *data) { if(!strcmp(list->linkname, request->residual)) { + int filedes; if((filedes = open(list->filename, O_RDONLY | O_BINARY)) >= 0) { - strcpy(message,"HTTP/1.0 200 OK\r\n"); - - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "HTTP/1.0 200 OK\r\n"); - /* Content-Type */ - sprintf(message,"Content-Type: %s\r\n\r\n", list->data.mimetype); - - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "Content-Type: " ); + Send_HTTP(request, list->data.mimetype); + Send_HTTP(request, "\r\n\r\n" ); HTTP_ContentSendFromFile(request, filedes); @@ -322,19 +309,16 @@ static int SendFilePage(const cGH *GH, httpRequest *request, void *data) } else { - strcpy(message,"HTTP/1.0 500 Server Internal Error\r\n"); - HTTP_Write(request, message, strlen(message)); - - /* Content-Type */ - strcpy(message,"Content-Type: text/html\r\n\r\n"); - - HTTP_Write(request, message, strlen(message)); - - sprintf(message, - "<HTML>\n<HEAD><TITLE>Error 500: Internal Error</TITLE></HEAD>\n" - "<BODY><CENTER><p>Unable to open %s</P></BODY>\n</HTML>\n", - list->filename); - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request,"HTTP/1.0 500 Server Internal Error\r\n"); + + Send_HTTP(request, "Content-Type: text/html\r\n\r\n"); + Send_HTTP(request, "<html>\n<head>\n"); + Send_HTTP(request, "<title>Error 500: Internal Error</title>\n"); + Send_HTTP(request, "</head>\n<body>\n"); + Send_HTTP(request, "<center><p>Unable to open " ); + Send_HTTP(request, list->filename ); + Send_HTTP(request, "</p></center>\n"); + Send_HTTP(request, "</body>\n</html>\n" ); } break; } @@ -342,21 +326,18 @@ static int SendFilePage(const cGH *GH, httpRequest *request, void *data) if(!list) { - strcpy(message,"HTTP/1.0 404 Not Found\r\n"); - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request,"HTTP/1.0 404 Not Found\r\n"); - /* Content-Type */ - strcpy(message,"Content-Type: text/html\r\n\r\n"); + Send_HTTP(request,"Content-Type: text/html\r\n\r\n"); - HTTP_Write(request, message, strlen(message)); - - sprintf(message, - "<HTML>\n<HEAD><TITLE>Error 404: Not Found</TITLE></HEAD>\n" - "<BODY><CENTER><p>%s does not exist</P></BODY>\n</HTML>\n", - request->uri); - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "<html>\n<head>\n" ); + Send_HTTP(request, "<title>Error 404: Not Found</title>\n" ); + Send_HTTP(request, "</head>\n<body>\n" ); + Send_HTTP(request, "<center><p>" ); + Send_HTTP(request, request->uri ); + Send_HTTP(request, " does not exist</p></center>\n" ); + Send_HTTP(request, "</body>\n</html>\n" ); } - return 0; } @@ -371,98 +352,95 @@ static int SendFilePage(const cGH *GH, httpRequest *request, void *data) @@*/ static int ViewportFilePage(const cGH *GH, httpRequest *request, void *data) { - int retval; - int foundone; - char message[4098]; + int retval = 0; + int foundone = 0; + String *message = String_New(); struct httpuFileList *list; - /* avoid compiler warning about unused parameters */ (void) (GH + 0); data = data; - /* Status message */ - strcpy(message,"HTTP/1.0 200 OK\r\n"); - - HTTP_Write(request, message, strlen(message)); - - /* Content-Type */ - strcpy(message,"Content-Type: text/html\r\n\r\n"); - - HTTP_Write(request, message, strlen(message)); - + SendHTTP_OK_Header( request ); + + SetHTML_Doctype( message ); + Send_HTTP_String(request, message); + /* Start the page */ - strcpy(message, "<HTML><HEAD><TITLE>Cactus Downloadable Files</TITLE>\n"); + Send_HTTP(request, "<html>\n<head>\n"); + Send_HTTP(request, "<title>Cactus Downloadable Files</title>\n"); - HTTP_Write(request, message, strlen(message)); + SetHTML_HeadHeader( message); + Send_HTTP_String(request, message ); /* HTTP_Write out the header part. */ - HTTP_ContentHeader(GH, 0, 4098, message,NULL); + SetHTML_ContentHeader(GH, 0, message, NULL); + Send_HTTP_String(request, message); - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "<h1>Viewport</h1>"); - strcpy(message, "<center><h1>Viewport</h1></center>"); + Send_HTTP(request, + "<p>This page displays certain types of the output files \n" + "from the <a href=\"/Output/index.html\">download</a> page \n" + "as images (currently only jpegs [mime type image/jpeg]).</p>\n" + "<p>Many IO methods have <dfn>steerable</dfn> parameters which \n" + "allow you to e.g. add fields and customise behaviour.\n" + "Depending on your authorisation, you can access the \n" + "<a href=\"/Parameters/index.html\">parameter steering page</a></p>\n"); - HTTP_Write(request, message, strlen(message)); - - strcpy(message, - "<p>This page displays certain types of the output files " - "from the <a href=\"/Output/index.html\">download</a> page" - " as images (currently only jpegs [mime type image/jpeg]).</p>" - "<p>Many IO methods have <i>steerable</i> parameters which " - "allow you to e.g. add fields and customise behaviour." - "Depending on your authorisation, you can access the" - " <a href=\"/Parameters/index.html\">parameter steering page</a></p>"); - - HTTP_Write(request, message, strlen(message)); - - foundone = 0; for (list = filelist; list; list = list->next) { if (CCTK_Equals(list->data.mimetype,"image/jpeg")) { if (!foundone) { - strcpy(message, + Send_HTTP(request, "<center>" - "<table cellspacing=5 cellpadding=5 border=0\n>" + "<table cellspacing=\"5\" cellpadding=\"5\" border=\"0\"\n>" "<tr><th>Variable<br>File Name</th>\n" "<th>Description</th><th>Image</th></tr>\n"); - HTTP_Write(request, message, strlen(message)); foundone = 1; } - sprintf(message, - "<tr>\n" - "<td valign=center><small>%s<br>\n" - "<A HREF=\"/Output/%s\">%s</A>\n" - "</small></td>\n" - "<td valign=center>%s</td>\n" - "<td valign=center><A HREF=\"/Output/%s\"><img border=0 width=100 height=100 src=\"%s\"></A></td>\n" - "</tr>\n", - list->data.varname,list->linkname, list->filename, - list->data.description,list->linkname,list->linkname); - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "<tr>\n" ); + Send_HTTP(request, "<td valign=center><small>" ); + Send_HTTP(request, list->data.varname ); + Send_HTTP(request, "<br />\n" ); + Send_HTTP(request, "<a href=\"/Output/" ); + Send_HTTP(request, list->linkname ); + Send_HTTP(request, "\">" ); + Send_HTTP(request, list->filename ); + Send_HTTP(request, "</a>\n" ); + Send_HTTP(request, "</small></td>\n" ); + Send_HTTP(request, "<td valign=center>" ); + Send_HTTP(request, list->data.description ); + Send_HTTP(request, "</td>\n" ); + Send_HTTP(request, "<td valign=center><a href=\"/Output/" ); + Send_HTTP(request, list->linkname ); + Send_HTTP(request, "\">" ); + Send_HTTP(request, "<img border=\"0\" width=\"100\" height=\"100\" src=\"" ); + Send_HTTP(request, list->linkname ); + Send_HTTP(request, "\" />" ); + Send_HTTP(request, "</a></td>\n" ); + Send_HTTP(request, "</tr>\n" ); } } if (!foundone) { - strcpy(message,"<center><b><p>No viewable images registered!</p>" - "<b><center>\n"); - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "<center><strong><p>No viewable images registered!</p>" + "<strong></center>\n"); } - strcpy(message,"</table>\n</center>\n"); - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "</table>\n</center>\n"); /* Write out the footer part. */ - HTTP_ContentFooter(GH, 0, 4098, message); - - retval = HTTP_Write(request, message, strlen(message)); + SetHTML_ContentFooter(GH, 0, message); + retval = Send_HTTP_String(request, message); + String_Delete( message ); return retval; } diff --git a/src/Processors.c b/src/Processors.c index 014c344..f0c3527 100644 --- a/src/Processors.c +++ b/src/Processors.c @@ -14,10 +14,12 @@ #include "cctk.h" #include "util_String.h" - +/* #include "CactusConnect/HTTPD/src/http_Request.h" #include "CactusConnect/HTTPD/src/http_Content.h" +*/ #include "httpextra_HostNames.h" +#include "HTTPDUtils.h" static const char *rcsid = "$Header$"; @@ -92,66 +94,52 @@ int HTTPDExtra_RegisterProcessorsPages(void) @@*/ static int ProcessorsPage(const cGH *cctkGH, httpRequest *request, void *data) { - int retval; - int nprocs,np; - char message[4098]; - - /* Status message */ - strcpy(message,"HTTP/1.0 200 OK\r\n"); - - HTTP_Write(request, message, strlen(message)); + int retval = 0; + int nprocs = 0,np = 0; + String *message = String_New(); - /* Content-Type */ - strcpy(message,"Content-Type: text/html\r\n\r\n"); - - HTTP_Write(request, message, strlen(message)); + SendHTTP_OK_Header( request ); + SetHTML_Doctype( message ); + Send_HTTP_String(request, message); /* Start the page */ - strcpy(message,"<HTML><HEAD><TITLE>Cactus Simulation Processor Information</TITLE>\n"); - - HTTP_Write(request, message, strlen(message)); + Send_HTTP(request, "<html>\n<head>\n"); + Send_HTTP(request, "<title>Cactus Simulation Processor Information</title>\n"); + SetHTML_HeadHeader( message); + Send_HTTP_String(request, message ); + /* HTTP_Write out the header part. */ + SetHTML_ContentHeader(cctkGH, 0, message, NULL); + retval = Send_HTTP_String(request, message); + + Send_HTTP(request, "<h1>Processor Information</h1>\n"); - HTTP_ContentHeader(cctkGH,0,strlen(message),message,NULL); - - retval = HTTP_Write(request, message, strlen(message)); - - strcpy(message, "<center><h1>Processor Information</h1></center>\n"); - retval = HTTP_Write(request, message, strlen(message)); - - strcpy(message, + Send_HTTP(request, "<center>\n<table>\n" "<tr>" "<th>Number</th>\n" "<th>Machine Name</th>\n" "</tr>"); - retval = HTTP_Write(request, message, strlen(message)); nprocs = CCTK_nProcs(cctkGH); for (np=0;np<nprocs;np++) { - sprintf(message, - "<tr>" - "<td align=center>%d</td>" - "<td align=left>%s</td>" - "</tr>\n", - np, - HTTPDExtra_RemoteHostName(np) - ); - retval = HTTP_Write(request, message, strlen(message)); + SetToCString( message, "<tr><td align=center>" ); + ConcatDecimal( message, np ); + ConcatCString( message, "</td><td align=left>" ); + ConcatCString( message, HTTPDExtra_RemoteHostName(np) ); + ConcatCString( message, "</td></tr>\n"); + Send_HTTP_String(request, message ); } - strcpy(message, - "</table>\n</center>\n"); - retval = HTTP_Write(request, message, strlen(message)); + retval = Send_HTTP(request, "</table>\n</center>\n"); - /* Write out the footer part. */ - - HTTP_ContentFooter(cctkGH,0,strlen(message),message); - retval = HTTP_Write(request, message, strlen(message)); + SetHTML_ContentFooter(cctkGH, 0, message); + retval = Send_HTTP_String(request, message); + String_Delete( message ); return retval; } |