Preparing to implement MOVE and COPY methods
authorArt Cancro <ajc@citadel.org>
Sun, 5 Mar 2023 16:33:02 +0000 (11:33 -0500)
committerArt Cancro <ajc@citadel.org>
Sun, 5 Mar 2023 16:33:02 +0000 (11:33 -0500)
webcit-ng/server/request.c
webcit-ng/server/room_functions.c

index 605520e68f8debb0d8d961c9f24feb5d709538ac..6622c28b108f70a54ec904019b91ad907ba86d54 100644 (file)
@@ -4,7 +4,7 @@
 // and pass control back down to the HTTP layer to output the response back to
 // the client.
 //
-// Copyright (c) 1996-2022 by the citadel.org team
+// Copyright (c) 1996-2023 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or
 // disclosure are subject to the GNU General Public License v3.
@@ -132,10 +132,12 @@ void perform_request(struct http_transaction *h) {
        // WebDAV methods like OPTIONS and PROPFIND *require* a logged-in session,
        // even if the Citadel server allows anonymous access.
        if (IsEmptyStr(c->auth)) {
-               if (    (!strcasecmp(h->method, "OPTIONS"))
+               if (       (!strcasecmp(h->method, "OPTIONS"))
                        || (!strcasecmp(h->method, "PROPFIND"))
                        || (!strcasecmp(h->method, "REPORT"))
                        || (!strcasecmp(h->method, "DELETE"))
+                       || (!strcasecmp(h->method, "MOVE"))
+                       || (!strcasecmp(h->method, "COPY"))
                ) {
                        request_http_authenticate(h);
                        disconnect_from_citadel(c);
index f6c843b7e3336a30231a0e9d0f57de66a7ed1e8f..9e7896c5edaf7c15c09dd78fee3dac643a62becb 100644 (file)
@@ -1,6 +1,6 @@
 // Room functions
 //
-// Copyright (c) 1996-2022 by the citadel.org team
+// Copyright (c) 1996-2023 by the citadel.org team
 //
 // This program is open source software.  Use, duplication, or
 // disclosure are subject to the GNU General Public License v3.
@@ -299,6 +299,12 @@ void object_in_room(struct http_transaction *h, struct ctdlsession *c) {
        else if (!strcasecmp(h->method, "PUT")) {
                dav_put_message(h, c, unescaped_euid, msgnum);
        }
+       else if (!strcasecmp(h->method, "MOVE")) {
+               do_404(h);      // FIXME write this
+       }
+       else if (!strcasecmp(h->method, "COPY")) {
+               do_404(h);      // FIXME write this
+       }
        else {
                do_404(h);      // Got this far but the method made no sense?  Bummer.
        }
@@ -330,7 +336,7 @@ void options_the_room_itself(struct http_transaction *h, struct ctdlsession *c)
        else {
                add_response_header(h, strdup("DAV"), strdup("1"));     // ordinary WebDAV for all other room types
        }
-       add_response_header(h, strdup("Allow"), strdup("OPTIONS, PROPFIND, GET, PUT, REPORT, DELETE"));
+       add_response_header(h, strdup("Allow"), strdup("OPTIONS, PROPFIND, GET, PUT, REPORT, DELETE, MOVE, COPY"));
 }