Net-DAV-Server

 view release on metacpan or  search on metacpan

lib/Net/DAV/Server.pm  view on Meta::CPAN


        # Saying it isn't implemented is better than crashing!
        $response->code(501);
        $response->message('Not Implemented');
    }
    return $response;
}

sub options {
    my ( $self, $request, $response ) = @_;
    $response->header( 'DAV'           => '1,2,<http://apache.org/dav/propset/fs/1>' );    # Nautilus freaks out
    $response->header( 'MS-Author-Via' => 'DAV' );                                         # Nautilus freaks out
    $response->header( 'Allow'         => join( ',', map { uc } keys %implemented ) );
    $response->header( 'Content-Type'  => 'httpd/unix-directory' );
    $response->header( 'Keep-Alive'    => 'timeout=15, max=96' );
    return $response;
}

sub head {
    my ( $self, $request, $response ) = @_;
    my $path = uri_unescape $request->uri->path;

litmus_test/litmus.out  view on Meta::CPAN

 9. move_cleanup.......... pass
10. finish................ pass
<- summary for `copymove': of 11 tests run: 11 passed, 0 failed. 100.0%
-> running `props':
 0. init.................. pass
 1. begin................. pass
 2. propfind_invalid...... pass
 3. propfind_invalid2..... FAIL (PROPFIND with invalid namespace declaration in body (see FAQ) got 207 response not 400)
 4. propfind_d0........... pass
 5. propinit.............. pass
 6. propset............... FAIL (PROPPATCH on `/litmus/prop': 501 Not Implemented)
 7. propget............... SKIPPED
 8. propmove.............. SKIPPED
 9. propget............... SKIPPED
10. propdeletes........... SKIPPED
11. propget............... SKIPPED
12. propreplace........... SKIPPED
13. propget............... SKIPPED
14. propnullns............ SKIPPED
15. propget............... SKIPPED
16. prophighunicode....... SKIPPED

t/server_options.t  view on Meta::CPAN

use lib "$FindBin::Bin/lib";
use Mock::Filesys;

use Net::DAV::Server ();

{
    my $dav = Net::DAV::Server->new();
    my $res = $dav->options( HTTP::Request->new(), HTTP::Response->new( 200 ) );
    isa_ok( $res, 'HTTP::Response' );
    is( $res->header('MS-Author-Via'), 'DAV', 'No FS: Microsoft author header' );
    is( $res->header( 'DAV' ), '1,2,<http://apache.org/dav/propset/fs/1>', 'No FS: Capability header is correct.' );
    is_deeply(
        [ sort split /,\s*/, $res->header('Allow') ],
        [ qw/COPY DELETE GET HEAD LOCK MKCOL MOVE OPTIONS POST PROPFIND PUT UNLOCK/ ],
        'No FS: Expected methods are allowed.'
    );
}

{
    my $dav = Net::DAV::Server->new();
    $dav->filesys( Mock::Filesys->new() );
    my $res = $dav->options( HTTP::Request->new(), HTTP::Response->new( 200 ) );
    isa_ok( $res, 'HTTP::Response' );
    isa_ok( $dav->filesys, 'Mock::Filesys' );
    is( $res->header('MS-Author-Via'), 'DAV', 'FS: Microsoft author header' );
    is( $res->header( 'DAV' ), '1,2,<http://apache.org/dav/propset/fs/1>', 'FS: Capability header is correct.' );
    is_deeply(
        [ sort split /,\s*/, $res->header('Allow') ],
        [ qw/COPY DELETE GET HEAD LOCK MKCOL MOVE OPTIONS POST PROPFIND PUT UNLOCK/ ],
        'FS: Expected methods are allowed.'
    );
}

t/server_run.t  view on Meta::CPAN


use FindBin;
use lib "$FindBin::Bin/lib";
use Mock::Filesys;

{
    my $dav = Net::DAV::Server->new( -filesys => Mock::Filesys->new() );
    my $res = $dav->run( HTTP::Request->new( OPTIONS => '/' ) );
    isa_ok( $res, 'HTTP::Response' );
    is( $res->header('MS-Author-Via'), 'DAV', 'No FS: Microsoft author header' );
    is( $res->header( 'DAV' ), '1,2,<http://apache.org/dav/propset/fs/1>', 'No FS: Capability header is correct.' );
    is_deeply(
        [ sort split /,\s*/, $res->header('Allow') ],
        [ qw/COPY DELETE GET HEAD LOCK MKCOL MOVE OPTIONS POST PROPFIND PUT UNLOCK/ ],
        'No FS: Expected methods are allowed.'
    );
}

{
    my $dav = Net::DAV::Server->new();
    my $res = eval { $dav->run( HTTP::Request->new( OPTIONS => '/' ) ); };



( run in 0.871 second using v1.01-cache-2.11-cpan-71847e10f99 )