X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=parsers.c;h=96729a491bb16e5d9039439153b90d03d3c9467d;hp=88530a855c6786e9b6912d7f8c73697558fb6499;hb=892b30a145ea051b5f9f5a46967175cede143a31;hpb=cd275efe90ca39d461537daf389e79a3cd79e507 diff --git a/parsers.c b/parsers.c index 88530a85..96729a49 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.147 2008/11/04 17:20:31 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.149 2008/11/21 18:39:53 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -44,6 +44,15 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.147 2008/11/04 17:20:31 fabiankei * * Revisions : * $Log: parsers.c,v $ + * Revision 1.149 2008/11/21 18:39:53 fabiankeil + * In case of CONNECT requests there's no point + * in trying to keep the connection alive. + * + * Revision 1.148 2008/11/16 12:43:49 fabiankeil + * Turn keep-alive support into a runtime feature + * that is disabled by setting keep-alive-timeout + * to a negative value. + * * Revision 1.147 2008/11/04 17:20:31 fabiankeil * HTTP/1.1 responses without Connection * header imply keep-alive. Act accordingly. @@ -1199,7 +1208,7 @@ jb_err decompress_iob(struct client_state *csp) cur = csp->iob->cur; - if (bufsize < 10) + if (bufsize < (size_t)10) { /* * This is to protect the parsing of gzipped data, @@ -1454,7 +1463,7 @@ jb_err decompress_iob(struct client_state *csp) */ assert(zstr.avail_out == tmpbuf + bufsize - (char *)zstr.next_out); assert((char *)zstr.next_out == tmpbuf + ((char *)oldnext_out - buf)); - assert(zstr.avail_out > 0); + assert(zstr.avail_out > 0U); buf = tmpbuf; } @@ -1506,7 +1515,7 @@ jb_err decompress_iob(struct client_state *csp) && (csp->iob->eod <= csp->iob->buf + csp->iob->size)) { const size_t new_size = (size_t)(csp->iob->eod - csp->iob->cur); - if (new_size > 0) + if (new_size > (size_t)0) { log_error(LOG_LEVEL_RE_FILTER, "Decompression successful. Old size: %d, new size: %d.", @@ -2452,6 +2461,7 @@ static jb_err client_connection(struct client_state *csp, char **header) *********************************************************************/ static jb_err crumble(struct client_state *csp, char **header) { + (void)csp; log_error(LOG_LEVEL_HEADER, "crumble crunched: %s!", *header); freez(*header); return JB_ERR_OK; @@ -3558,12 +3568,13 @@ static jb_err client_max_forwards(struct client_state *csp, char **header) (0 == strcmpic(csp->http->gpc, "options"))) { assert(*(*header+12) == ':'); - if (1 == sscanf(*header+12, ": %u", &max_forwards)) + if (1 == sscanf(*header+12, ": %d", &max_forwards)) { if (max_forwards > 0) { - snprintf(*header, strlen(*header)+1, "Max-Forwards: %u", --max_forwards); - log_error(LOG_LEVEL_HEADER, "Max-Forwards value for %s request reduced to %u.", + snprintf(*header, strlen(*header)+1, "Max-Forwards: %d", --max_forwards); + log_error(LOG_LEVEL_HEADER, + "Max-Forwards value for %s request reduced to %d.", csp->http->gpc, max_forwards); } else if (max_forwards < 0) @@ -4691,7 +4702,8 @@ static const char *get_appropiate_connection_header(const struct client_state *c static const char connection_keep_alive[] = "Connection: keep-alive"; static const char connection_close[] = "Connection: close"; - if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)) + if ((csp->config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE) + && (csp->http->ssl == 0)) { return connection_keep_alive; }