Automated function-comment nitpicking.
[privoxy.git] / cgi.c
diff --git a/cgi.c b/cgi.c
index eb099fd..641af64 100644 (file)
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-const char cgi_rcs[] = "$Id: cgi.c,v 1.41 2002/01/17 20:56:22 jongfoster Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.44 2002/03/05 22:43:45 david__schmidt Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgi.c,v $
@@ -38,6 +38,21 @@ const char cgi_rcs[] = "$Id: cgi.c,v 1.41 2002/01/17 20:56:22 jongfoster Exp $";
  *
  * Revisions   :
  *    $Log: cgi.c,v $
+ *    Revision 1.44  2002/03/05 22:43:45  david__schmidt
+ *    - Better error reporting on OS/2
+ *    - Fix double-slash comment (oops)
+ *
+ *    Revision 1.43  2002/03/05 21:33:45  david__schmidt
+ *    - Re-enable OS/2 building after new parms were added
+ *    - Fix false out of memory report when resolving CGI templates when no IP
+ *      address is available of failed attempt (a la no such domain)
+ *
+ *    Revision 1.42  2002/01/21 00:33:20  jongfoster
+ *    Replacing strsav() with the safer string_append() or string_join().
+ *    Adding map_block_keep() to save a few bytes in the edit-actions-list HTML.
+ *    Adding missing html_encode() to error message generators.
+ *    Adding edit-actions-section-swap and many "shortcuts" to the list of CGIs.
+ *
  *    Revision 1.41  2002/01/17 20:56:22  jongfoster
  *    Replacing hard references to the URL of the config interface
  *    with #defines from project.h
@@ -682,7 +697,16 @@ struct http_response *error_response(struct client_state *csp,
    if (!err) err = map(exports, "hostport", 1, html_encode(csp->http->hostport), 0);
    if (!err) err = map(exports, "path", 1, html_encode(csp->http->path), 0);
    if (!err) err = map(exports, "error", 1, html_encode_and_free_original(safe_strerror(sys_err)), 0);
-   if (!err) err = map(exports, "host-ip", 1, html_encode(csp->http->host_ip_addr_str), 0);
+   if (!err)
+   {
+     err = map(exports, "host-ip", 1, html_encode(csp->http->host_ip_addr_str), 0);
+     if (err)
+     {
+       /* Some failures, like "404 no such domain", don't have an IP address. */
+       err = map(exports, "host-ip", 1, html_encode(csp->http->host), 0);
+     }
+   }
+
 
    if (err)
    {
@@ -747,7 +771,7 @@ void cgi_init_error_messages(void)
       "<head><title>500 Internal JunkBuster Proxy Error</title></head>\r\n"
       "<body>\r\n"
       "<h1>500 Internal JunkBuster Proxy Error</h1>\r\n"
-      "<p>JunkBuster <b>ran out of memory</b> whilst processing your request.</p>\r\n"
+      "<p>JunkBuster <b>ran out of memory</b> while processing your request.</p>\r\n"
       "<p>Please contact your proxy administrator, or try again later</p>\r\n"
       "</body>\r\n"
       "</html>\r\n";
@@ -767,9 +791,9 @@ void cgi_init_error_messages(void)
  *                Returns a statically-allocated error response.
  *
  * Parameters  :
- *           1 :  csp = Current client state (buffers, headers, etc...)
- *           2 :  rsp = http_response data structure for output
- *           3 :  template_name = Name of template that could not
+ *           :  csp = Current client state (buffers, headers, etc...)
+ *           :  rsp = http_response data structure for output
+ *           :  template_name = Name of template that could not
  *                                be loaded.
  *
  * Returns     :  JB_ERR_OK on success
@@ -795,9 +819,9 @@ struct http_response *cgi_error_memory(void)
  *                parameters.
  *
  * Parameters  :
- *           1 :  csp = Current client state (buffers, headers, etc...)
- *           2 :  rsp = http_response data structure for output
- *           3 :  template_name = Name of template that could not
+ *           :  csp = Current client state (buffers, headers, etc...)
+ *           :  rsp = http_response data structure for output
+ *           :  template_name = Name of template that could not
  *                                be loaded.
  *
  * Returns     :  JB_ERR_OK on success
@@ -815,7 +839,7 @@ jb_err cgi_error_no_template(struct client_state *csp,
       "<head><title>500 Internal JunkBuster Proxy Error</title></head>\r\n"
       "<body>\r\n"
       "<h1>500 Internal JunkBuster Proxy Error</h1>\r\n"
-      "<p>JunkBuster encountered an error whilst processing your request:</p>\r\n"
+      "<p>JunkBuster encountered an error while processing your request:</p>\r\n"
       "<p><b>Could not load template file <code>";
    static const char body_suffix[] =
       "</code></b></p>\r\n"
@@ -871,8 +895,8 @@ jb_err cgi_error_no_template(struct client_state *csp,
  *                (query string) for a CGI were wrong.
  *               
  * Parameters  :
- *           1 :  csp = Current client state (buffers, headers, etc...)
- *           2 :  rsp = http_response data structure for output
+ *           :  csp = Current client state (buffers, headers, etc...)
+ *           :  rsp = http_response data structure for output
  *
  * CGI Parameters : none
  *
@@ -1125,10 +1149,10 @@ void free_http_response(struct http_response *rsp)
  *                lines. 
  *
  * Parameters  :
- *           1 :  csp = Current client state (buffers, headers, etc...)
- *           2 :  template_ptr = Destination for pointer to loaded
+ *           :  csp = Current client state (buffers, headers, etc...)
+ *           :  template_ptr = Destination for pointer to loaded
  *                               template text.
- *           3 :  template = name of the HTML template to be used
+ *           :  template = name of the HTML template to be used
  *
  * Returns     :  JB_ERR_OK on success
  *                JB_ERR_MEMORY on out-of-memory error.  
@@ -1224,11 +1248,11 @@ jb_err template_load(struct client_state *csp, char ** template_ptr,
  *                interpretation.
  *
  * Parameters  :
- *           1 :  template_ptr = IN: Template to be filled out.
+ *           :  template_ptr = IN: Template to be filled out.
  *                                   Will be free()d.
  *                               OUT: Filled out template.
  *                                    Caller must free().
- *           2 :  exports = map with fill in symbol -> name pairs
+ *           :  exports = map with fill in symbol -> name pairs
  *
  * Returns     :  JB_ERR_OK on success
  *                JB_ERR_MEMORY on out-of-memory error
@@ -1331,9 +1355,9 @@ jb_err template_fill(char **template_ptr, const struct map *exports)
  *                this function also frees the passed "exports" map.
  *
  * Parameters  :
- *           1 :  csp = Client state
- *           2 :  templatename = name of the HTML template to be used
- *           3 :  exports = map with fill in symbol -> name pairs.
+ *           :  csp = Client state
+ *           :  templatename = name of the HTML template to be used
+ *           :  exports = map with fill in symbol -> name pairs.
  *                          Will be freed by this function.
  *
  * Returns     :  JB_ERR_OK on success