diff options
Diffstat (limited to 'src/Content.c')
-rw-r--r-- | src/Content.c | 260 |
1 files changed, 14 insertions, 246 deletions
diff --git a/src/Content.c b/src/Content.c index e7d1541..405eb32 100644 --- a/src/Content.c +++ b/src/Content.c @@ -56,8 +56,6 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data); static int ShowStaticPage(cGH *cctkGH, httpRequest *request, void *data); -static int TestPage(cGH *cctkGH, httpRequest *request, void *data); - static int AuthPage(cGH *cctkGH, httpRequest *request, void *data); static int CompareStrings(const void *string1, const void *string2); @@ -120,14 +118,13 @@ int HTTP_RegisterPages(void) RegisterParameterPages(); - /* Register a test page */ - HTTP_RegisterPage("/test_page", TestPage, NULL); + /* Register a test authentication page. */ HTTP_RegisterPage("/auth_page", AuthPage, NULL); HTTP_AuthAddUser("user","goodale","foo","none"); - /* Registrer images */ + /* Register images */ RegisterImages(); } @@ -746,194 +743,24 @@ static int ShowStaticPage(cGH *cctkGH, httpRequest *request, void *data) /****************************************************************************** - ***************************** Test Page ************************************** + ********************** Authentication test page ****************************** ******************************************************************************/ -static char *test_page="\n\ -<html>\ - <head>\ - <title>Advanced Query</title>\ - </head>\ - <body bgcolor=\"#FFFFFF\" background=\"/Images/cac_bord.gif\" \ - link=\"#1B831D\" vlink=\"#768000\" alink=\"#00FF00\"> \ - <table width=80%>\ - <tr>\ - <td><img src=\"/Images/cac_space.gif\"></td>\ - <td>\ -<TABLE><TR><TD NOWRAP=\"1\"><FONT SIZE=\"+3\"><font color=\"#047704\"><H1>Query Problem Reports</H1></font></FONT></TD> <TD WIDTH=\"100%\"> </TD> <TD NOWRAP=\"1\"><tt><small>User: goodale<br>Database: normal<br>Access: edit</tt></small></TD></TR></TABLE><FORM ACTION=\"http:/test_page\" ENCTYPE=\"application/x-www-form-urlencoded\">\ -<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"submit query\"> or <INPUT TYPE=\"reset\" VALUE=\"reset\"><hr><center><table border=1 bgcolor=#d0d0d0><caption>Search All Text</caption><tr bgcolor=#9fbdf9><th nowrap>Search these text fields<th nowrap>using regular expression</tr>\ -<tr><td>Single-line text fields:<td><INPUT TYPE=\"text\" NAME=\"text\" SIZE=30></tr>\ -<tr><td>Multi-line text fields:<td><INPUT TYPE=\"text\" NAME=\"multitext\" SIZE=30></tr>\ -</table>\ -<table border=1 bgcolor=#d0d0d0><caption>Search By Date</caption><tr bgcolor=#9fbdf9><th nowrap>Date Search<th nowrap>Example: <tt>1999-04-01 05:00 GMT</tt></tr>\ -<tr><td>Arrived After:<td><INPUT TYPE=\"text\" NAME=\"arrivedafter\" SIZE=30></tr>\ -<tr><td>Arrived Before:<td><INPUT TYPE=\"text\" NAME=\"arrivedbefore\" SIZE=30></tr>\ -<tr><td>Modified After:<td><INPUT TYPE=\"text\" NAME=\"modifiedafter\" SIZE=30></tr>\ -<tr><td>Modified Before:<td><INPUT TYPE=\"text\" NAME=\"modifiedbefore\" SIZE=30></tr>\ -<tr><td>Closed After:<td><INPUT TYPE=\"text\" NAME=\"closedafter\" SIZE=30></tr>\ -<tr><td>Closed Before:<td><INPUT TYPE=\"text\" NAME=\"closedbefore\" SIZE=30></tr>\ -</table>\ -<table border=1 bgcolor=#d0d0d0><caption>Search Individual Fields</caption><tr bgcolor=#9fbdf9><th nowrap>Search this field<th nowrap>using regular expression, or<th nowrap>using multi-selection</tr>\ -<tr valign=top><td>Category:<td><INPUT TYPE=\"text\" NAME=\"category\" SIZE=30><td><SELECT NAME=\"category\" SIZE=4 MULTIPLE>\ -<OPTION VALUE=\"all\">all\ -<OPTION VALUE=\"CVS\">CVS\ -<OPTION VALUE=\"Cactus\">Cactus\ -<OPTION VALUE=\"CactusBase\">CactusBase\ -<OPTION VALUE=\"CactusEinstein-ADM\">CactusEinstein-ADM\ -<OPTION VALUE=\"CactusEinstein-ADMConstraints\">CactusEinstein-ADMConstraints\ -<OPTION VALUE=\"CactusEinstein-BMA\">CactusEinstein-BMA\ -<OPTION VALUE=\"CactusEinstein-Einstein\">CactusEinstein-Einstein\ -<OPTION VALUE=\"CactusEinstein-IDAnalyticBH\">CactusEinstein-IDAnalyticBH\ -<OPTION VALUE=\"CactusEinstein-IDLinearWaves\">CactusEinstein-IDLinearWaves\ -<OPTION VALUE=\"CactusEinstein\">CactusEinstein\ -<OPTION VALUE=\"CactusElliptic-EllBase\">CactusElliptic-EllBase\ -<OPTION VALUE=\"CactusElliptic-EllPETSc\">CactusElliptic-EllPETSc\ -<OPTION VALUE=\"CactusElliptic-EllSOR\">CactusElliptic-EllSOR\ -<OPTION VALUE=\"CactusElliptic-EllTest\">CactusElliptic-EllTest\ -<OPTION VALUE=\"CactusElliptic\">CactusElliptic\ -<OPTION VALUE=\"CactusPUGH-Interp\">CactusPUGH-Interp\ -<OPTION VALUE=\"CactusPUGH-PUGH\">CactusPUGH-PUGH\ -<OPTION VALUE=\"CactusPUGH\">CactusPUGH\ -<OPTION VALUE=\"CactusPUGHIO-IOASCII\">CactusPUGHIO-IOASCII\ -<OPTION VALUE=\"CactusPUGHIO-IOFlexIO\">CactusPUGHIO-IOFlexIO\ -<OPTION VALUE=\"CactusPUGHIO-IOHDF5\">CactusPUGHIO-IOHDF5\ -<OPTION VALUE=\"CactusPUGHIO-IsoSurfacer\">CactusPUGHIO-IsoSurfacer\ -<OPTION VALUE=\"CactusPUGHIO\">CactusPUGHIO\ -<OPTION VALUE=\"CactusWave\">CactusWave\ -<OPTION VALUE=\"Compiler\">Compiler\ -<OPTION VALUE=\"Documentation\">Documentation\ -<OPTION VALUE=\"IO\">IO\ -<OPTION VALUE=\"Thorns\">Thorns\ -<OPTION VALUE=\"Webpage\">Webpage\ -<OPTION VALUE=\"external\">external\ -</SELECT>\ -\ -<tr valign=top><td>Synopsis:<td><INPUT TYPE=\"text\" NAME=\"synopsis\" SIZE=30><td> \ -<tr valign=top><td>Confidential:<td><INPUT TYPE=\"text\" NAME=\"confidential\" SIZE=30><td><SELECT NAME=\"confidential\" SIZE=3 MULTIPLE>\ -<OPTION VALUE=\"all\">all\ -<OPTION VALUE=\"no\">no\ -<OPTION VALUE=\"yes\">yes\ -</SELECT>\ -\ -<tr valign=top><td>Severity:<td><INPUT TYPE=\"text\" NAME=\"severity\" SIZE=30><td><SELECT NAME=\"severity\" SIZE=4 MULTIPLE>\ -<OPTION VALUE=\"all\">all\ -<OPTION VALUE=\"critical\">critical\ -<OPTION VALUE=\"serious\">serious\ -<OPTION VALUE=\"non-critical\">non-critical\ -</SELECT>\ -\ -<tr valign=top><td>Priority:<td><INPUT TYPE=\"text\" NAME=\"priority\" SIZE=30><td><SELECT NAME=\"priority\" SIZE=4 MULTIPLE>\ -<OPTION VALUE=\"all\">all\ -<OPTION VALUE=\"high\">high\ -<OPTION VALUE=\"medium\">medium\ -<OPTION VALUE=\"low\">low\ -</SELECT>\ -\ -<tr valign=top><td>Responsible:<td><INPUT TYPE=\"text\" NAME=\"responsible\" SIZE=30><td><SELECT NAME=\"responsible\" SIZE=4 MULTIPLE>\ -<OPTION VALUE=\"all\">all\ -<OPTION VALUE=\"allen\">allen\ -<OPTION VALUE=\"bernd\">bernd\ -<OPTION VALUE=\"gnats-admin\">gnats-admin\ -<OPTION VALUE=\"goodale\">goodale\ -<OPTION VALUE=\"lanfer\">lanfer\ -<OPTION VALUE=\"tradke\">tradke\ -<OPTION VALUE=\"werner\">werner\ -</SELECT>\ -\ -<tr valign=top><td>State:<td><INPUT TYPE=\"text\" NAME=\"state\" SIZE=30><br><INPUT TYPE=\"checkbox\" NAME=\"ignoreclosed\" VALUE=\"Ignore Closed\" CHECKED>Ignore Closed<td><SELECT NAME=\"state\" SIZE=4 MULTIPLE>\ -<OPTION VALUE=\"all\">all\ -<OPTION VALUE=\"open\">open\ -<OPTION VALUE=\"analyzed\">analyzed\ -<OPTION VALUE=\"suspended\">suspended\ -<OPTION VALUE=\"feedback\">feedback\ -<OPTION VALUE=\"Cactus4.0beta7\">Cactus4.0beta7\ -<OPTION VALUE=\"Cactus4.0beta8\">Cactus4.0beta8\ -<OPTION VALUE=\"Cactus4.0beta9\">Cactus4.0beta9\ -<OPTION VALUE=\"closed\">closed\ -</SELECT>\ -\ -<tr valign=top><td>Class:<td><INPUT TYPE=\"text\" NAME=\"class\" SIZE=30><td><SELECT NAME=\"class\" SIZE=4 MULTIPLE>\ -<OPTION VALUE=\"all\">all\ -<OPTION VALUE=\"sw-bug\">sw-bug\ -<OPTION VALUE=\"doc-bug\">doc-bug\ -<OPTION VALUE=\"support\">support\ -<OPTION VALUE=\"feature-request\">feature-request\ -<OPTION VALUE=\"mistaken\">mistaken\ -<OPTION VALUE=\"duplicate\">duplicate\ -</SELECT>\ -\ -<tr valign=top><td>Submitter-Id:<td><INPUT TYPE=\"text\" NAME=\"submitter_id\" SIZE=30><td><SELECT NAME=\"submitter_id\" SIZE=3 MULTIPLE>\ -<OPTION VALUE=\"all\">all\ -<OPTION VALUE=\"test\">test\ -<OPTION VALUE=\"unknown\">unknown\ -</SELECT>\ -\ -<tr valign=top><td>Originator:<td><INPUT TYPE=\"text\" NAME=\"originator\" SIZE=30><td> \ -<tr valign=top><td>Release:<td><INPUT TYPE=\"text\" NAME=\"release\" SIZE=30><td> \ -</table>\ -<table border=1 bgcolor=#d0d0d0><caption>Select Columns to Display</caption><tr valign=top><td>Display these columns:<td><SELECT NAME=\"columns\" SIZE=14 MULTIPLE>\ -<OPTION SELECTED VALUE=\"category\">category\ -<OPTION VALUE=\"confidential\">confidential\ -<OPTION SELECTED VALUE=\"state\">state\ -<OPTION VALUE=\"class\">class\ -<OPTION VALUE=\"severity\">severity\ -<OPTION VALUE=\"priority\">priority\ -<OPTION VALUE=\"release\">release\ -<OPTION SELECTED VALUE=\"responsible\">responsible\ -<OPTION VALUE=\"submitter_id\">submitter_id\ -<OPTION SELECTED VALUE=\"originator\">originator\ -<OPTION VALUE=\"arrival_date\">arrival_date\ -<OPTION VALUE=\"last_modified\">last_modified\ -<OPTION VALUE=\"closed_date\">closed_date\ -<OPTION SELECTED VALUE=\"synopsis\">synopsis\ -</SELECT>\ -</table>\ -</center>\ -<hr><INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"submit query\"> or <INPUT TYPE=\"reset\" VALUE=\"reset\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"confidential\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"columns\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"state\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"priority\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"submitter_id\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"severity\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"class\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"ignoreclosed\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"responsible\"><INPUT TYPE=\"hidden\" NAME=\".cgifields\" VALUE=\"category\"></FORM><HR><!-- Included footer with navigation bar -->\ - <div align=\"center\">\ - <table border=\"0\" width=\"100%\">\ - <tr>\ - <td bgcolor=\"#E9F4D3\" align=\"center\" \ - nowrap><font face=\"arial,helvetica\"><small><a href=\"/index.html\">Welcome</a></small></font>\ - </td>\ - <td bgcolor=\"#E9F4D3\" align=\"center\" \ - nowrap><font face=\"arial,helvetica\"><small><a href=\"/Documentation.html\">Documentation</a></small></font>\ - </td>\ - <td bgcolor=\"#E9F4D3\" align=\"center\" \ - nowrap><font face=\"arial,helvetica\"><small><a href=\"/Download.html\">Download</a></small></font>\ - </td>\ - <td bgcolor=\"#E9F4D3\" align=\"center\" \ - nowrap><font face=\"arial,helvetica\"><small><a href=\"/Development.html\">Development</a></small></font>\ - </td>\ - <td bgcolor=\"#E9F4D3\" align=\"center\" \ - nowrap><font face=\"arial,helvetica\"><small><a href=\"/Showcase.html\">Showcase</a></small></font>\ - </td>\ - <td bgcolor=\"#E9F4D3\" align=\"center\" \ - nowrap><font face=\"arial,helvetica\"><small><a href=\"/Links.html\">Links</a></small></font> \ - </td>\ - </tr>\ - <tr>\ - <td align=\"center\" colspan=\"6\">\ - <a href=\"/index.html\"><img src=\"/images/wwwcactuscodeorg_small.jpg\" \ - border=\"0\" alt=\"CactusCode\"></a><br>\ - <a href=\"mailto:cactus@cactuscode.org\">cactus@cactuscode.org</a>\ - <!--#config timefmt=\"Last Modified: <i>%a %b %d, %Y</i>\" -->\ - <!--#echo var=\"LAST_MODIFIED\" -->\ - </td>\ - </tr>\ - </table>\ - </div>\ -</td></tr></table></BODY></HTML>"; + +static const char *notauthorized_page = +"<HTML>\n<HEAD><TITLE>Error 401: Not Authorized</TITLE></HEAD>\ +<BODY>You are not authorized to access this page</BODY>\n<HTML>\n"; + +static const char *authorized_page = +"<HTML>\n<HEAD><TITLE>Authorized</TITLE></HEAD>\ +<BODY>Congratulations !</BODY>\n<HTML>\n"; /*@@ - @routine TestPage - @date Thu Sep 14 20:42:37 2000 + @routine AuthPage + @date Fri Sep 15 12:52:37 2000 @author Tom Goodale @desc - A test page for showing how to access arguments and header lines - and generally playing about. - If this is called with no arguments, it displays a form. If it is - called with arguments it displays some info. + Test page for authentication. @enddesc @calls @calledby @@ -942,65 +769,6 @@ static char *test_page="\n\ @endhistory @@*/ -static int TestPage(cGH *cctkGH, httpRequest *request, void *data) -{ - int retval; - char message[1024]; - - const char *value; - - strcpy(message,"HTTP/1.0 200 OK\r\n"); - - HTTP_Write(request, message, strlen(message)); - - strcpy(message,"Content-Type: text/html\r\n\r\n"); - - HTTP_Write(request, message, strlen(message)); - - if(request->n_arguments == 0) - { - retval = HTTP_Write(request, test_page, strlen(test_page)); - } - else - { - strcpy(message, "<html><head><title>Advanced Query</title></head>" - "<body><H1> Query Result </H1><br>"); - - HTTP_Write(request, message, strlen(message)); - - sprintf(message, "Number of arguments is %d<hr>\n", request->n_arguments); - - HTTP_Write(request, message, strlen(message)); - - value = HTTP_ArgumentValue(request, "text"); - - sprintf(message, "text = %s<hr>\n", value); - - HTTP_Write(request, message, strlen(message)); - - value = HTTP_HeaderValue(request, "Host"); - - sprintf(message, "Host header = %s<hr>\n", value); - - HTTP_Write(request, message, strlen(message)); - - strcpy(message, "</body></html>"); - - retval = HTTP_Write(request, message, strlen(message)); - } - - return retval; -} - - -static const char *notauthorized_page = -"<HTML>\n<HEAD><TITLE>Error 401: Not Authorized</TITLE></HEAD>\ -<BODY>You are not authorized to access this page</BODY>\n<HTML>\n"; - -static const char *authorized_page = -"<HTML>\n<HEAD><TITLE>Authorized</TITLE></HEAD>\ -<BODY>Congratulations !</BODY>\n<HTML>\n"; - static int AuthPage(cGH *cctkGH, httpRequest *request, void *data) { int retval; |