+
+ return JB_ERR_PARSE;
+ }
+
+ return JB_ERR_OK;
+
+}
+
+
+/*********************************************************************
+ *
+ * Function : chat
+ *
+ * Description : Once a connection to the client has been accepted,
+ * this function is called (via serve()) to handle the
+ * main business of the communication. When this
+ * function returns, the caller must close the client
+ * socket handle.
+ *
+ * FIXME: chat is nearly thousand lines long.
+ * Ridiculous.
+ *
+ * Parameters :
+ * 1 : csp = Current client state (buffers, headers, etc...)
+ *
+ * Returns : Nothing.
+ *
+ *********************************************************************/
+static void chat(struct client_state *csp)
+{
+ char buf[BUFFER_SIZE];
+ char *hdr;
+ char *p;
+ fd_set rfds;
+ int n;
+ jb_socket maxfd;
+ int server_body;
+ int ms_iis5_hack = 0;
+ size_t byte_count = 0;
+ int forwarded_connect_retries = 0;
+ int max_forwarded_connect_retries = csp->config->forwarded_connect_retries;
+ const struct forward_spec *fwd;
+ struct http_request *http;
+ int len; /* for buffer sizes (and negative error codes) */
+
+ /* Function that does the content filtering for the current request */
+ filter_function_ptr content_filter = NULL;
+
+ /* Skeleton for HTTP response, if we should intercept the request */
+ struct http_response *rsp;
+
+ memset(buf, 0, sizeof(buf));
+
+ http = csp->http;
+
+ if (receive_client_request(csp) != JB_ERR_OK)
+ {
+ return;
+ }
+ if (parse_client_request(csp) != JB_ERR_OK)
+ {