-const char parsers_rcs[] = "$Id: parsers.c,v 1.230 2011/09/04 11:32:20 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.236 2011/10/23 11:23:55 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
client_host_adder,
client_x_forwarded_for_adder,
client_xtra_adder,
- /* Temporarily disabled: client_accept_encoding_adder, */
client_connection_header_adder,
NULL
};
log_error(LOG_LEVEL_HEADER,
"Removing \'%s\' to imply keep-alive.", *header);
freez(*header);
+ /*
+ * While we imply keep-alive to the server,
+ * we have to remember that the client didn't.
+ */
+ csp->flags &= ~CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE;
}
else
{
static jb_err server_last_modified(struct client_state *csp, char **header)
{
const char *newval;
- char buf[BUFFER_SIZE];
time_t last_modified;
char newheader[50];
/*
* Setting Last-Modified Header to now.
*/
+ char buf[30];
get_http_time(0, buf, sizeof(buf));
freez(*header);
*header = strdup("Last-Modified: ");
}
-#if 0
-/*********************************************************************
- *
- * Function : client_accept_encoding_adder
- *
- * Description : Add an Accept-Encoding header to the client's request
- * that disables compression if the action applies, and
- * the header is not already there. Called from `sed'.
- * Note: For HTTP/1.0, the absence of the header is enough.
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- *
- * Returns : JB_ERR_OK on success, or
- * JB_ERR_MEMORY on out-of-memory error.
- *
- *********************************************************************/
-static jb_err client_accept_encoding_adder(struct client_state *csp)
-{
- if ( ((csp->action->flags & ACTION_NO_COMPRESSION) != 0)
- && (!strcmpic(csp->http->ver, "HTTP/1.1")) )
- {
- return enlist_unique(csp->headers, "Accept-Encoding: identity;q=1.0, *;q=0", 16);
- }
-
- return JB_ERR_OK;
-}
-#endif
-
-
/*********************************************************************
*
* Function : client_xtra_adder
* attempt to work around GNU libc's strptime()
* reporting negative year values when using %Y.
*/
- static const char *time_formats[] = {
+ static const char * const time_formats[] = {
/* Tue, 02-Jun-37 20:00:00 */
"%a, %d-%b-%y %H:%M:%S",
/* Tue, 02 Jun 2037 20:00:00 */
};
unsigned int i;
- /*
- * Zero out gmt to prevent time zone offsets.
- * Documented to be required for GNU libc.
- */
- memset(&gmt, 0, sizeof(gmt));
-
for (i = 0; i < SZ(time_formats); i++)
{
+ /*
+ * Zero out gmt to prevent time zone offsets.
+ * Documented to be required for GNU libc.
+ */
+ memset(&gmt, 0, sizeof(gmt));
+
if (NULL != strptime(header_time, time_formats[i], &gmt))
{
/* Sanity check for GNU libc. */