aboutsummaryrefslogtreecommitdiffstats
path: root/src/tipideed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tipideed')
-rw-r--r--src/tipideed/cgi.c2
-rw-r--r--src/tipideed/errors.c4
-rw-r--r--src/tipideed/options.c2
-rw-r--r--src/tipideed/tipideed.c9
4 files changed, 9 insertions, 8 deletions
diff --git a/src/tipideed/cgi.c b/src/tipideed/cgi.c
index 069d045..905792c 100644
--- a/src/tipideed/cgi.c
+++ b/src/tipideed/cgi.c
@@ -338,7 +338,7 @@ 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 && rql->m != TIPIDEE_METHOD_HEAD)
+ else if (autochunk)
buffer_putsnoflush(buffer_1, "Transfer-Encoding: chunked\r\n") ;
buffer_putnoflush(buffer_1, "\r\n", 2) ;
diff --git a/src/tipideed/errors.c b/src/tipideed/errors.c
index 9b00f3b..edde934 100644
--- a/src/tipideed/errors.c
+++ b/src/tipideed/errors.c
@@ -38,7 +38,7 @@ void response_error_early_plus_and_exit (tipidee_rql const *rql, unsigned int st
void eexit_405 (tipidee_rql const *rql)
{
- static tipidee_response_header const allowpost = { .key = "Allow", .value = "GET, HEAD, POST", .options = 0 } ;
+ static tipidee_response_header const allowpost = { .key = "Allow", .value = "GET, HEAD, POST, PUT, DELETE, PATCH", .options = 0 } ;
response_error_early_plus_and_exit(rql, 405, "Method Not Allowed", "Invalid method for the resource.", &allowpost, 1) ;
}
@@ -127,7 +127,7 @@ void response_error_plus_and_die (tipidee_rql const *rql, int e, char const *doc
void exit_405 (tipidee_rql const *rql, char const *docroot, uint32_t options)
{
- tipidee_response_header hd = { .key = "Allow", .value = options & 1 ? "GET, HEAD, POST" : "GET, HEAD", .options = 0 } ;
+ tipidee_response_header hd = { .key = "Allow", .value = options & 1 ? "GET, HEAD, POST, PUT, DELETE, PATCH" : "GET, HEAD", .options = 0 } ;
response_error_plus_and_exit(rql, docroot, 405, &hd, 1) ;
}
diff --git a/src/tipideed/options.c b/src/tipideed/options.c
index 0ecbb6f..6de40ba 100644
--- a/src/tipideed/options.c
+++ b/src/tipideed/options.c
@@ -17,7 +17,7 @@ int respond_options (tipidee_rql const *rql, uint32_t flags)
tipidee_response_status(buffer_1, rql, 200, "OK") ;
tipidee_response_header_writeall_G(buffer_1, g.rhdr, g.rhdrn, 0) ;
buffer_putsnoflush(buffer_1, "Content-Length: 0\r\nAllow: GET, HEAD") ;
- if (flags & 1) buffer_putsnoflush(buffer_1, ", POST") ;
+ if (flags & 1) buffer_putsnoflush(buffer_1, ", POST, PUT, DELETE, PATCH") ;
buffer_putnoflush(buffer_1, "\r\n\r\n", 4) ;
if (flags & 2) tipidee_log_answer(g.logv, rql, 200, 0) ;
tain_add_g(&deadline, &g.writetto) ;
diff --git a/src/tipideed/tipideed.c b/src/tipideed/tipideed.c
index 35abdf2..4c226cb 100644
--- a/src/tipideed/tipideed.c
+++ b/src/tipideed/tipideed.c
@@ -458,7 +458,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
x = tipidee_headers_search(&hdr, "Transfer-Encoding") ;
- if (x)
+ if (rql.http_minor && x)
{
if (strcasecmp(x, "chunked")) eexit_400(&rql, "unsupported Transfer-Encoding") ;
else tcoding = TIPIDEE_TRANSFERCODING_CHUNKED ;
@@ -483,12 +483,13 @@ int main (int argc, char const *const *argv, char const *const *envp)
case TIPIDEE_METHOD_GET :
case TIPIDEE_METHOD_HEAD :
case TIPIDEE_METHOD_POST :
- case TIPIDEE_METHOD_TRACE : break ;
+ case TIPIDEE_METHOD_TRACE :
+ case TIPIDEE_METHOD_PUT :
+ case TIPIDEE_METHOD_DELETE :
+ case TIPIDEE_METHOD_PATCH : break ;
case TIPIDEE_METHOD_OPTIONS :
if (!rql.uri.path) { respond_options(&rql, 1) ; continue ; }
break ;
- case TIPIDEE_METHOD_PUT :
- case TIPIDEE_METHOD_DELETE : eexit_405(&rql) ;
case TIPIDEE_METHOD_CONNECT : eexit_501(&rql, "CONNECT method unsupported") ;
case TIPIDEE_METHOD_PRI : eexit_501(&rql, "PRI method attempted with HTTP version 1") ;
default : strerr_dief2x(101, "can't happen: ", "unknown HTTP method") ;