|
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:
-- 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. |
- [Mojolicious] CalDAV server? 'Daniel Böhringer' via Mojolicious
- Re: [Mojolicious] CalDAV server? Dotan Dimet
- Re: [Mojolicious] CalDAV serv... 'Daniel Böhringer' via Mojolicious
