Possible? Sure.
Easy? Nope.

Mojolicious lets you specify whatever HTTP method you want in routes (using the any() method), so you can define responses to all those exotic verbs defined in WebDAV and CalDav.

However, you need to implement all the logic yourself, because nobody seems to have done so in the Mojo ecosystem (although there are WebDAV and CalDAV modules on CPAN)

For example, here's how you can implement the OPTIONS example you linked to in the RFC:

#!/usr/bin/env perl

use Mojolicious::Lite;

any '/' => [qw(OPTIONS)] => sub {
    my $c = shift;
    $c->res->headers->allow("OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, COPY, MOVE");
    $c->res->headers->content_length(0);
    $c->rendered(200);
};

app->start;

And to see the response (first 3 lines are server log):

./dav.pl get -v -M OPTIONS /
[Sun Sep 10 17:00:40 2017] [debug] OPTIONS "/"
[Sun Sep 10 17:00:40 2017] [debug] Routing to a callback
[Sun Sep 10 17:00:40 2017] [debug] 200 OK (0.000412s, 2427.184/s)
OPTIONS / HTTP/1.1
Content-Length: 0
Accept-Encoding: gzip
Host: 127.0.0.1:44435
User-Agent: Mojolicious (Perl)

HTTP/1.1 200 OK
Date: Sun, 10 Sep 2017 14:00:40 GMT
Allow: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, COPY, MOVE
Server: Mojolicious (Perl)
Content-Length: 0


On 10/09/17 15:19, 'Daniel Böhringer' via Mojolicious wrote:
hi gents,

is it possible to implement a caldav server using mojolicious?

does mojo support all the exotic verbs (TRACE, COPY, MOVE, PROPFIND, PROPPATCH, LOCK, UNLOCK, REPORT, ACL from https://tools.ietf.org/html/rfc4791#section-5.1.1)?

best wishes,

daniel
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to