From ea23c7a03c590fa77b58866ea8a57993bc5335a3 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Thu, 26 Jul 2007 23:29:41 +0000 Subject: Combine http filter/expect cases to simplify code. ok reyk@ --- usr.sbin/hoststated/relay.c | 14 ++++---------- usr.sbin/relayd/relay.c | 14 ++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/usr.sbin/hoststated/relay.c b/usr.sbin/hoststated/relay.c index 33f54f8f099..e863ce35c01 100644 --- a/usr.sbin/hoststated/relay.c +++ b/usr.sbin/hoststated/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.35 2007/06/19 06:29:20 pyr Exp $ */ +/* $OpenBSD: relay.c,v 1.36 2007/07/26 23:29:40 jsg Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter @@ -856,17 +856,11 @@ relay_handle_http(struct ctl_relay_event *cre, struct protonode *pn, pk->key, pk->value); break; case NODE_ACTION_EXPECT: - DPRINTF("relay_handle_http: expect '%s: %s'", - pn->key, pn->value); - if (fnmatch(pn->value, pk->value, FNM_CASEFOLD) == 0) { - if (pn->flags & PNFLAG_MARK) - cre->marked++; - cre->nodes[pn->id] = 1; - } ret = PN_PASS; - break; + /* FALLTHROUGH */ case NODE_ACTION_FILTER: - DPRINTF("relay_handle_http: filter '%s: %s'", + DPRINTF("relay_handle_http: %s '%s: %s'", + (pn->action == NODE_ACTION_EXPECT) ? "expect" : "filter", pn->key, pn->value); if (fnmatch(pn->value, pk->value, FNM_CASEFOLD) == 0) { if (pn->flags & PNFLAG_MARK) diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c index 33f54f8f099..e863ce35c01 100644 --- a/usr.sbin/relayd/relay.c +++ b/usr.sbin/relayd/relay.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relay.c,v 1.35 2007/06/19 06:29:20 pyr Exp $ */ +/* $OpenBSD: relay.c,v 1.36 2007/07/26 23:29:40 jsg Exp $ */ /* * Copyright (c) 2006, 2007 Reyk Floeter @@ -856,17 +856,11 @@ relay_handle_http(struct ctl_relay_event *cre, struct protonode *pn, pk->key, pk->value); break; case NODE_ACTION_EXPECT: - DPRINTF("relay_handle_http: expect '%s: %s'", - pn->key, pn->value); - if (fnmatch(pn->value, pk->value, FNM_CASEFOLD) == 0) { - if (pn->flags & PNFLAG_MARK) - cre->marked++; - cre->nodes[pn->id] = 1; - } ret = PN_PASS; - break; + /* FALLTHROUGH */ case NODE_ACTION_FILTER: - DPRINTF("relay_handle_http: filter '%s: %s'", + DPRINTF("relay_handle_http: %s '%s: %s'", + (pn->action == NODE_ACTION_EXPECT) ? "expect" : "filter", pn->key, pn->value); if (fnmatch(pn->value, pk->value, FNM_CASEFOLD) == 0) { if (pn->flags & PNFLAG_MARK) -- cgit v1.2.3