+ * Revision 1.204 2008/11/06 19:42:17 fabiankeil
+ * Fix last-chunk detection hack to also apply
+ * if buf[] contains nothing but the last-chunk.
+ *
+ * Revision 1.203 2008/11/06 18:34:35 fabiankeil
+ * Factor receive_client_request() and
+ * parse_client_request() out of chat().
+ *
+ * Revision 1.202 2008/11/02 18:40:34 fabiankeil
+ * If we received a different amount of data than we expected,
+ * log a warning and make sure the server socket isn't reused.
+ *
+ * Revision 1.201 2008/11/02 16:48:20 fabiankeil
+ * Revert revision 1.195 and try again.
+ *
+ * Revision 1.200 2008/10/26 16:53:18 fabiankeil
+ * Fix gcc44 warning.
+ *
+ * Revision 1.199 2008/10/26 15:36:10 fabiankeil
+ * Remove two debug messages with LOG_LEVEL_INFO.
+ *
+ * Revision 1.198 2008/10/22 15:19:55 fabiankeil
+ * Once More, With Feeling: if there is no logfile
+ * because the user didn't specify one, we shouldn't
+ * call init_error_log() after receiving SIGHUP either.
+ *
+ * Revision 1.197 2008/10/20 17:02:40 fabiankeil
+ * If SIGHUP is received while we aren't running in daemon
+ * mode, calling init_error_log() would be a mistake.
+ *
+ * Revision 1.196 2008/10/16 09:16:41 fabiankeil
+ * - Fix two gcc44 conversion warnings.
+ * - Don't bother logging the last five bytes
+ * of the 0-chunk.
+ *
+ * Revision 1.195 2008/10/13 16:04:37 fabiankeil
+ * Make sure we don't try to reuse tainted server sockets.
+ *
+ * Revision 1.194 2008/10/12 18:35:18 fabiankeil
+ * The last commit was a bit too ambitious, apparently the content
+ * length adjustment is only necessary if we aren't buffering.
+ *
+ * Revision 1.193 2008/10/12 15:57:35 fabiankeil
+ * Fix content length calculation if we read headers
+ * and the start of the body at once. Now that we have
+ * FEATURE_CONNECTION_KEEP_ALIVE, it actually matters.
+ *
+ * Revision 1.192 2008/10/11 18:19:14 fabiankeil
+ * Even more chat() cosmetics.
+ *
+ * Revision 1.191 2008/10/11 18:00:14 fabiankeil
+ * Reformat some comments in chat().
+ *
+ * Revision 1.190 2008/10/11 14:58:00 fabiankeil
+ * In case of chunk-encoded content, stop reading if
+ * the buffer looks like it ends with the last chunk.
+ *
+ * Revision 1.189 2008/10/11 09:53:00 fabiankeil
+ * Let server_response_is_complete() deal properly with
+ * content that is neither buffered nor read all at once.
+ *
+ * Revision 1.188 2008/10/09 18:21:41 fabiankeil
+ * Flush work-in-progress changes to keep outgoing connections
+ * alive where possible. Incomplete and mostly #ifdef'd out.
+ *
+ * Revision 1.187 2008/09/07 12:35:05 fabiankeil
+ * Add mutex lock support for _WIN32.
+ *
+ * Revision 1.186 2008/09/04 08:13:58 fabiankeil
+ * Prepare for critical sections on Windows by adding a
+ * layer of indirection before the pthread mutex functions.
+ *
+ * Revision 1.185 2008/08/30 12:03:07 fabiankeil
+ * Remove FEATURE_COOKIE_JAR.
+ *
+ * Revision 1.184 2008/08/22 15:34:45 fabiankeil
+ * - Silence LLVM/Clang complaint.
+ * - Make received_hup_signal static.
+ * - Hide definitions for basedir, pidfile and received_hup_signal
+ * from __EMX__ as they only seem to be used in case of #ifdef unix.
+ *
+ * Revision 1.183 2008/08/21 07:09:35 fabiankeil
+ * Accept Shoutcast responses again. Problem reported
+ * and fix suggested by Stefan in #2062860.
+ *
+ * Revision 1.182 2008/06/27 11:13:56 fabiankeil
+ * Fix possible NULL-pointer dereference reported
+ * by din_a4 in #2003937. Pointy hat to me.
+ *
+ * Revision 1.181 2008/05/21 15:47:15 fabiankeil
+ * Streamline sed()'s prototype and declare
+ * the header parse and add structures static.
+ *
+ * Revision 1.180 2008/05/21 15:26:32 fabiankeil
+ * - Mark csp as immutable for send_crunch_response().
+ * - Fix comment spelling.
+ *
+ * Revision 1.179 2008/05/20 20:13:32 fabiankeil
+ * Factor update_server_headers() out of sed(), ditch the
+ * first_run hack and make server_patterns_light static.
+ *
+ * Revision 1.178 2008/05/10 13:23:38 fabiankeil
+ * Don't provide get_header() with the whole client state
+ * structure when it only needs access to csp->iob.
+ *
+ * Revision 1.177 2008/05/10 11:51:12 fabiankeil
+ * Make the "read the rest of the headers" loop a bit more readable.
+ *
+ * Revision 1.176 2008/05/10 11:37:57 fabiankeil
+ * - Instead of logging when the IIS5 hack is enabled, log when it fails.
+ * - Remove useless comment.
+ *
+ * Revision 1.175 2008/05/09 18:53:59 fabiankeil
+ * Fix comment grammar.
+ *
+ * Revision 1.174 2008/05/07 18:05:53 fabiankeil
+ * Remove the pointless buffer in client_protocol_is_unsupported().
+ *
+ * Revision 1.173 2008/05/06 15:09:00 fabiankeil
+ * Least-effort fix for bug #1821930 (reported by Lee):
+ * If the response doesn't look like HTTP,
+ * tell the client and log the problem.
+ *
+ * Revision 1.172 2008/04/16 16:38:21 fabiankeil
+ * Don't pass the whole csp structure to flush_socket()
+ * when it only needs a file descriptor and a buffer.
+ *
+ * Revision 1.171 2008/03/27 18:27:25 fabiankeil
+ * Remove kill-popups action.
+ *
+ * Revision 1.170 2008/03/06 16:33:46 fabiankeil
+ * If limit-connect isn't used, don't limit CONNECT requests to port 443.
+ *
+ * Revision 1.169 2008/03/04 18:30:39 fabiankeil
+ * Remove the treat-forbidden-connects-like-blocks action. We now
+ * use the "blocked" page for forbidden CONNECT requests by default.
+ *
+ * Revision 1.168 2008/03/02 12:25:25 fabiankeil
+ * Also use shiny new connect_port_is_forbidden() in jcc.c.
+ *
+ * Revision 1.167 2008/02/23 16:57:12 fabiankeil
+ * Rename url_actions() to get_url_actions() and let it
+ * use the standard parameter ordering.
+ *
+ * Revision 1.166 2008/02/23 16:33:43 fabiankeil
+ * Let forward_url() use the standard parameter ordering
+ * and mark its second parameter immutable.
+ *
+ * Revision 1.165 2008/02/02 19:36:56 fabiankeil
+ * Remove the "Listening ... for local connections only" log message.
+ * Whether or not remote connections are able to reach Privoxy is up
+ * to the operating system.
+ *
+ * Revision 1.164 2007/12/16 18:32:46 fabiankeil
+ * Prevent the log messages for CONNECT requests to unacceptable
+ * ports from printing the limit-connect argument as [null] if
+ * limit-connect hasn't been explicitly enabled.
+ *
+ * Revision 1.163 2007/12/13 01:47:11 david__schmidt
+ * Make sure all console-mode apps get a usage() instance
+ *
+ * Revision 1.162 2007/12/06 17:54:57 fabiankeil
+ * Reword NO_SERVER_DATA_RESPONSE to make it harder
+ * to misunderstand what the message is all about.
+ *
+ * Revision 1.161 2007/12/04 19:44:22 fabiankeil
+ * Unbreak trustfile which previously didn't work without
+ * FEATURE_TOGGLE. Fixes BR#1843585, reported by Lee.
+ *
+ * Revision 1.160 2007/11/29 18:00:29 fabiankeil
+ * Plug memory leak. Spotted by Valgrind, triggered by
+ * Privoxy-Regression-Test feeding proxyfuzz.py.
+ *
+ * Revision 1.159 2007/11/24 14:34:09 fabiankeil
+ * In the HTTP snipplets, refer to the client as client.
+ *
+ * Revision 1.158 2007/11/11 16:44:17 fabiankeil
+ * Emit a log message when activating the MS IIS5 hack.
+ *
+ * Revision 1.157 2007/11/03 17:34:49 fabiankeil
+ * Log the "weak randomization factor" warning only
+ * once for mingw32 and provide some more details.
+ *
+ * Revision 1.156 2007/11/01 18:20:58 fabiankeil
+ * Initialize log module after initializing mutexes, future
+ * deadlocks in that code should now work cross-platform.
+ *
+ * Revision 1.155 2007/10/23 20:12:45 fabiankeil
+ * Fix first CSUCCEED line to end in \r\n as required by RFC1945.
+ * Reported by Bert van Leeuwen in BR#1818808.
+ *
+ * Revision 1.154 2007/10/19 17:00:08 fabiankeil
+ * Downgrade "Flushing header and buffers" message to LOG_LEVEL_INFO.
+ *
+ * Revision 1.153 2007/10/14 14:12:41 fabiankeil
+ * When in daemon mode, close stderr after the configuration file has been
+ * parsed the first time. If logfile isn't set, stop logging. Fixes BR#897436.
+ *
+ * Revision 1.152 2007/10/04 18:03:34 fabiankeil
+ * - Fix a crash when parsing invalid requests whose first header
+ * is rejected by get_header(). Regression (re?)introduced
+ * in r1.143 by yours truly.
+ * - Move ACTION_VANILLA_WAFER handling into parsers.c's
+ * client_cookie_adder() to make sure send-vanilla-wafer can be
+ * controlled through tags (and thus regression-tested).
+ *
+ * Revision 1.151 2007/09/29 10:21:16 fabiankeil
+ * - Move get_filter_function() from jcc.c to filters.c
+ * so the filter functions can be static.
+ * - Don't bother filtering body-less responses.
+ *
+ * Revision 1.150 2007/09/28 16:39:29 fabiankeil
+ * Execute content filters through execute_content_filter().
+ *
+ * Revision 1.149 2007/09/04 15:08:48 fabiankeil
+ * Initialize req to NULL to make sure it's defined if the
+ * first read_socket() call fails. Reported by icmp30.
+ *
+ * Revision 1.148 2007/08/26 16:47:13 fabiankeil
+ * Add Stephen Gildea's --pre-chroot-nslookup patch [#1276666],
+ * extensive comments moved to user manual.
+ *
+ * Revision 1.147 2007/08/25 14:42:40 fabiankeil
+ * Don't crash if a broken header filter wiped out the request line.
+ *
+ * Revision 1.146 2007/08/20 17:09:32 fabiankeil
+ * Fix byte_count calculation in case of flushes
+ * and don't parse the server headers a second time.
+ *