Moving file version information to a separate CGI page.
authorjongfoster <jongfoster@users.sourceforge.net>
Wed, 1 Aug 2001 21:19:22 +0000 (21:19 +0000)
committerjongfoster <jongfoster@users.sourceforge.net>
Wed, 1 Aug 2001 21:19:22 +0000 (21:19 +0000)
cgi.c
cgi.h
templates/show-status

diff --git a/cgi.c b/cgi.c
index 7d3fb08..83bd2cb 100644 (file)
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-const char cgi_rcs[] = "$Id: cgi.c,v 1.13 2001/07/30 22:08:36 jongfoster Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.14 2001/08/01 00:19:03 jongfoster Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgi.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgi.c,v $
@@ -36,6 +36,10 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.13 2001/07/30 22:08:36 jongfoster Exp $";
  *
  * Revisions   :
  *    $Log: cgi.c,v $
  *
  * Revisions   :
  *    $Log: cgi.c,v $
+ *    Revision 1.14  2001/08/01 00:19:03  jongfoster
+ *    New function: map_conditional() for an if-then-else syntax.
+ *    Changing to use new version of show_defines()
+ *
  *    Revision 1.13  2001/07/30 22:08:36  jongfoster
  *    Tidying up #defines:
  *    - All feature #defines are now of the form FEATURE_xxx
  *    Revision 1.13  2001/07/30 22:08:36  jongfoster
  *    Tidying up #defines:
  *    - All feature #defines are now of the form FEATURE_xxx
