diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-07-26 23:29:41 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-07-26 23:29:41 +0000 |
commit | ea23c7a03c590fa77b58866ea8a57993bc5335a3 (patch) | |
tree | 756d9e337b020f7c884b8bc6fcc588805d4165be | |
parent | 93a71e9807dc8dac04ba2211d4b7502d24135962 (diff) |
Combine http filter/expect cases to simplify code.
ok reyk@
-rw-r--r-- | usr.sbin/hoststated/relay.c | 14 | ||||
-rw-r--r-- | 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 <reyk@openbsd.org> @@ -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 <reyk@openbsd.org> @@ -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) |