X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=parsers.c;h=4111996f4f91f7691cacaae68e6604d7361b0f06;hp=3f5c626f5940d4fe538384f124d566355d7bce1e;hb=78a7aba27bc91ae8e9122f617dd47bd49399a844;hpb=61783b0364abc9d3e9eb314b7c4bf2651822b121 diff --git a/parsers.c b/parsers.c index 3f5c626f..4111996f 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -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.294 2014/10/18 11:30:04 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -2195,11 +2195,12 @@ static jb_err server_content_type(struct client_state *csp, char **header) */ 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; @@ -2321,8 +2322,7 @@ static jb_err server_content_encoding(struct client_state *csp, char **header) /* * 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. " @@ -3865,15 +3865,21 @@ static jb_err server_http(struct client_state *csp, char **header) { 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 %u", &major_version, + &minor_version, &(csp->http->status))) { log_error(LOG_LEVEL_ERROR, "Failed to parse the response line: %s", *header);