-const char jcc_rcs[] = "$Id: jcc.c,v 1.212 2008/12/14 15:46:22 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.213 2008/12/15 18:45:51 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.213 2008/12/15 18:45:51 fabiankeil
+ * When logging crunches, log the whole URL, so one can easily
+ * differentiate between vanilla HTTP and CONNECT requests.
+ *
* Revision 1.212 2008/12/14 15:46:22 fabiankeil
* Give crunched requests their own log level.
*
do
{
+ if (!data_is_available(csp->cfd, csp->config->socket_timeout))
+ {
+ log_error(LOG_LEVEL_ERROR,
+ "Stopped waiting for the request line.");
+ return '\0';
+ }
+
len = read_socket(csp->cfd, buf, sizeof(buf) - 1);
if (len <= 0) return NULL;
* We didn't receive a complete header
* line yet, get the rest of it.
*/
+ if (!data_is_available(csp->cfd, csp->config->socket_timeout))
+ {
+ log_error(LOG_LEVEL_ERROR,
+ "Stopped grabbing the client headers.");
+ return JB_ERR_PARSE;
+ }
+
len = read_socket(csp->cfd, buf, sizeof(buf) - 1);
if (len <= 0)
{
/* Skeleton for HTTP response, if we should intercept the request */
struct http_response *rsp;
+ struct timeval timeout;
memset(buf, 0, sizeof(buf));
+ memset(&timeout, 0, sizeof(timeout));
+ timeout.tv_sec = csp->config->socket_timeout;
http = csp->http;
}
#endif /* FEATURE_CONNECTION_KEEP_ALIVE */
- n = select((int)maxfd+1, &rfds, NULL, NULL, NULL);
+ n = select((int)maxfd+1, &rfds, NULL, NULL, &timeout);
- if (n < 0)
+ if (n == 0)
+ {
+ log_error(LOG_LEVEL_ERROR, "Didn't receive data in time.");
+ mark_server_socket_tainted(csp);
+ return;
+ }
+ else if (n < 0)
{
log_error(LOG_LEVEL_ERROR, "select() failed!: %E");
mark_server_socket_tainted(csp);