src/session.c
static int process_server_rules(struct session *s, struct channel *req, int an_bit)
{
	struct proxy *px = s->be;
	struct server_rule *rule;

	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n",
		now_ms, __FUNCTION__,
		s,
		req,
		req->rex, req->wex,
		req->flags,
		req->buf->i + req->buf->o,
		req->analysers);

	if (!(s->flags & SN_ASSIGNED)) {
		list_for_each_entry(rule, &px->server_rules, list) {
			int ret;

			ret = acl_exec_cond(rule->cond, s->be, s, &s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
			ret = acl_pass(ret);
			if (rule->cond->pol == ACL_COND_UNLESS)
				ret = !ret;

			if (ret) {
				struct server *srv = rule->srv.ptr;

				if ((srv->state & SRV_RUNNING) ||
				    (px->options & PR_O_PERSIST) ||
				    (s->flags & SN_FORCE_PRST)) {
					s->flags |= SN_DIRECT | SN_ASSIGNED;
					s->target = &srv->obj_type;
					break;
				}
				/* if the server is not UP, let's go on with next rules
				 * just in case another one is suited.
				 */
			}
		}
	}

	req->analysers &= ~an_bit;
	req->analyse_exp = TICK_ETERNITY;
	return 1;
}
/* This stream analyser works on a request. It applies all use-server rules on
 * it then returns 1. The data must already be present in the buffer otherwise
 * they won't match. It always returns 1.
 */
This stream analyser works on a request. It applies all use-server rules on
it then returns 1. The data must already be present in the buffer otherwise
they won't match. It always returns 1.
This stream analyser works on a request . It applies all use - server rules on it then returns 1 . The data must already be present in the buffer otherwise they won ' t match . It always returns 1 .
static int process_server_rules(struct session *s, struct channel *req, int an_bit)
{
	struct proxy *px = s->be;
	struct server_rule *rule;
	DPRINTF(stderr,"[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bl=%d analysers=%02x\n",
		now_ms, __FUNCTION__,
		s,
		req,
		req->rex, req->wex,
		req->flags,
		req->buf->i + req->buf->o,
		req->analysers);
	if (!(s->flags & SN_ASSIGNED)) {
		list_for_each_entry(rule, &px->server_rules, list) {
			int ret;
			ret = acl_exec_cond(rule->cond, s->be, s, &s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
			ret = acl_pass(ret);
			if (rule->cond->pol == ACL_COND_UNLESS)
				ret = !ret;
			if (ret) {
				struct server *srv = rule->srv.ptr;
				if ((srv->state & SRV_RUNNING) ||
				    (px->options & PR_O_PERSIST) ||
				    (s->flags & SN_FORCE_PRST)) {
					s->flags |= SN_DIRECT | SN_ASSIGNED;
					s->target = &srv->obj_type;
					break;
				}
			}
		}
	}
	req->analysers &= ~an_bit;
	req->analyse_exp = TICK_ETERNITY;
	return 1;
}
static int process_server_rules ( struct session * s , struct channel * req , int an_bit ) { struct proxy * px = s -> be ; struct server_rule * rule ; DPRINTF ( stderr , " \n " , now_ms , __FUNCTION__ , s , req , req -> rex , req -> wex , req -> flags , req -> buf -> i + req -> buf -> o , req -> analysers ) ; if ( ! ( s -> flags & SN_ASSIGNED ) ) { list_for_each_entry ( rule , & px -> server_rules , list ) { int ret ; ret = acl_exec_cond ( rule -> cond , s -> be , s , & s -> txn , SMP_OPT_DIR_REQ | SMP_OPT_FINAL ) ; ret = acl_pass ( ret ) ; if ( rule -> cond -> pol == ACL_COND_UNLESS ) ret = ! ret ; if ( ret ) { struct server * srv = rule -> srv . ptr ; if ( ( srv -> state & SRV_RUNNING ) || ( px -> options & PR_O_PERSIST ) || ( s -> flags & SN_FORCE_PRST ) ) { s -> flags |= SN_DIRECT | SN_ASSIGNED ; s -> target = & srv -> obj_type ; break ; } } } } req -> analysers &= ~ an_bit ; req -> analyse_exp = TICK_ETERNITY ; return 1 ; }
This stream analyser works on a request.
This stream analyser works on a request .
/* if the server is not UP, let's go on with next rules
				 * just in case another one is suited.
				 */