diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-03-24 21:56:42 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2025-03-24 21:56:42 +0000 |
| commit | 7adb5cfb425dd927b3e78f1a9da75d825f6a3904 (patch) | |
| tree | 0fbc1aed0578414d48c7e2a8c94b8bfd28189e84 /src | |
| parent | 3f93b63a799bd4c131cc78af3836df7eb30fdf39 (diff) | |
| download | tipidee-7adb5cfb425dd927b3e78f1a9da75d825f6a3904.tar.gz | |
Respect HEAD in cgi
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/tipideed/cgi.c | 9 | ||||
| -rw-r--r-- | src/tipideed/tipideed.c | 4 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/tipideed/cgi.c b/src/tipideed/cgi.c index 21e21db..069d045 100644 --- a/src/tipideed/cgi.c +++ b/src/tipideed/cgi.c @@ -338,13 +338,18 @@ static inline int do_cgi (tipidee_rql *rql, char const *docroot, char const *con buffer_putsnoflush(buffer_1, fmt) ; buffer_putnoflush(buffer_1, "\r\n", 2) ; } - else if (autochunk) + else if (autochunk && rql->m != TIPIDEE_METHOD_HEAD) buffer_putsnoflush(buffer_1, "Transfer-Encoding: chunked\r\n") ; buffer_putnoflush(buffer_1, "\r\n", 2) ; tipidee_log_answer(g.logv, rql, status, rbodylen) ; - if (contentlength) + if (rql->m == TIPIDEE_METHOD_HEAD) + { + if (!buffer_timed_flush_g(buffer_1, &deadline)) + strerr_diefu1sys(111, "write to stdout") ; + } + else if (contentlength) { size_t len ; struct iovec v[2] ; diff --git a/src/tipideed/tipideed.c b/src/tipideed/tipideed.c index a5f9fcd..35abdf2 100644 --- a/src/tipideed/tipideed.c +++ b/src/tipideed/tipideed.c @@ -292,7 +292,9 @@ static inline int serve (tipidee_rql *rql, char const *docroot, char *uribuf, ti if (!(ra.flags & TIPIDEE_RA_FLAG_CGI)) { if (infopath[0]) { respond_404(rql, docroot) ; return 0 ; } - if (rql->m == TIPIDEE_METHOD_POST) exit_405(rql, docroot, 0) ; + if (rql->m != TIPIDEE_METHOD_GET + && rql->m != TIPIDEE_METHOD_HEAD + && rql->m != TIPIDEE_METHOD_OPTIONS) exit_405(rql, docroot, 0) ; } if (rql->m == TIPIDEE_METHOD_OPTIONS) |
