-const char parsers_rcs[] = "$Id: parsers.c,v 1.266 2012/11/24 13:58:17 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.269 2012/11/24 14:09:11 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
{ "Request-Range:", 14, client_range },
{ "If-Range:", 9, client_range },
{ "X-Filter:", 9, client_x_filter },
+#if 0
+ { "Transfer-Encoding:", 18, client_transfer_encoding },
+#endif
{ "*", 0, crunch_client_header },
{ "*", 0, filter_header },
{ NULL, 0, NULL }
log_error(LOG_LEVEL_HEADER,
"Content modified with no Content-Length header set. "
"Created: %s.", header);
+ csp->flags |= CSP_FLAG_SERVER_CONTENT_LENGTH_SET;
}
}
#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
+/*********************************************************************
+ *
+ * Function : client_transfer_encoding
+ *
+ * Description : Raise the CSP_FLAG_CHUNKED_CLIENT_BODY flag if
+ * the request body is "chunked"
+ *
+ * XXX: Currently not called through sed() as we
+ * need the flag earlier on. Should be fixed.
+ *
+ * Parameters :
+ * 1 : csp = Current client state (buffers, headers, etc...)
+ * 2 : header = On input, pointer to header to modify.
+ * On output, pointer to the modified header, or NULL
+ * to remove the header. This function frees the
+ * original string if necessary.
+ *
+ * Returns : JB_ERR_OK on success, or
+ *
+ *********************************************************************/
+jb_err client_transfer_encoding(struct client_state *csp, char **header)
+{
+ if (strstr(*header, "chunked"))
+ {
+ csp->flags |= CSP_FLAG_CHUNKED_CLIENT_BODY;
+ log_error(LOG_LEVEL_HEADER, "Expecting chunked client body");
+ }
+
+ return JB_ERR_OK;
+}
+
+
/*********************************************************************
*
* Function : crumble
time_t now;
time_t cookie_time;
long cookie_lifetime = 0;
- int expiry_date_acceptable = 0;
+ enum
+ {
+ NO_EXPIRY_DATE_SPECIFIED,
+ EXPIRY_DATE_ACCEPTABLE,
+ EXPIRY_DATE_UNACCEPTABLE
+ } expiry_date_status = NO_EXPIRY_DATE_SPECIFIED;
/* A variable to store the tag we're working on */
char *cur_tag;
log_error(LOG_LEVEL_ERROR,
"Can't parse \'%s\', send by %s. Unsupported time format?", cur_tag, csp->http->url);
string_move(cur_tag, next_tag);
- expiry_date_acceptable = 0;
+ expiry_date_status = EXPIRY_DATE_UNACCEPTABLE;
}
else
{
"Cookie \'%s\' is already expired and can pass unmodified.", *header);
/* Just in case some clown sets more then one expiration date */
cur_tag = next_tag;
- expiry_date_acceptable = 1;
+ expiry_date_status = EXPIRY_DATE_ACCEPTABLE;
}
else if ((cookie_lifetime != 0) && (cookie_time < (now + cookie_lifetime)))
{
"Its lifetime is below the limit.", *header);
/* Just in case some clown sets more then one expiration date */
cur_tag = next_tag;
- expiry_date_acceptable = 1;
+ expiry_date_status = EXPIRY_DATE_ACCEPTABLE;
}
else
{
string_move(cur_tag, next_tag);
/* That changed the header, need to issue a log message */
- expiry_date_acceptable = 0;
+ expiry_date_status = EXPIRY_DATE_UNACCEPTABLE;
/*
* Note that the next tag has now been moved to *cur_tag,
}
}
- if (!expiry_date_acceptable)
+ if (expiry_date_status != EXPIRY_DATE_ACCEPTABLE)
{
assert(NULL != *header);
- if (cookie_lifetime == 0)
- {
- log_error(LOG_LEVEL_HEADER, "Cookie rewritten to a temporary one: %s",
- *header);
- }
- else
+ if (cookie_lifetime != 0)
{
add_cookie_expiry_date(header, cookie_lifetime);
log_error(LOG_LEVEL_HEADER, "Cookie rewritten to: %s", *header);
}
+ else if (expiry_date_status != NO_EXPIRY_DATE_SPECIFIED)
+ {
+ log_error(LOG_LEVEL_HEADER,
+ "Cookie rewritten to a temporary one: %s", *header);
+ }
}
}