src/proto_http.c
int http_process_tarpit(struct session *s, struct channel *req, int an_bit)
{
	struct http_txn *txn = &s->txn;

	/* This connection is being tarpitted. The CLIENT side has
	 * already set the connect expiration date to the right
	 * timeout. We just have to check that the client is still
	 * there and that the timeout has not expired.
	 */
	channel_dont_connect(req);
	if ((req->flags & (CF_SHUTR|CF_READ_ERROR)) == 0 &&
	    !tick_is_expired(req->analyse_exp, now_ms))
		return 0;

	/* We will set the queue timer to the time spent, just for
	 * logging purposes. We fake a 500 server error, so that the
	 * attacker will not suspect his connection has been tarpitted.
	 * It will not cause trouble to the logs because we can exclude
	 * the tarpitted connections by filtering on the 'PT' status flags.
	 */
	s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);

	txn->status = 500;
	if (!(req->flags & CF_READ_ERROR))
		stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_500));

	req->analysers = 0;
	req->analyse_exp = TICK_ETERNITY;

	s->fe->fe_counters.failed_req++;
	if (s->listener->counters)
		s->listener->counters->failed_req++;

	if (!(s->flags & SN_ERR_MASK))
		s->flags |= SN_ERR_PRXCOND;
	if (!(s->flags & SN_FINST_MASK))
		s->flags |= SN_FINST_T;
	return 0;
}
/* This function is an analyser which processes the HTTP tarpit. It always
 * returns zero, at the beginning because it prevents any other processing
 * from occurring, and at the end because it terminates the request.
 */
This function is an analyser which processes the HTTP tarpit. It always
returns zero, at the beginning because it prevents any other processing
from occurring, and at the end because it terminates the request.
This function is an analyser which processes the HTTP tarpit . It always returns zero at the beginning because it prevents any other processing from occurring and at the end because it terminates the request .
int http_process_tarpit(struct session *s, struct channel *req, int an_bit)
{
	struct http_txn *txn = &s->txn;
	channel_dont_connect(req);
	if ((req->flags & (CF_SHUTR|CF_READ_ERROR)) == 0 &&
	    !tick_is_expired(req->analyse_exp, now_ms))
		return 0;
	s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
	txn->status = 500;
	if (!(req->flags & CF_READ_ERROR))
		stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_500));
	req->analysers = 0;
	req->analyse_exp = TICK_ETERNITY;
	s->fe->fe_counters.failed_req++;
	if (s->listener->counters)
		s->listener->counters->failed_req++;
	if (!(s->flags & SN_ERR_MASK))
		s->flags |= SN_ERR_PRXCOND;
	if (!(s->flags & SN_FINST_MASK))
		s->flags |= SN_FINST_T;
	return 0;
}
int http_process_tarpit ( struct session * s , struct channel * req , int an_bit ) { struct http_txn * txn = & s -> txn ; channel_dont_connect ( req ) ; if ( ( req -> flags & ( CF_SHUTR | CF_READ_ERROR ) ) == 0 && ! tick_is_expired ( req -> analyse_exp , now_ms ) ) return 0 ; s -> logs . t_queue = tv_ms_elapsed ( & s -> logs . tv_accept , & now ) ; txn -> status = 500 ; if ( ! ( req -> flags & CF_READ_ERROR ) ) stream_int_retnclose ( req -> prod , http_error_message ( s , HTTP_ERR_500 ) ) ; req -> analysers = 0 ; req -> analyse_exp = TICK_ETERNITY ; s -> fe -> fe_counters . failed_req ++ ; if ( s -> listener -> counters ) s -> listener -> counters -> failed_req ++ ; if ( ! ( s -> flags & SN_ERR_MASK ) ) s -> flags |= SN_ERR_PRXCOND ; if ( ! ( s -> flags & SN_FINST_MASK ) ) s -> flags |= SN_FINST_T ; return 0 ; }
This function is an analyser which processes the HTTP tarpit.
This function is an analyser which processes the HTTP tarpit .
/* This connection is being tarpitted. The CLIENT side has
	 * already set the connect expiration date to the right
	 * timeout. We just have to check that the client is still
	 * there and that the timeout has not expired.
	 */ /* We will set the queue timer to the time spent, just for
	 * logging purposes. We fake a 500 server error, so that the
	 * attacker will not suspect his connection has been tarpitted.
	 * It will not cause trouble to the logs because we can exclude
	 * the tarpitted connections by filtering on the 'PT' status flags.
	 */