From 29fb5f19f22330b60504932d0c076d3037575677 Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 19 Sep 2024 18:13:03 +0300 Subject: [PATCH] nfqws: search Host: case insensitive --- nfq/protocol.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/nfq/protocol.c b/nfq/protocol.c index 6a8f2aa..4ee922e 100644 --- a/nfq/protocol.c +++ b/nfq/protocol.c @@ -24,12 +24,45 @@ bool IsHttp(const uint8_t *data, size_t len) { return !!HttpMethod(data,len); } + +static bool IsHostAt(const uint8_t *p) +{ + return \ + p[0]=='\n' && + (p[1]=='H' || p[1]=='h') && + (p[2]=='o' || p[2]=='O') && + (p[3]=='s' || p[3]=='S') && + (p[4]=='t' || p[4]=='T') && + p[5]==':'; +} +static uint8_t *FindHostIn(uint8_t *buf, size_t bs) +{ + size_t pos; + if (bs<6) return NULL; + bs-=6; + for(pos=0;pos