-const char jcc_rcs[] = "$Id: jcc.c,v 1.60 2001/12/30 14:07:32 steudten Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.61 2002/01/17 21:01:52 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.61 2002/01/17 21:01:52 jongfoster
+ * Moving all our URL and URL pattern parsing code to urlmatch.c.
+ *
* Revision 1.60 2001/12/30 14:07:32 steudten
* - Add signal handling (unix)
* - Add SIGHUP handler (unix)
* Downgrade http version from 1.1 to 1.0 if +downgrade
* action applies
*/
- if (!strcmpic(http->ver, "HTTP/1.1") && csp->action->flags & ACTION_DOWNGRADE)
+ if ( (http->ssl == 0)
+ && (!strcmpic(http->ver, "HTTP/1.1"))
+ && (csp->action->flags & ACTION_DOWNGRADE))
{
freez(http->ver);
http->ver = strdup("HTTP/1.0");
+
+ if (http->ver == NULL)
+ {
+ log_error(LOG_LEVEL_FATAL, "Out of memory downgrading HTTP version");
+ }
}
/*
{
freez(http->cmd);
- http->cmd = strsav(http->cmd, http->gpc);
- http->cmd = strsav(http->cmd, " ");
+ http->cmd = strdup(http->gpc);
+ string_append(&http->cmd, " ");
if (fwd->forward_host)
{
- http->cmd = strsav(http->cmd, http->url);
+ string_append(&http->cmd, http->url);
}
else
{
- http->cmd = strsav(http->cmd, http->path);
+ string_append(&http->cmd, http->path);
}
- http->cmd = strsav(http->cmd, " ");
- http->cmd = strsav(http->cmd, http->ver);
+ string_append(&http->cmd, " ");
+ string_append(&http->cmd, http->ver);
+ if (http->cmd == NULL)
+ {
+ log_error(LOG_LEVEL_FATAL, "Out of memory rewiting SSL command");
+ }
}
enlist(csp->headers, http->cmd);
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
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
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
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
n = strlen(hdr);
/* write the server's (modified) header to