-const char jcc_rcs[] = "$Id: jcc.c,v 1.215 2008/12/24 17:06:19 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.216 2008/12/24 22:13:11 ler762 Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.216  2008/12/24 22:13:11  ler762
+ *    fix GCC 3.4.4 warning
+ *
  *    Revision 1.215  2008/12/24 17:06:19  fabiankeil
  *    Keep a thread around to timeout alive connections
  *    even if no new requests are coming in.
    "Connection: close\r\n\r\n"
    "Bad request. Messed up with header filters.\r\n";
 
+/* XXX: should be a template */
+static const char CONNECTION_TIMEOUT_RESPONSE[] =
+   "HTTP/1.0 502 Connection timeout\r\n"
+   "Proxy-Agent: Privoxy " VERSION "\r\n"
+   "Content-Type: text/plain\r\n"
+   "Connection: close\r\n\r\n"
+   "The connection timed out.\r\n";
+
 /* A function to crunch a response */
 typedef struct http_response *(*crunch_func_ptr)(struct client_state *);
 
       {
          log_error(LOG_LEVEL_ERROR,
             "Stopped waiting for the request line.");
-         return '\0';
+         write_socket(csp->cfd, CONNECTION_TIMEOUT_RESPONSE,
+            strlen(CONNECTION_TIMEOUT_RESPONSE));
+         return NULL;
       }
 
       len = read_socket(csp->cfd, buf, sizeof(buf) - 1);
    memset(buf, 0, sizeof(buf));
 
    req = get_request_line(csp);
-
-   if ((NULL != req) && ('\0' != *req))
+   if (req == NULL)
    {
+      return JB_ERR_PARSE;
+   }
+   else
+   {
+      /* XXX: We don't need an else block here. */
+      assert(*req != '\0');
       /* Request received. Validate and parse it. */
 
       /* Does the request line look invalid? */
       if (n == 0)
       {
          log_error(LOG_LEVEL_ERROR, "Didn't receive data in time.");
+         if ((byte_count == 0) && (http->ssl == 0))
+         {
+            write_socket(csp->cfd, CONNECTION_TIMEOUT_RESPONSE,
+               strlen(CONNECTION_TIMEOUT_RESPONSE));
+         }
          mark_server_socket_tainted(csp);
          return;
       }