diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-09-29 16:38:46 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-09-29 16:38:46 +0000 |
commit | f1a6903f46c0e2edcdd2b7fa83c8a5bb4ca0e021 (patch) | |
tree | f7430b4070c761bd0ad6cd26587e210a9defbf54 /src | |
parent | 03696fce8d0061a70ea16aef8be0c0adbae8c5af (diff) | |
download | tipidee-f1a6903f46c0e2edcdd2b7fa83c8a5bb4ca0e021.tar.xz |
Send CGI Content-Length even when 0
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/config/lexparse.c | 2 | ||||
-rw-r--r-- | src/tipideed/cgi.c | 15 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/config/lexparse.c b/src/config/lexparse.c index 99693a5..d541888 100644 --- a/src/config/lexparse.c +++ b/src/config/lexparse.c @@ -333,7 +333,7 @@ static inline void process_line (char const *s, size_t const *word, size_t n, st break ; case T_DOMAIN : if (n != 1) - strerr_dief8x(1, "too", n > 1 ? "many" : "few", " arguments to directive ", "domain", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ; + strerr_dief8x(1, "too ", n > 1 ? "many" : "few", " arguments to directive ", "domain", " in file ", g.storage.s + md->filepos, " line ", md->linefmt) ; domain->len = 0 ; if (!stralloc_cats(domain, s + *word)) dienomem() ; while (domain->len && (domain->s[domain->len - 1] == '/' || domain->s[domain->len - 1] == '.')) domain->len-- ; diff --git a/src/tipideed/cgi.c b/src/tipideed/cgi.c index 3a9234c..dc813c8 100644 --- a/src/tipideed/cgi.c +++ b/src/tipideed/cgi.c @@ -263,11 +263,12 @@ static inline void print_cgi_headers (tipidee_headers const *hdr, size_t rbodyle static char const *const nope_table[] = { "Connection", + "Content-Length", "Date", "Status", - "Content-Length", 0 } ; + char fmt[SIZE_FMT] ; for (size_t i = 0 ; i < hdr->n ; i++) { char const *key = hdr->buf + hdr->list[i].left ; @@ -281,14 +282,10 @@ static inline void print_cgi_headers (tipidee_headers const *hdr, size_t rbodyle buffer_putsnoflush(buffer_1, hdr->buf + hdr->list[i].right) ; buffer_putnoflush(buffer_1, "\r\n", 2) ; } - if (rbodylen) - { - char fmt[SIZE_FMT] ; - fmt[size_fmt(fmt, rbodylen)] = 0 ; - buffer_putsnoflush(buffer_1, "Content-Length: ") ; - buffer_putsnoflush(buffer_1, fmt) ; - buffer_putnoflush(buffer_1, "\r\n", 2) ; - } + fmt[size_fmt(fmt, rbodylen)] = 0 ; + buffer_putsnoflush(buffer_1, "Content-Length: ") ; + buffer_putsnoflush(buffer_1, fmt) ; + buffer_putnoflush(buffer_1, "\r\n", 2) ; } static inline int process_cgi_output (tipidee_rql *rql, tipidee_headers const *hdr, char const *rbody, size_t rbodylen, char *uribuf, char const *cginame) |