summaryrefslogtreecommitdiff
path: root/src/tipideed/cgi.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-09-29 16:38:46 +0000
committerLaurent Bercot <ska@appnovation.com>2023-09-29 16:38:46 +0000
commitf1a6903f46c0e2edcdd2b7fa83c8a5bb4ca0e021 (patch)
treef7430b4070c761bd0ad6cd26587e210a9defbf54 /src/tipideed/cgi.c
parent03696fce8d0061a70ea16aef8be0c0adbae8c5af (diff)
downloadtipidee-f1a6903f46c0e2edcdd2b7fa83c8a5bb4ca0e021.tar.xz
Send CGI Content-Length even when 0
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/tipideed/cgi.c')
-rw-r--r--src/tipideed/cgi.c15
1 files changed, 6 insertions, 9 deletions
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)