From 3083276187fca1d0b406ca6bde3fa307879ed39e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 30 Dec 2017 14:39:09 +0100 Subject: [PATCH] MINOR: h2: add a function to report pseudo-header names For debugging we need to be able to dump pseudo headers when we know their name, let's put this there as we already have the other way around. --- include/common/h2.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/common/h2.h b/include/common/h2.h index 65c5ab1c8..fdeafe67d 100644 --- a/include/common/h2.h +++ b/include/common/h2.h @@ -190,6 +190,20 @@ static inline int h2_str_to_phdr(const struct ist str) return 0; } +/* returns the pseudo-header name as a string, or ":UNKNOWN" if unknown */ +static inline const char *h2_phdr_to_str(int phdr) +{ + switch (phdr) { + case H2_PHDR_IDX_NONE: return ":NONE"; + case H2_PHDR_IDX_AUTH: return ":authority"; + case H2_PHDR_IDX_METH: return ":method"; + case H2_PHDR_IDX_PATH: return ":path"; + case H2_PHDR_IDX_SCHM: return ":scheme"; + case H2_PHDR_IDX_STAT: return ":status"; + case H2_PHDR_IDX_HOST: return "Host"; + default: return ":UNKNOWN"; + } +} #endif /* _COMMON_H2_H */