[UH_HTTP_MSG_POST] = "POST",
[UH_HTTP_MSG_HEAD] = "HEAD",
[UH_HTTP_MSG_OPTIONS] = "OPTIONS",
+ [UH_HTTP_MSG_PUT] = "PUT",
+ [UH_HTTP_MSG_PATCH] = "PATCH",
+ [UH_HTTP_MSG_DELETE] = "DELETE",
};
void uh_http_header(struct client *cl, int code, const char *summary)
return uh_file_response_ok_hdrs(cl, s);
}
+static void uh_file_response_405(struct client *cl)
+{
+ uh_http_header(cl, 405, "Method Not Allowed");
+}
+
static void uh_file_response_412(struct client *cl)
{
uh_http_header(cl, 412, "Precondition Failed");
struct http_request *req = &cl->request;
char *error_handler, *escaped_url;
+ switch (cl->request.method) {
+ case UH_HTTP_MSG_GET:
+ case UH_HTTP_MSG_POST:
+ case UH_HTTP_MSG_HEAD:
+ case UH_HTTP_MSG_OPTIONS:
+ break;
+
+ default:
+ uh_file_response_405(cl);
+ ustream_printf(cl->us, "\r\n");
+ uh_request_done(cl);
+ return;
+ }
+
if (!(pi->stat.st_mode & S_IROTH))
goto error;