@@ -159,10 +163,13 @@ const char cgi_h_rcs[] = CGI_H_VERSION;
 const struct cgi_dispatcher cgi_dispatcher[] = {
    { "show-status", 
          11, cgi_show_status,  
 const struct cgi_dispatcher cgi_dispatcher[] = {
    { "show-status", 
          11, cgi_show_status,  
-         "Show information about the version and configuration" }, 
+         "Show information about the current configuration" }, 
    { "show-url-info",
          13, cgi_show_url_info, 
          "Show which actions apply to a URL and why"  },
    { "show-url-info",
          13, cgi_show_url_info, 
          "Show which actions apply to a URL and why"  },
+   { "show-version", 
+         12, cgi_show_version,  
+         "Show the source code version numbers" }, 
    { "send-banner",
          11, cgi_send_banner, 
          "HIDE Send the transparent or \"Junkbuster\" gif" },
    { "send-banner",
          11, cgi_send_banner, 
          "HIDE Send the transparent or \"Junkbuster\" gif" },
@@ -385,6 +392,39 @@ int cgi_send_banner(struct client_state *csp, struct http_response *rsp,
 }
 
 
 }
 
 
+/*********************************************************************
+ *
+ * Function    :  cgi_show_version
+ *
+ * Description :  CGI function that returns a a web page describing the
+ *                file versions of IJB.
+ *
+ * Parameters  :
+ *           1 :  csp = Current client state (buffers, headers, etc...)
+ *           2 :  rsp = http_response data structure for output
+ *           3 :  parameters = map of cgi parameters
+ *
+ * CGI Parameters :
+ *           type : Selects the type of banner between "trans" and "jb".
+ *                  Defaults to "jb" if absent or != "trans".
+ *
+ * Returns     :  0
+ *
+ *********************************************************************/
+int cgi_show_version(struct client_state *csp, struct http_response *rsp,
+                     struct map *parameters)
+{
+   struct map *exports = default_exports(csp, "show-version");
+
+   exports = map(exports, "sourceversions", 1, show_rcs(), 0);  
+
+   rsp->body = fill_template(csp, "show-version", exports);
+   free_map(exports);
+   return(0);
+
+}
+
 /*********************************************************************
  *
  * Function    :  cgi_show_status
 /*********************************************************************
  *
  * Function    :  cgi_show_status
@@ -489,8 +529,6 @@ int cgi_show_status(struct client_state *csp, struct http_response *rsp,
    exports = map(exports, "invocation", 1, s, 0);
 
    exports = map(exports, "options", 1, csp->config->proxy_args, 1);
    exports = map(exports, "invocation", 1, s, 0);
 
    exports = map(exports, "options", 1, csp->config->proxy_args, 1);
-   s =   show_rcs();
-   exports = map(exports, "sourceversions", 1, s, 0);  
    exports = show_defines(exports);
 
 #ifdef FEATURE_STATISTICS
    exports = show_defines(exports);
 
 #ifdef FEATURE_STATISTICS
@@ -786,6 +824,15 @@ struct http_response *finish_http_response(struct http_response *rsp)
 
    /* 
     * Fill in the default headers FIXME: Are these correct? sequence OK? check rfc!
 
    /* 
     * Fill in the default headers FIXME: Are these correct? sequence OK? check rfc!
+    * FIXME: Should have:
+    *   "JunkBuster" GIF: Last-Modified: any *fixed* date in the past (as now).
+    *                     Expires: 5 minutes after the time when reply sent
+    *   CGI, "blocked", & all other requests:
+    *        Last-Modified: Time when reply sent
+    *        Expires:       Time when reply sent
+    *       "Cache-Control: no-cache"
+    *        
+    * See http://www.w3.org/Protocols/rfc2068/rfc2068
     */
    enlist_unique(rsp->headers, "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT", 14);
    enlist_unique(rsp->headers, "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT", 8);
     */
    enlist_unique(rsp->headers, "Last-Modified: Thu Jul 31, 1997 07:42:22 pm GMT", 14);
    enlist_unique(rsp->headers, "Expires:       Thu Jul 31, 1997 07:42:22 pm GMT", 8);
diff --git a/cgi.h b/cgi.h
index 9008744..7be5c8e 100644 (file)
--- a/cgi.h
+++ b/cgi.h
@@ -1,6 +1,6 @@
 #ifndef CGI_H_INCLUDED
 #define CGI_H_INCLUDED
 #ifndef CGI_H_INCLUDED
 #define CGI_H_INCLUDED
-#define CGI_H_VERSION "$Id: cgi.h,v 1.8 2001/07/30 22:08:36 jongfoster Exp $"
+#define CGI_H_VERSION "$Id: cgi.h,v 1.9 2001/08/01 00:17:54 jongfoster Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgi.h,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgi.h,v $
@@ -38,6 +38,9 @@
  *
  * Revisions   :
  *    $Log: cgi.h,v $
  *
  * Revisions   :
  *    $Log: cgi.h,v $
+ *    Revision 1.9  2001/08/01 00:17:54  jongfoster
+ *    Adding prototype for map_conditional
+ *
  *    Revision 1.8  2001/07/30 22:08:36  jongfoster
  *    Tidying up #defines:
  *    - All feature #defines are now of the form FEATURE_xxx
  *    Revision 1.8  2001/07/30 22:08:36  jongfoster
  *    Tidying up #defines:
  *    - All feature #defines are now of the form FEATURE_xxx
@@ -86,6 +89,8 @@ extern struct map *parse_cgi_parameters(char *argstring);
 /*
  * CGI functions
  */
 /*
  * CGI functions
  */
+extern int cgi_show_version(struct client_state *csp, struct http_response *rsp,
+                            struct map *parameters);
 extern int cgi_default(struct client_state *csp, struct http_response *rsp,
                        struct map *parameters);
 extern int cgi_show_status(struct client_state *csp, struct http_response *rsp,
 extern int cgi_default(struct client_state *csp, struct http_response *rsp,
                        struct map *parameters);
 extern int cgi_show_status(struct client_state *csp, struct http_response *rsp,
index c485c2d..2d3576d 100644 (file)
           <tr> 
             <th>#define</th> <th>Enabled?</th> <th>Effects when enabled</th>
           </tr>
           <tr> 
             <th>#define</th> <th>Enabled?</th> <th>Effects when enabled</th>
           </tr>
-          <tr>
-             <td><code>FEATURE_PTHREAD</code></td>
-             <td>@if-FEATURE_PTHREAD-then@ Yes @else-not-FEATURE_PTHREAD@ No @endif-FEATURE_PTHREAD@</td>
-             <td>Use POSIX threads rather than native threads</td>
-          </tr>
           <tr>
              <td><code>FEATURE_ACL</code></td>
              <td>@if-FEATURE_ACL-then@ Yes @else-not-FEATURE_ACL@ No @endif-FEATURE_ACL@</td>
           <tr>
              <td><code>FEATURE_ACL</code></td>
              <td>@if-FEATURE_ACL-then@ Yes @else-not-FEATURE_ACL@ No @endif-FEATURE_ACL@</td>
              <td>@if-FEATURE_KILL_POPUPS-then@ Yes @else-not-FEATURE_KILL_POPUPS@ No @endif-FEATURE_KILL_POPUPS@</td>
              <td>Allows the +no-popups action, to block JavaScript popups.</td>
           </tr>
              <td>@if-FEATURE_KILL_POPUPS-then@ Yes @else-not-FEATURE_KILL_POPUPS@ No @endif-FEATURE_KILL_POPUPS@</td>
              <td>Allows the +no-popups action, to block JavaScript popups.</td>
           </tr>
+          <tr>
+             <td><code>FEATURE_PTHREAD</code></td>
+             <td>@if-FEATURE_PTHREAD-then@ Yes @else-not-FEATURE_PTHREAD@ No @endif-FEATURE_PTHREAD@</td>
+             <td>Use POSIX threads rather than native threads</td>
+          </tr>
           <tr>
              <td><code>FEATURE_STATISTICS</code></td>
              <td>@if-FEATURE_STATISTICS-then@ Yes @else-not-FEATURE_STATISTICS@ No @endif-FEATURE_STATISTICS@</td>
           <tr>
              <td><code>FEATURE_STATISTICS</code></td>
              <td>@if-FEATURE_STATISTICS-then@ Yes @else-not-FEATURE_STATISTICS@ No @endif-FEATURE_STATISTICS@</td>
       </td>
     </tr>
 
       </td>
     </tr>
 
-    <tr>
-      <td bgcolor=#eeeeee>
-        <h2>Source code versions:</h2>
-        <blockquote><pre>@sourceversions@</pre></blockquote>
-      </td>
-    </tr>
-
     <tr>
       <td bgcolor=#dddddd>
         <h2>More Junkbuster:</h2>
     <tr>
       <td bgcolor=#dddddd>
         <h2>More Junkbuster:</h2>