Skip to content

Commit

Permalink
Added small hacks to work around tests disabled by #1630
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Petrov authored and dmpetroff committed Apr 11, 2023
1 parent e078077 commit 9472012
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
10 changes: 9 additions & 1 deletion fw/hpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,15 @@ tfw_hpack_decode(TfwHPack *__restrict hp, unsigned char *__restrict src,

if (unlikely(!hp->length)) {
T_DBG3("%s: zero-length value\n", __func__);
r = T_DROP;

switch (req->pit.tag) {
case TFW_TAG_HDR_HOST:
case TFW_TAG_HDR_H2_AUTHORITY:
r = T_BAD;
break;
default:
r = T_DROP;
}
goto out;
}

Expand Down
4 changes: 4 additions & 0 deletions fw/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -5804,6 +5804,10 @@ tfw_http_req_process(TfwConn *conn, TfwStream *stream, struct sk_buff *skb)
TFW_INC_STAT_BH(clnt.msgs_parserr);
tfw_http_req_parse_drop(req, 400, "failed to parse request");
return TFW_BAD;
case TFW_BAD:
tfw_http_req_parse_block(req, 403,
"frang: Request authority is unknown");
return TFW_BLOCK;
case TFW_POSTPONE:
if (WARN_ON_ONCE(parsed != data_up.skb->len)) {
/*
Expand Down
11 changes: 10 additions & 1 deletion fw/http_match.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,16 @@ match_hdr(const TfwHttpReq *req, const TfwHttpMatchRule *rule)
if (id == TFW_HTTP_HDR_RAW)
return match_hdr_raw(req, rule);

return hdr_val_eq(req, rule, id);
if (hdr_val_eq(req, rule, id))
return true;
switch (id) {
case TFW_HTTP_HDR_HOST:
return hdr_val_eq(req, rule, TFW_HTTP_HDR_H2_AUTHORITY);
case TFW_HTTP_HDR_H2_AUTHORITY:
return hdr_val_eq(req, rule, TFW_HTTP_HDR_HOST);
default:
return false;
}
}

static bool
Expand Down

0 comments on commit 9472012

Please sign in to comment.