-const char parsers_rcs[] = "$Id: parsers.c,v 1.174 2009/06/05 16:54:27 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.175 2009/06/05 16:55:16 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
       }
    }
 
+#ifdef FEATURE_CONNECTION_KEEP_ALIVE
+   if ((JB_ERR_OK == err)
+    && (csp->flags & CSP_FLAG_MODIFIED)
+    && (csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE)
+    && !(csp->flags & CSP_FLAG_SERVER_CONTENT_LENGTH_SET))
+   {
+      /*
+       * XXX: lame. should factor the regeneration code out
+       * of server_adjust_content_length instead.
+       */
+      log_error(LOG_LEVEL_HEADER,
+         "Content modified with no Content-Length header set. "
+         "Creating a fake one for adjustment later on.");
+      err = enlist(csp->headers, "Content-Length: 0");
+      if (JB_ERR_OK == err)
+      {
+         err = server_adjust_content_length(csp, &(csp->headers->last->str));
+      }
+   }
+#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
+
    return err;
 }
 
    else
    {
       csp->expected_content_length = content_length;
+      csp->flags |= CSP_FLAG_SERVER_CONTENT_LENGTH_SET;
       csp->flags |= CSP_FLAG_CONTENT_LENGTH_SET;
    }
 
 
 #ifndef PROJECT_H_INCLUDED
 #define PROJECT_H_INCLUDED
 /** Version string. */
-#define PROJECT_H_VERSION "$Id: project.h,v 1.138 2009/05/16 13:27:20 fabiankeil Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.139 2009/06/03 16:42:49 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/project.h,v $
  * Flag for csp->flags: Set if the server specified the
  * content length.
  */
-#define CSP_FLAG_CONTENT_LENGTH_SET            0x00002000U
+#define CSP_FLAG_SERVER_CONTENT_LENGTH_SET     0x00002000U
+
+/**
+ * Flag for csp->flags: Set if we know the content lenght,
+ * either because the server set it, or we figured it out
+ * on our own.
+ */
+#define CSP_FLAG_CONTENT_LENGTH_SET            0x00004000U
 
 /**
  * Flag for csp->flags: Set if the client wants to keep
  * the connection alive.
  */
-#define CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE  0x00004000U
+#define CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE  0x00008000U
 #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
 
 /*