Skip Menu |

This queue is for tickets about the HTTP-DAV CPAN distribution.

Report information
The Basics
Id: 17003
Status: new
Priority: 0/
Queue: HTTP-DAV

People
Owner: Nobody in particular
Requestors: cpan [...] aithal.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Allow MKCOL requests to send a request body
The attached small patch allows for a content string to be passed to the mkcol method. This allows you to create more complex collection resources depending on the nature of your DAV server. Once patched, you can do the following: $d->mkcol(-url=> $url, -content=>'some content for the server'); The patch is against HTTP-DAV-0.31 Tested on: This is perl, v5.8.6 built for i586-linux-thread-multi
--- HTTP/DAV.pm.orig 2006-01-10 14:49:38.000000000 +0000 +++ HTTP/DAV.pm 2006-01-10 15:07:12.000000000 +0000 @@ -542,7 +542,7 @@ # MKCOL sub mkcol { my($self,@p) = @_; - my ($url) = HTTP::DAV::Utils::rearrange(['URL'], @p); + my ($url,$content) = HTTP::DAV::Utils::rearrange(['URL','CONTENT'], @p); return $self->err('ERR_WRONG_ARGS') if (!defined $url || $url eq ""); return $self->err('ERR_NULL_RESOURCE') unless $self->get_workingresource(); @@ -551,8 +551,8 @@ my $new_url = $self->get_absolute_uri($url); my $resource = $self->new_resource( -uri => $new_url ); - # Make the lock - my $resp = $resource->mkcol(); + # Make the collection + my $resp = $resource->mkcol($content); if ( $resp->is_success() ) { return $self->ok( "mkcol $new_url", $new_url ); } else { @@ -1409,7 +1409,7 @@ $d->put("/tmp/index.html",$uri); $d->unlock($uri); -=item B<mkcol(URL)> +=item B<mkcol(URL,[CONTENT])> make a remote collection (directory) @@ -1422,6 +1422,18 @@ $d->mkcol("/dav_dir/new_dir"); # Should succeed $d->mkcol("/dav_dir/new_dir/xxx/yyy"); # Should fail +=over 4 + +=item C<-url> + +is the remote resource you'd like to create. Mandatory + +=item C<-content> + +is the content of the MKCOL request body. The behaviour of this is dependent on the server functionality. In the majority of cases, the content should not be specified. Optional + +=back + =item B<move(URL,DEST,[OVERWRITE],[DEPTH])> moves one remote resource to another --- HTTP/DAV/Resource.pm.orig 2006-01-10 14:52:02.000000000 +0000 +++ HTTP/DAV/Resource.pm 2006-01-10 14:53:08.000000000 +0000 @@ -543,7 +543,7 @@ ########################################################################### # Make a collection sub mkcol { - my ($self) = @_; + my ($self, $content) = @_; # Setup the If: header if it is locked my $headers = HTTP::DAV::Headers->new(); @@ -553,6 +553,7 @@ -method => "MKCOL", -uri => $self->get_uri, -headers=> $headers, + -content=> $content, ); # Handle a multistatus response