-const char parsers_rcs[] = "$Id: parsers.c,v 1.291 2014/07/25 11:56:54 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.296 2014/11/03 14:41:12 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
csp->flags |= CSP_FLAG_SERVER_KEEP_ALIVE_TIMEOUT_SET;
}
+ freez(*header);
+
return JB_ERR_OK;
}
*/
if ((csp->content_type & CT_TEXT) || (csp->action->flags & ACTION_FORCE_TEXT_MODE))
{
+ jb_err err;
freez(*header);
*header = strdup_or_die("Content-Type: ");
- string_append(header, csp->action->string[ACTION_STRING_CONTENT_TYPE]);
- if (header == NULL)
+ err = string_append(header, csp->action->string[ACTION_STRING_CONTENT_TYPE]);
+ if (JB_ERR_OK != err)
{
log_error(LOG_LEVEL_HEADER, "Insufficient memory to replace Content-Type!");
return JB_ERR_MEMORY;
/*
* Log a warning if the user expects the content to be filtered.
*/
- if ((csp->rlist != NULL) &&
- (!list_is_empty(csp->action->multi[ACTION_MULTI_FILTER])))
+ if (content_filters_enabled(csp->action))
{
log_error(LOG_LEVEL_INFO,
"SDCH-compressed content detected, content filtering disabled. "
{
p++;
reason_phrase = strchr(p, ' ');
- if (reason_phrase != NULL)
- {
- reason_phrase++;
- }
}
- if ((reason_phrase == NULL) || (reason_phrase[0] == '\0') ||
- (3 != sscanf(*header, "HTTP/%u.%u %u", &major_version,
- &minor_version, &(csp->http->status))))
+ if (reason_phrase != NULL)
+ {
+ reason_phrase++;
+ }
+ else
+ {
+ log_error(LOG_LEVEL_ERROR,
+ "Response line lacks reason phrase: %s", *header);
+ reason_phrase="";
+ }
+
+ if (3 != sscanf(*header, "HTTP/%u.%u %d", &major_version,
+ &minor_version, &(csp->http->status)))
{
log_error(LOG_LEVEL_ERROR,
"Failed to parse the response line: %s", *header);
length = sizeof("HTTP/1.1 200 ") + strlen(reason_phrase) + 1;
new_response_line = malloc_or_die(length);
- snprintf(new_response_line, length, "HTTP/%u.%u %u %s",
+ snprintf(new_response_line, length, "HTTP/%u.%u %d %s",
major_version, minor_version, csp->http->status, reason_phrase);
if (0 != strcmp(*header, new_response_line))