diff options
Diffstat (limited to 'source/html.c')
| -rw-r--r-- | source/html.c | 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 22 insertions, 0 deletions
diff --git a/source/html.c b/source/html.c index a1d244b..96b1b52 100644 --- a/source/html.c +++ b/source/html.c @@ -339,6 +339,28 @@ void html_header_arg_in_quotes(const char *txt) html(txt); } +/* + * A query string goes into a header the way it arrived, already encoded by + * the client, except that a byte a header line cannot carry is percent-encoded + * so the line stays one line. + */ +void html_header_query(const char *txt) +{ + const char *p = txt; + + while (p && *p) { + unsigned char c = *p; + if (c <= ' ' || c >= 0x7f) { + html_raw(txt, p - txt); + html(url_escape_table[c]); + txt = p + 1; + } + p++; + } + if (p != txt) + html(txt); +} + void html_hidden(const char *name, const char *value) { html("<input type='hidden' name='"); |
