[MINOR] Add chunk_htmlencode and chunk_asciiencode
Add two functions to encode input chunk replacing
non-printable, non ascii or special characters
with:
"&#%u;" - chunk_htmlencode
"<%02X>" - chunk_asciiencode
Above functions should be used when adding strings, received
from possible unsafe sources, to html stats or logs.
diff --git a/include/proto/buffers.h b/include/proto/buffers.h
index 89f7467..801ea1a 100644
--- a/include/proto/buffers.h
+++ b/include/proto/buffers.h
@@ -485,6 +485,9 @@
int chunk_printf(struct chunk *chk, const char *fmt, ...)
__attribute__ ((format(printf, 2, 3)));
+int chunk_htmlencode(struct chunk *dst, struct chunk *src);
+int chunk_asciiencode(struct chunk *dst, struct chunk *src, char qc);
+
static inline void chunk_reset(struct chunk *chk) {
chk->str = NULL;
chk->len = -1;