-const char jcc_rcs[] = "$Id: jcc.c,v 1.432 2014/12/19 12:28:10 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.435 2015/01/24 16:42:57 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
{
return CHUNK_STATUS_PARSE_ERROR;
}
- /*
- * Skip "\r\n", the chunk data and another "\r\n".
- * Moving p to either the beginning of the next chunk-size
- * or one byte beyond the end of the chunked data.
- */
- p += 2 + chunksize + 2;
+ /* Move beyond the chunkdata. */
+ p += 2 + chunksize;
+
+ /* There should be another "\r\n" to skip */
+ if (memcmp(p, "\r\n", 2))
+ {
+ return CHUNK_STATUS_PARSE_ERROR;
+ }
+ p += 2;
} while (chunksize > 0U);
*length = (size_t)(p - iob->cur);
send_crunch_response(csp, rsp);
}
+ /*
+ * Temporary workaround to prevent already-read client
+ * bodies from being parsed as new requests. For now we
+ * err on the safe side and throw all the following
+ * requests under the bus, even if no client body has been
+ * buffered. A compliant client will repeat the dropped
+ * requests on an untainted connection.
+ *
+ * The proper fix is to discard the no longer needed
+ * client body in the buffer (if there is one) and to
+ * continue parsing the bytes that follow.
+ */
+ drain_and_close_socket(csp->cfd);
+ csp->cfd = JB_INVALID_SOCKET;
+
return;
}
#ifdef FEATURE_CONNECTION_KEEP_ALIVE
}
csp = &csp_list->csp;
- log_error(LOG_LEVEL_CONNECT, "Listening for new connections ... ");
+ log_error(LOG_LEVEL_CONNECT,
+ "Waiting for the next client connection. Currently active threads: %d",
+ active_threads);
if (!accept_connection(csp, bfds))
{
* XXX: If you assume ...
*/
log_error(LOG_LEVEL_ERROR,
- "Unable to take any additional connections: %E");
+ "Unable to take any additional connections: %E. Active threads: %d",
+ active_threads);
write_socket(csp->cfd, TOO_MANY_CONNECTIONS_RESPONSE,
strlen(TOO_MANY_CONNECTIONS_RESPONSE));
close_socket(csp->cfd);