Commit d9928c3b authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

http2_hpack: Remove one level of nesting

Better diff with the --ignore-all-space option.
parent c0b452b3
...@@ -169,10 +169,8 @@ h2h_addhdr(struct http *hp, struct h2h_decode *d) ...@@ -169,10 +169,8 @@ h2h_addhdr(struct http *hp, struct h2h_decode *d)
return (H2SE_ENHANCE_YOUR_CALM); return (H2SE_ENHANCE_YOUR_CALM);
} }
if (*nm.b == ':') {
/* Match H/2 pseudo headers */ /* Match H/2 pseudo headers */
/* XXX: Should probably have some include tbl for /* XXX: Should probably have some include tbl for pseudo-headers */
pseudo-headers */
if (!Tstrcmp(nm, ":method")) { if (!Tstrcmp(nm, ":method")) {
hdr.b = val.b; hdr.b = val.b;
n = HTTP_HDR_METHOD; n = HTTP_HDR_METHOD;
...@@ -189,8 +187,7 @@ h2h_addhdr(struct http *hp, struct h2h_decode *d) ...@@ -189,8 +187,7 @@ h2h_addhdr(struct http *hp, struct h2h_decode *d)
disallow_empty = 1; disallow_empty = 1;
// rfc9113,l,2693,2705 // rfc9113,l,2693,2705
if (Tlen(val) > 0 && *val.b != '/' && if (Tlen(val) > 0 && val.b[0] != '/' && Tstrcmp(val, "*")) {
Tstrcmp(val, "*")) {
VSLb(hp->vsl, SLT_BogoHeader, VSLb(hp->vsl, SLT_BogoHeader,
"Illegal :path pseudo-header %.*s", "Illegal :path pseudo-header %.*s",
(int)Tlen(val), val.b); (int)Tlen(val), val.b);
...@@ -225,14 +222,12 @@ h2h_addhdr(struct http *hp, struct h2h_decode *d) ...@@ -225,14 +222,12 @@ h2h_addhdr(struct http *hp, struct h2h_decode *d)
nm = Tstr(":authority"); /* preserve original */ nm = Tstr(":authority"); /* preserve original */
has_dup = d->has_authority; has_dup = d->has_authority;
d->has_authority = 1; d->has_authority = 1;
} else { } else if (nm.b[0] == ':') {
/* Unknown pseudo-header */
VSLb(hp->vsl, SLT_BogoHeader, VSLb(hp->vsl, SLT_BogoHeader,
"Unknown pseudo-header: %.*s", "Unknown pseudo-header: %.*s",
vmin_t(int, Tlen(hdr), 20), hdr.b); vmin_t(int, Tlen(hdr), 20), hdr.b);
return (H2SE_PROTOCOL_ERROR); // rfc7540,l,2990,2992 return (H2SE_PROTOCOL_ERROR); // rfc7540,l,2990,2992
} }
}
if (disallow_empty && Tlen(val) == 0) { if (disallow_empty && Tlen(val) == 0) {
VSLb(hp->vsl, SLT_BogoHeader, VSLb(hp->vsl, SLT_BogoHeader,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment