-const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.12 2002/01/23 01:03:32 jongfoster Exp $";
+const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.13 2002/02/21 00:10:37 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
*
* Revisions :
* $Log: cgisimple.c,v $
+ * Revision 1.13 2002/02/21 00:10:37 jongfoster
+ * Adding send-banner?type=auto option
+ *
* Revision 1.12 2002/01/23 01:03:32 jongfoster
* Fixing gcc [CygWin] compiler warnings
*
*
* CGI Parameters :
* type : Selects the type of banner between "trans", "logo",
- * and "auto". Defaults to "logo" if absent or invalid.\r
- * "auto" means to select as if we were image-blocking.\r
+ * and "auto". Defaults to "logo" if absent or invalid.
+ * "auto" means to select as if we were image-blocking.
* (Only the first character really counts).
*
* Returns : JB_ERR_OK on success
jb_err cgi_send_banner(struct client_state *csp,
struct http_response *rsp,
const struct map *parameters)
-{\r
+{
char imagetype = lookup(parameters, "type")[0];
-\r
- if (imagetype == 'a') /* auto */\r
- {\r
- /* Default to logo */\r
- imagetype = 'l';\r
-#ifdef FEATURE_IMAGE_BLOCKING\r
- if ((csp->action->flags & ACTION_IMAGE_BLOCKER) != 0)\r
- {\r
- /* determine HOW images should be blocked */\r
- const char * p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];\r
-\r
- /* and handle accordingly: */\r
- if ((p != NULL) && (0 == strcmpic(p, "blank")))\r
- {\r
- imagetype = 't';\r
- }\r
- }\r
-#endif /* def FEATURE_IMAGE_BLOCKING */\r
- }\r
- \r
+
+ if (imagetype == 'a') /* auto */
+ {
+ /* Default to logo */
+ imagetype = 'l';
+#ifdef FEATURE_IMAGE_BLOCKING
+ if ((csp->action->flags & ACTION_IMAGE_BLOCKER) != 0)
+ {
+ /* determine HOW images should be blocked */
+ const char * p = csp->action->string[ACTION_STRING_IMAGE_BLOCKER];
+
+ /* and handle accordingly: */
+ if ((p != NULL) && (0 == strcmpic(p, "blank")))
+ {
+ imagetype = 't';
+ }
+ }
+#endif /* def FEATURE_IMAGE_BLOCKING */
+ }
+
if ((imagetype != 't') && (imagetype != 'b')) /* transparant/blank */
{
rsp->body = bindup(image_junkbuster_gif_data, image_junkbuster_gif_length);
-const char jcc_rcs[] = "$Id: jcc.c,v 1.61 2002/01/17 21:01:52 jongfoster Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.62 2002/02/20 23:17:23 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.62 2002/02/20 23:17:23 jongfoster
+ * Detecting some out-of memory conditions and exiting with a log message.
+ *
* Revision 1.61 2002/01/17 21:01:52 jongfoster
* Moving all our URL and URL pattern parsing code to urlmatch.c.
*
log_error(LOG_LEVEL_CONNECT, "OK");
hdr = sed(client_patterns, add_client_headers, csp);
- if (hdr == NULL)\r
- {\r
- /* FIXME Should handle error properly */\r
- log_error(LOG_LEVEL_FATAL, "Out of memory parsing client header");\r
- }\r
-\r
+ if (hdr == NULL)
+ {
+ /* FIXME Should handle error properly */
+ log_error(LOG_LEVEL_FATAL, "Out of memory parsing client header");
+ }
+
list_remove_all(csp->headers);
if (fwd->forward_host || (http->ssl == 0))
}
hdr = sed(server_patterns, add_server_headers, csp);
- if (hdr == NULL)\r
- {\r
- /* FIXME Should handle error properly */\r
- log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");\r
- }\r
-\r
+ if (hdr == NULL)
+ {
+ /* FIXME Should handle error properly */
+ log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");
+ }
+
n = strlen(hdr);
if ((write_socket(csp->cfd, hdr, n) != n)
log_error(LOG_LEVEL_ERROR, "Buffer size limit reached! Flushing and stepping back.");
hdr = sed(server_patterns, add_server_headers, csp);
- if (hdr == NULL)\r
- {\r
- /* FIXME Should handle error properly */\r
- log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");\r
- }\r
-\r
+ if (hdr == NULL)
+ {
+ /* FIXME Should handle error properly */
+ log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");
+ }
+
n = strlen(hdr);
byte_count += n;
*/
hdr = sed(server_patterns, add_server_headers, csp);
- if (hdr == NULL)\r
- {\r
- /* FIXME Should handle error properly */\r
- log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");\r
- }\r
-\r
+ if (hdr == NULL)
+ {
+ /* FIXME Should handle error properly */
+ log_error(LOG_LEVEL_FATAL, "Out of memory parsing server header");
+ }
+
n = strlen(hdr);
/* write the server's (modified) header to