![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community, here is the log from the commit of package perl-HTTP-DAV for openSUSE:Factory checked in at Mon Nov 22 15:15:27 CET 2010. -------- --- perl-HTTP-DAV/perl-HTTP-DAV.changes 2010-07-27 11:16:03.000000000 +0200 +++ perl-HTTP-DAV/perl-HTTP-DAV.changes 2010-11-22 13:27:27.000000000 +0100 @@ -1,0 +2,8 @@ +Mon Nov 22 12:52:15 CET 2010 - anicka@suse.cz + +- update to 0.42 + * Fixed RT #60457 (http://rt.cpan.org/Public/Bug/Display.html?id=60457), + Added and documented possibility to pass your own custom HTTP headers. + * Fixed errors in the code examples in the synopsis. + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- HTTP-DAV-0.41.tar.bz2 New: ---- HTTP-DAV-0.42.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-HTTP-DAV.spec ++++++ --- /var/tmp/diff_new_pack.Jssiui/_old 2010-11-22 15:14:12.000000000 +0100 +++ /var/tmp/diff_new_pack.Jssiui/_new 2010-11-22 15:14:12.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package perl-HTTP-DAV (Version 0.41) +# spec file for package perl-HTTP-DAV (Version 0.42) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -21,7 +21,7 @@ Name: perl-HTTP-DAV %define cpan_name HTTP-DAV Summary: WebDAV client library for Perl5 -Version: 0.41 +Version: 0.42 Release: 1 License: GPL+ or Artistic Group: Development/Libraries/Perl ++++++ HTTP-DAV-0.41.tar.bz2 -> HTTP-DAV-0.42.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-DAV-0.41/Changes new/HTTP-DAV-0.42/Changes --- old/HTTP-DAV-0.41/Changes 2010-07-24 19:34:39.000000000 +0200 +++ new/HTTP-DAV-0.42/Changes 2010-11-07 16:54:50.000000000 +0100 @@ -1,4 +1,11 @@ Revision history for PerlDAV + v0.42 (released 2010/11/07): + * bug fixes + + - Fixed RT #60457 (http://rt.cpan.org/Public/Bug/Display.html?id=60457), + Added and documented possibility to pass your own custom HTTP headers. + - Fixed errors in the code examples in the synopsis. + v0.41 (released 2010/07/24): * bug fixes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-DAV-0.41/DAV/Comms.pm new/HTTP-DAV-0.42/DAV/Comms.pm --- old/HTTP-DAV-0.41/DAV/Comms.pm 2010-01-27 10:31:45.000000000 +0100 +++ new/HTTP-DAV-0.42/DAV/Comms.pm 2010-11-07 16:37:28.000000000 +0100 @@ -69,14 +69,21 @@ sub set_headers { my ( $self, $headers ) = @_; + my $dav_headers; + if ( defined $headers && ref($headers) eq "HTTP::Headers" ) { - $headers = HTTP::DAV::Headers->clone($headers); + $dav_headers = HTTP::DAV::Headers->clone($headers); } - else { - $headers = HTTP::DAV::Headers->new; + elsif (defined $headers && ref($headers) eq "HASH") { + $dav_headers = HTTP::DAV::Headers->new(); + for (keys %{ $headers }) { + $dav_headers->header($_ => $headers->{$_}); + } + } else { + $dav_headers = HTTP::DAV::Headers->new; } - $self->{_headers} = $headers; + $self->{_headers} = $dav_headers; } sub _set_last_request { $_[0]->{_last_request} = $_[1]; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-DAV-0.41/DAV/Resource.pm new/HTTP-DAV-0.42/DAV/Resource.pm --- old/HTTP-DAV-0.41/DAV/Resource.pm 2009-12-12 22:11:31.000000000 +0100 +++ new/HTTP-DAV-0.42/DAV/Resource.pm 2010-11-07 16:02:54.000000000 +0100 @@ -523,12 +523,14 @@ # put/PUT the body contents sub put { - my ($self,$content) = @_; + my ($self,$content,$custom_headers) = @_; my $resp; # Setup the If: header if it is locked my $headers = HTTP::DAV::Headers->new(); + $self->_setup_if_headers($headers); + $self->_setup_custom_headers($custom_headers); if ( ! defined $content ) { $content = $self->get_content(); @@ -1161,6 +1163,20 @@ } } +sub _setup_custom_headers { + my ($self,$headers,$custom_headers) = @_; + + if ($custom_headers && ref $custom_headers eq 'HASH') { + for my $hdr_name (keys %{ $custom_headers }) { + my $hdr_value = $custom_headers->{$hdr_name}; + warn "Setting custom header $hdr_name to '$hdr_value'\n"; + $headers->header($hdr_name => $hdr_value); + } + } + + return; +} + ########################################################################### # $self->_setup_if_headers( $headers_obj, [0|1] ); # used by at least PUT,MKCOL,DELETE,COPY/MOVE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-DAV-0.41/DAV.pm new/HTTP-DAV-0.42/DAV.pm --- old/HTTP-DAV-0.41/DAV.pm 2010-07-24 20:00:32.000000000 +0200 +++ new/HTTP-DAV-0.42/DAV.pm 2010-11-07 16:53:39.000000000 +0100 @@ -17,11 +17,11 @@ use File::Glob; #use Carp (cluck); -use Cwd qw(getcwd); # Can't import all of it, cwd clashes with our namespace. +use Cwd (); # Can't import all of it, cwd clashes with our namespace. # Globals -$VERSION = '0.41'; -$VERSION_DATE = '2010/07/24'; +$VERSION = '0.42'; +$VERSION_DATE = '2010/11/07'; # Set this up to 3 $DEBUG = 0; @@ -54,7 +54,10 @@ @p ); $self->{_lockedresourcelist} = HTTP::DAV::ResourceList->new(); - $self->{_comms} = HTTP::DAV::Comms->new( -useragent => $useragent ); + $self->{_comms} = HTTP::DAV::Comms->new( + -useragent => $useragent, + -headers => $headers + ); if ($uri) { $self->set_workingresource( $self->new_resource( -uri => $uri ) ); } @@ -284,7 +287,7 @@ # $to ||= ''; if ( $to eq '.' ) { - $to = getcwd(); + $to = Cwd::getcwd(); } # If the TO argument is a file handle or a scalar @@ -879,8 +882,8 @@ ###################################################################### sub put { my ( $self, @p ) = @_; - my ( $local, $url, $callback ) - = HTTP::DAV::Utils::rearrange( [ 'LOCAL', 'URL', 'CALLBACK' ], @p ); + my ( $local, $url, $callback, $custom_headers ) + = HTTP::DAV::Utils::rearrange( [ 'LOCAL', 'URL', 'CALLBACK', 'HEADERS' ], @p ); if ( ref($local) eq "SCALAR" ) { $self->_start_multi_op( 'put ' . ${$local}, $callback ); @@ -897,7 +900,8 @@ $self->_put( -local => $file, -url => $url, - -callback => $callback + -callback => $callback, + -headers => $custom_headers, ); } } @@ -907,8 +911,8 @@ sub _put { my ( $self, @p ) = @_; - my ( $local, $url ) - = HTTP::DAV::Utils::rearrange( [ 'LOCAL', 'URL' ], @p ); + my ( $local, $url, $custom_headers ) + = HTTP::DAV::Utils::rearrange( [ 'LOCAL', 'URL', 'HEADERS' ], @p ); return $self->err('ERR_WRONG_ARGS') if ( !defined $local || $local eq "" ); @@ -946,7 +950,7 @@ # mkcol # Return 0 if fail because the error will have already # been set by the mkcol routine - if ( $self->mkcol($target) ) { + if ( $self->mkcol($target, -headers => $custom_headers) ) { if ( !opendir( DIR, $local ) ) { $self->err( 'ERR_GENERIC', "chdir to \"$local\" failed: $!" ); } @@ -989,7 +993,7 @@ if ( !$fail ) { my $resource = $self->new_resource( -uri => $target ); - my $response = $resource->put($content); + my $response = $resource->put($content,$custom_headers); if ( $response->is_success ) { $self->ok( "put $target (" . length($content) . " bytes)", $target ); @@ -1141,15 +1145,19 @@ use HTTP::DAV; - $d = new HTTP::DAV; + $d = HTTP::DAV->new(); $url = "http://host.org:8080/dav/"; - - $d->credentials( -user=>"pcollins",-pass =>"mypass", - -url =>$url, -realm=>"DAV Realm" ); - - $d->open( -url=>"$url ) + + $d->credentials( + -user => "pcollins", + -pass => "mypass", + -url => $url, + -realm => "DAV Realm" + ); + + $d->open( -url => $url ) or die("Couldn't open $url: " .$d->message . "\n"); - + # Make a null lock on newdir $d->lock( -url => "$url/newdir", -timeout => "10m" ) or die "Won't put unless I can lock for 10 minutes\n"; @@ -1319,11 +1327,19 @@ =item B<new(USERAGENT)> +=item B<new(USERAGENT, HEADERS)> + Creates a new C<HTTP::DAV> client - $d = HTTP::DAV->new() + $d = HTTP::DAV->new(); -The C<-useragent> parameter expects an C<HTTP::DAV::UserAgent> object. See the C<dave> program for an advanced example of a custom UserAgent that interactively prompts the user for their username and password. +The C<-useragent> parameter allows you to pass your own B<user agent object> and expects an C<HTTP::DAV::UserAgent> object. See the C<dave> program for an advanced example of a custom UserAgent that interactively prompts the user for their username and password. + +The C<-headers> parameter allows you to specify a list of headers to be sent along with all requests. This can be either a hashref like: + + { "X-My-Header" => "value", ... } + +or a L<HTTP::Headers> object. =item B<credentials(USER,PASS,[URL],[REALM])> @@ -1704,11 +1720,11 @@ See C<set_prop> and C<unset_prop> for examples. -=item B<put(LOCAL,[URL],[CALLBACK])> +=item B<put(LOCAL,[URL],[CALLBACK],[HEADERS])> -uploads the files or directories at -local to the remote destination at -url. +uploads the files or directories at C<-local> to the remote destination at C<-url>. --local points to a file, directory or series of files or directories (indicated by a glob). +C<-local> points to a file, directory or series of files or directories (indicated by a glob). If the filename contains any of the characters `*', `?' or `[' it is a candidate for filename substitution, also known as ``globbing''. This word is then regarded as a pattern (``glob-pattern''), and replaced with an alphabetically sorted list of file names which match the pattern. @@ -1720,6 +1736,8 @@ See L<get()> for a description of what the optional callback parameter does. +You can also pass a C<-headers> argument. That allows to specify custom HTTP headers. It can be either a hashref with header names and values, or a L<HTTP::Headers> object. + B<put examples:> Put a string to the server: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-DAV-0.41/META.yml new/HTTP-DAV-0.42/META.yml --- old/HTTP-DAV-0.41/META.yml 2010-07-24 20:12:35.000000000 +0200 +++ new/HTTP-DAV-0.42/META.yml 2010-11-07 16:57:25.000000000 +0100 @@ -1,6 +1,6 @@ --- #YAML:1.0 name: HTTP-DAV -version: 0.41 +version: 0.42 abstract: ~ author: [] license: unknown @@ -17,7 +17,7 @@ directory: - t - inc -generated_by: ExtUtils::MakeMaker version 6.54 +generated_by: ExtUtils::MakeMaker version 6.56 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-DAV-0.41/doc/Changes.pod new/HTTP-DAV-0.42/doc/Changes.pod --- old/HTTP-DAV-0.41/doc/Changes.pod 2010-07-24 19:34:31.000000000 +0200 +++ new/HTTP-DAV-0.42/doc/Changes.pod 2010-11-07 16:52:25.000000000 +0100 @@ -12,6 +12,18 @@ =end text +=head2 v0.42 (released 2010/11/07): + +=over 4 + +=item * B<bug fixes> + + - Fixed RT #60457 (http://rt.cpan.org/Public/Bug/Display.html?id=60457), + Added and documented possibility to pass your own custom HTTP headers. + - Fixed errors in the code examples in the synopsis. + +=back + =head2 v0.41 (released 2010/07/24): =over 4 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org