You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2012/06/20 10:12:38 UTC
svn commit: r1351981 - in /incubator/ooo/trunk: ext_libraries/serf/ main/
main/scp2/source/ooo/ main/solenv/bin/ main/ucb/source/ucp/webdav/
Author: af
Date: Wed Jun 20 08:12:37 2012
New Revision: 1351981
URL: http://svn.apache.org/viewvc?rev=1351981&view=rev
Log:
#i120041# Update of serf library from 1.0.0 to 1.1.0.
Modified:
incubator/ooo/trunk/ext_libraries/serf/makefile.mk
incubator/ooo/trunk/ext_libraries/serf/serf_version.mk
incubator/ooo/trunk/main/external_deps.lst
incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp
incubator/ooo/trunk/main/solenv/bin/download_external_dependencies.pl
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.cxx
incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.hxx
Modified: incubator/ooo/trunk/ext_libraries/serf/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/serf/makefile.mk?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/ext_libraries/serf/makefile.mk (original)
+++ incubator/ooo/trunk/ext_libraries/serf/makefile.mk Wed Jun 20 08:12:37 2012
@@ -35,31 +35,21 @@ TARGET=so_serf
LIBSERFVERSION=$(SERF_MAJOR).$(SERF_MINOR).$(SERF_MICRO)
TARFILE_NAME=$(PRJNAME)-$(LIBSERFVERSION)
-TARFILE_MD5=3b179ed18f65c43141528aa6d2440db4
+# This is the SHA1 checksum, not MD5 but tg_ext.mk does not now about this and,
+# thankfully, does not care.
+TARFILE_MD5=231af70b7567a753b49df4216743010c193884b7
-# Apply patches that provide callbacks for ssl certificate verification with the
-# whole certificate chain (issue68.patch). The patch is taken from serf's
-# issue 68 (http://code.google.com/p/serf/issues/detail?id=68).
-# This patch needs some minor fixes (issue68b.patch) for proper initialization of
-# some callbacks and export of new functions.
-PATCH_FILES=$(TARFILE_NAME).issue68.patch $(TARFILE_NAME).issue68b.patch
-
-# disable default used Transfer-Encoding = chunked for sending requests.
-PATCH_FILES+=$(TARFILE_NAME).nochunkedtransferencoding.patch
+PATCH_FILES=
.IF "$(OS)"=="WNT"
-ADDITIONAL_FILES=Makefile Module_serf.mk Library_serf.mk Package_inc.mk
-
-PATCH_FILES+=$(TARFILE_NAME).makewin32.patch
-
CONFIGURE_DIR=
CONFIGURE_ACTION=
CONFIGURE_FLAGS=
-BUILD_DIR=$(CONFIGURE_DIR)
+BUILD_DIR=
BUILD_ACTION=$(GNUMAKE)
-BUILD_FLAGS+= -j$(EXTMAXPROCESS)
+BUILD_FLAGS+= -f ../../../../win/Makefile -j$(EXTMAXPROCESS)
.ELIF "$(GUI)" == "OS2"
@@ -71,18 +61,17 @@ BUILD_FLAGS+= -j$(EXTMAXPROCESS)
.IF "$(OS)"=="MACOSX" || "$(OS)"=="FREEBSD" || "$(OS)"=="LINUX"
# Do not link against expat. It is not necessary (apr-util is already linked against it)
# and does not work (we use a different expat library schema.)
-PATCH_FILES+=$(TARFILE_NAME).mac.patch
+#PATCH_FILES+=$(TARFILE_NAME).mac.patch
.ENDIF
.IF "$(OS)"=="LINUX"
# Add -ldl as last library so that the linker has no trouble resolving dependencies.
-PATCH_FILES+=$(TARFILE_NAME).ldl.patch
+#PATCH_FILES+=$(TARFILE_NAME).ldl.patch
.ENDIF
CONFIGURE_DIR=
CONFIGURE_ACTION=autoconf && .$/configure
-.IF "$(OS)"=="MACOSX" || "$(OS)"=="LINUX"
.IF "$(OS)"=="LINUX"
.IF "$(SYSTEM_OPENSSL)"=="YES"
CDEFS+=$(OPENSSL_CFLAGS)
@@ -91,7 +80,9 @@ OPENSSLINCDIR=external
CDEFS+=-I$(SOLARINCDIR)$/$(OPENSSLINCDIR)
.ENDIF
.ENDIF
+
# On Linux/Mac we need the content of CDEFS in CFLAGS so that the ssl headers are searched for
+.IF "$(OS)"=="MACOSX" || "$(OS)"=="LINUX"
# in a directory that corresponds to the directory that is searched for the ssl library.
CONFIGURE_FLAGS='CFLAGS=$(CDEFS)'
.ENDIF
@@ -100,11 +91,20 @@ BUILD_DIR=$(CONFIGURE_DIR)
BUILD_ACTION=$(GNUMAKE)
BUILD_FLAGS+= -j$(EXTMAXPROCESS)
+.IF "$(OS)"=="MACOSX"
+# Serf names its library only with the major number.
+# We are using minor and micro as well. Fix that here
+# by creating a copy with the right name.
+SERF_ORIGINAL_LIB=.libs/libserf-$(SERF_MAJOR).0.0.0.dylib
+SERF_FIXED_LIB=.libs/libserf-$(LIBSERFVERSION).0.dylib
+INSTALL_ACTION=if [ -f "$(SERF_ORIGINAL_LIB)" -a ! -f "$(SERF_FIXED_LIB)" ]; then cp $(SERF_ORGINAL_LIB) $(SERF_FIXED_LIB); fi
+.ENDIF
+
OUT2INC+=serf*.h
OUT2INC_SUBDIR=serf
.IF "$(OS)"=="MACOSX"
-OUT2LIB+=.libs/libserf-1.*dylib
+OUT2LIB+=$(SERF_FIXED_LIB)
.ELSE
OUT2LIB=.libs/libserf-1.so*
.ENDIF
Modified: incubator/ooo/trunk/ext_libraries/serf/serf_version.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/ext_libraries/serf/serf_version.mk?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/ext_libraries/serf/serf_version.mk (original)
+++ incubator/ooo/trunk/ext_libraries/serf/serf_version.mk Wed Jun 20 08:12:37 2012
@@ -20,5 +20,5 @@
#**************************************************************
SERF_MAJOR=1
-SERF_MINOR=0
+SERF_MINOR=1
SERF_MICRO=0
Modified: incubator/ooo/trunk/main/external_deps.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/external_deps.lst?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/external_deps.lst (original)
+++ incubator/ooo/trunk/main/external_deps.lst Wed Jun 20 08:12:37 2012
@@ -109,9 +109,10 @@ if ( true )
URL2 = $(SVN_TRUNK)$(MD5)-$(name)
if ( true )
- MD5 = 3b179ed18f65c43141528aa6d2440db4
- name = serf-1.0.0.tar.bz2
- URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+ SHA1 = 231af70b7567a753b49df4216743010c193884b7
+ name = serf-1.1.0.tar.bz2
+ URL1 = http://serf.googlecode.com/files/serf-1.1.0.tar.bz2
+ URL2 = http://svn.apache.org/repos/asf/!svn/bc/1351976/incubator/ooo/trunk/ext_sources/$(SHA1)-$(name)
if (SOLAR_JAVA==TRUE && (ENABLE_MEDIAWIKI==YES || ENABLE_REPORTBUILDER==YES))
MD5 = 3c219630e4302863a9a83d0efde889db
Modified: incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp (original)
+++ incubator/ooo/trunk/main/scp2/source/ooo/file_library_ooo.scp Wed Jun 20 08:12:37 2012
@@ -2045,11 +2045,11 @@ File gid_File_Lib_Serf
// Looks like the major version number is part of the name, not
// part of the suffix. An error?
#ifdef MACOSX
- Name = STRING(CONCAT6(libserf-1,.0.,SERF_MINOR,.,SERF_MICRO,UNXSUFFIX));
+ Name = STRING(CONCAT8(libserf-,SERF_MAJOR,.,SERF_MINOR,.,SERF_MICRO,.0,UNXSUFFIX));
#elif FREEBSD
Name = STRING(CONCAT3(libserf-1,UNXSUFFIX,.0));
#else
- Name = STRING(CONCAT6(libserf-1,UNXSUFFIX,.0.,SERF_MINOR,.,SERF_MICRO));
+ Name = STRING(CONCAT3(libserf-1,UNXSUFFIX,.0.0.0));
#endif
#endif
PACKED_LIB_FILE_BODY;
Modified: incubator/ooo/trunk/main/solenv/bin/download_external_dependencies.pl
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/download_external_dependencies.pl?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/download_external_dependencies.pl (original)
+++ incubator/ooo/trunk/main/solenv/bin/download_external_dependencies.pl Wed Jun 20 08:12:37 2012
@@ -31,9 +31,10 @@
replace the definition of global variables and variables earlier in the same
block.
Some variables have special names:
- - MD5 is the expected MD5 sum of the library tarball.
+ - MD5 is the expected MD5 checksum of the library tarball.
+ - SHA1 is the expected SHA1 checksum of the library tarball.
- URL1 to URL9 specify from where to download the tarball. The urls are tried in order.
- The first successful download (download completed and MD5 sum match) stops the iteration.
+ The first successful download (download completed and checksum match) stops the iteration.
Expressions are explained below in the comment of EvaluateExpression().
@@ -62,6 +63,7 @@ use File::Path;
use File::Basename;
use LWP::UserAgent;
use Digest::MD5;
+use Digest::SHA;
use URI;
my $Debug = 1;
@@ -155,10 +157,15 @@ sub ProcessLastBlock ()
else
{
my $name = GetValue('name');
+ my $checksum = GetChecksum();
- if ( ! IsPresent($name, GetValue('MD5')))
+ if ( ! defined $checksum)
{
- AddDownloadRequest($name);
+ die "no checksum given for $name";
+ }
+ elsif ( ! IsPresent($name, $checksum))
+ {
+ AddDownloadRequest($name, $checksum);
}
}
}
@@ -166,15 +173,15 @@ sub ProcessLastBlock ()
-=head3 AddDownloadRequest($name)
+=head3 AddDownloadRequest($name, $checksum)
Add a request for downloading the library $name to @Missing.
Collect all available URL[1-9] variables as source URLs.
=cut
-sub AddDownloadRequest ($)
+sub AddDownloadRequest ($$)
{
- my $name = shift;
+ my ($name, $checksum) = @_;
print "adding download request for $name\n";
@@ -188,7 +195,36 @@ sub AddDownloadRequest ($)
push @$urls, SubstituteVariables($url);
}
- push @Missing, [$name, GetValue('MD5'), $urls];
+ push @Missing, [$name, $checksum, $urls];
+}
+
+
+
+
+=head3 GetChecksum()
+
+ When either MD5 or SHA1 are variables in the current scope then return
+ a reference to a hash with two entries:
+ 'type' is either 'MD5' or 'SHA1', the type or algorithm of the checksum,
+ 'value' is the actual checksum
+ Otherwise undef is returned.
+
+=cut
+sub GetChecksum()
+{
+ my $checksum = GetValue("MD5");
+ if (defined $checksum && $checksum ne "")
+ {
+ return { 'type' => 'MD5', 'value' => $checksum };
+ }
+ elsif (defined ($checksum=GetValue("SHA1")) && $checksum ne "")
+ {
+ return { 'type' => 'SHA1', 'value' => $checksum };
+ }
+ else
+ {
+ return undef;
+ }
}
@@ -334,38 +370,52 @@ sub EvaluateTerm ($)
-=head IsPresent($name,$given_md5)
+=head IsPresent($name, $given_checksum)
Check if an external library tar ball with the basename $name already
exists in the target directory TARFILE_LOCATION. The basename is
- prefixed with the given MD5 sum.
- If the file exists then its MD5 sum is compare with the given MD5 sum.
+ prefixed with the MD5 or SHA1 checksum.
+ If the file exists then its checksum is compared to the given one.
=cut
sub IsPresent ($$)
{
- my $name = shift;
- my $given_md5 = shift;
-
- my $filename = File::Spec->catfile($ENV{'TARFILE_LOCATION'}, $given_md5."-".$name);
+ my ($name, $given_checksum) = @_;
- return 0 if ! -f $filename;
+ my $filename = File::Spec->catfile($ENV{'TARFILE_LOCATION'}, $given_checksum->{'value'}."-".$name);
+ return 0 unless -f $filename;
- # File exists. Check if its md5 sum is correct.
- my $md5 = Digest::MD5->new();
- open my $in, $filename;
- $md5->addfile($in);
+ # File exists. Check if its checksum is correct.
+ my $checksum;
+ if ($given_checksum->{'type'} eq "MD5")
+ {
+ my $md5 = Digest::MD5->new();
+ open my $in, $filename;
+ $md5->addfile($in);
+ $checksum = $md5->hexdigest();
+ }
+ elsif ($given_checksum->{'type'} eq "SHA1")
+ {
+ my $sha1 = Digest::SHA->new("1");
+ open my $in, $filename;
+ $sha1->addfile($in);
+ $checksum = $sha1->hexdigest();
+ }
+ else
+ {
+ die "unsupported checksum type (not MD5 or SHA1)";
+ }
- if ($given_md5 ne $md5->hexdigest())
+ if ($given_checksum->{'value'} ne $checksum)
{
- # MD5 check sum does not match. Delete the file.
- print "$name exists, but md5 does not match => deleting\n";
+ # Checksum does not match. Delete the file.
+ print "$name exists, but checksum does not match => deleting\n";
#unlink($filename);
return 0;
}
else
{
- print "$name exists, md5 is OK\n";
+ printf("%s exists, %s checksum is OK\n", $name, $given_checksum->{'type'});
return 1;
}
}
@@ -377,8 +427,8 @@ sub IsPresent ($$)
Download a set of files specified by @Missing.
- For http URLs there may be an optional MD5 checksum. If it is present then downloaded
- files that do not match that checksum are an error and lead to abortion of the current process.
+ For http URLs there may be an optional checksum. If it is present then downloaded
+ files that do not match that checksum lead to abortion of the current process.
Files that have already been downloaded are not downloaded again.
=cut
@@ -401,11 +451,11 @@ sub Download ()
# Download the missing files.
for my $item (@Missing)
{
- my ($name, $given_md5, $urls) = @$item;
+ my ($name, $checksum, $urls) = @$item;
foreach my $url (@$urls)
{
- last if DownloadFile($given_md5."-".$name, $url, $given_md5);
+ last if DownloadFile($checksum->{'value'}."-".$name, $url, $checksum);
}
}
}
@@ -413,17 +463,17 @@ sub Download ()
-=head3 DownloadFile($name,$URL,$md5sum)
+=head3 DownloadFile($name,$URL,$checksum)
Download a single external library tarball. It origin is given by $URL.
- Its destination is $(TARFILE_LOCATION)/$md5sum-$name.
+ Its destination is $(TARFILE_LOCATION)/$checksum-$name.
=cut
sub DownloadFile ($$$)
{
my $name = shift;
my $URL = shift;
- my $md5sum = shift;
+ my $checksum = shift;
my $filename = File::Spec->catfile($ENV{'TARFILE_LOCATION'}, $name);
@@ -433,8 +483,22 @@ sub DownloadFile ($$$)
open my $out, ">$temporary_filename";
binmode($out);
- # Prepare md5
- my $md5 = Digest::MD5->new();
+ # Prepare checksum
+ my $digest;
+ if (defined $checksum && $checksum->{'type'} eq "SHA1")
+ {
+ # Use SHA1 only when explicitly requested (by the presence of a "SHA1=..." line.)
+ $digest = Digest::SHA->new("1");
+ }
+ elsif ( ! defined $checksum || $checksum->{'type'} eq "MD5")
+ {
+ # Use MD5 when explicitly requested or when no checksum type is given.
+ $digest = Digest::MD5->new();
+ }
+ else
+ {
+ die "checksum type ".$checksum->{'type'}." is not supported";
+ }
# Download the extension.
my $agent = LWP::UserAgent->new();
@@ -452,41 +516,47 @@ sub DownloadFile ($$$)
{
$last_was_redirect = 0;
# Throw away the data we got so far.
- $md5->reset();
+ $checksum->reset();
close $out;
open $out, ">$temporary_filename";
binmode($out);
}
my($response,$agent,$h,$data)=@_;
print $out $data;
- $md5->add($data);
+ $digest->add($data);
});
my $response = $agent->get($URL);
close $out;
- # When download was successfull then check the md5 checksum and rename the .part file
+ # When download was successfull then check the checksum and rename the .part file
# into the actual extension name.
if ($response->is_success())
{
- my $file_md5 = $md5->hexdigest();
- if (defined $md5sum && length($md5sum)==32)
+ my $file_checksum = $digest->hexdigest();
+ if (defined $checksum)
{
- if ($md5sum eq $file_md5)
+ if ($checksum->{'value'} eq $file_checksum)
{
- print "md5 is OK\n";
+ printf("%s checksum is OK\n", $checksum->{'type'});
}
else
{
unlink($temporary_filename);
- print " md5 does not match ($file_md5 instead of $md5sum)\n";
+ printf(" %s checksum does not match (%s instead of %s)\n",
+ $file_checksum,
+ $checksum->{'value'},
+ $checksum->{'type'});
return 0;
}
}
else
{
- printf("md5 not given, md5 of file is %s\n", $file_md5);
- $filename = File::Spec->catfile($ENV{'TARFILE_LOCATION'}, $file_md5 . "-" . $name);
+ # The datafile does not contain a checksum to match against.
+ # Display the one that was calculated for the downloaded file so that
+ # it can be integrated manually into the data file.
+ printf("checksum not given, md5 of file is %s\n", $file_checksum);
+ $filename = File::Spec->catfile($ENV{'TARFILE_LOCATION'}, $file_checksum . "-" . $name);
}
rename($temporary_filename, $filename) || die "can not rename $temporary_filename to $filename";
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.cxx Wed Jun 20 08:12:37 2012
@@ -64,8 +64,9 @@ extern "C" apr_status_t Serf_Credentials
extern "C" apr_status_t Serf_CertificateChainValidation(
void* pSerfSession,
int nFailures,
- const char** pCertificateChainBase64Encoded,
- int nCertificateChainLength)
+ int nErrorCode,
+ const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded,
+ apr_size_t nCertificateChainLength)
{
return static_cast<SerfSession*>(pSerfSession)
->verifySerfCertificateChain(nFailures, pCertificateChainBase64Encoded, nCertificateChainLength);
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfCallbacks.hxx Wed Jun 20 08:12:37 2012
@@ -43,8 +43,9 @@ extern "C" apr_status_t Serf_Credentials
extern "C" apr_status_t Serf_CertificateChainValidation(
void* pSerfSession,
int nFailures,
- const char** pCertificateChainBase64Encoded,
- int nCertificateChainLength);
+ int error_depth,
+ const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded,
+ apr_size_t nCertificateChainLength);
extern "C" apr_status_t Serf_SetupRequest( serf_request_t *request,
void *setup_baton,
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx Wed Jun 20 08:12:37 2012
@@ -78,10 +78,6 @@ serf_bucket_t * SerfPostReqProcImpl::cre
if ( mpPostData != 0 && mnPostDataLen > 0 )
{
body_bkt = SERF_BUCKET_SIMPLE_STRING_LEN( mpPostData, mnPostDataLen, pSerfBucketAlloc );
- if ( useChunkedEncoding() )
- {
- body_bkt = serf_bucket_chunk_create( body_bkt, pSerfBucketAlloc );
- }
}
// create serf request
@@ -90,6 +86,7 @@ serf_bucket_t * SerfPostReqProcImpl::cre
getPathStr(),
body_bkt,
serf_request_get_alloc( inSerfRequest ) );
+ handleChunkedEncoding(req_bkt, mnPostDataLen);
// set request header fields
serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
@@ -97,15 +94,6 @@ serf_bucket_t * SerfPostReqProcImpl::cre
setRequestHeaders( hdrs_bkt );
// request specific header fields
- if ( body_bkt != 0 )
- {
- if ( useChunkedEncoding() )
- {
- serf_bucket_headers_set( hdrs_bkt, "Transfer-Encoding", "chunked");
- }
- serf_bucket_headers_set( hdrs_bkt, "Content-Length",
- rtl::OUStringToOString( rtl::OUString::valueOf( (sal_Int32)mnPostDataLen ), RTL_TEXTENCODING_UTF8 ) );
- }
if ( mpContentType != 0 )
{
serf_bucket_headers_set( hdrs_bkt, "Content-Type", mpContentType );
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx Wed Jun 20 08:12:37 2012
@@ -138,10 +138,6 @@ serf_bucket_t * SerfPropFindReqProcImpl:
rtl::OUString::createFromAscii( PROPFIND_TRAILER );
body_bkt = SERF_BUCKET_SIMPLE_STRING( rtl::OUStringToOString( aBodyText, RTL_TEXTENCODING_UTF8 ),
pSerfBucketAlloc );
- if ( useChunkedEncoding() )
- {
- body_bkt = serf_bucket_chunk_create( body_bkt, pSerfBucketAlloc );
- }
}
// create serf request
@@ -150,23 +146,25 @@ serf_bucket_t * SerfPropFindReqProcImpl:
getPathStr(),
body_bkt,
pSerfBucketAlloc );
+ handleChunkedEncoding(req_bkt, aBodyText.getLength());
// set request header fields
serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
- // general header fields provided by caller
- setRequestHeaders( hdrs_bkt );
-
- // request specific header fields
- serf_bucket_headers_set( hdrs_bkt, "Depth", mDepthStr );
- if ( body_bkt != 0 && aBodyText.getLength() > 0 )
+ if (hdrs_bkt != NULL)
{
- if ( useChunkedEncoding() )
+ // general header fields provided by caller
+ setRequestHeaders( hdrs_bkt );
+
+ // request specific header fields
+ serf_bucket_headers_set( hdrs_bkt, "Depth", mDepthStr );
+ if (hdrs_bkt!=NULL && body_bkt != 0 && aBodyText.getLength() > 0 )
{
- serf_bucket_headers_set( hdrs_bkt, "Transfer-Encoding", "chunked");
+ serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
}
- serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
- serf_bucket_headers_set( hdrs_bkt, "Content-Length",
- rtl::OUStringToOString( rtl::OUString::valueOf( aBodyText.getLength() ), RTL_TEXTENCODING_UTF8 ) );
+ }
+ else
+ {
+ OSL_ASSERT("Headers Bucket missing");
}
return req_bkt;
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx Wed Jun 20 08:12:37 2012
@@ -135,10 +135,6 @@ serf_bucket_t * SerfPropPatchReqProcImpl
body_bkt = SERF_BUCKET_SIMPLE_STRING( rtl::OUStringToOString( aBodyText, RTL_TEXTENCODING_UTF8 ),
pSerfBucketAlloc );
- if ( useChunkedEncoding() )
- {
- body_bkt = serf_bucket_chunk_create( body_bkt, pSerfBucketAlloc );
- }
}
}
@@ -148,22 +144,24 @@ serf_bucket_t * SerfPropPatchReqProcImpl
getPathStr(),
body_bkt,
pSerfBucketAlloc ) ;
+ handleChunkedEncoding(req_bkt, aBodyText.getLength());
// set request header fields
serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
- // general header fields provided by caller
- setRequestHeaders( hdrs_bkt );
-
- // request specific header fields
- if ( body_bkt != 0 && aBodyText.getLength() > 0 )
+ if (hdrs_bkt != NULL)
{
- if ( useChunkedEncoding() )
+ // general header fields provided by caller
+ setRequestHeaders( hdrs_bkt );
+
+ // request specific header fields
+ if ( body_bkt != 0 && aBodyText.getLength() > 0 )
{
- serf_bucket_headers_set( hdrs_bkt, "Transfer-Encoding", "chunked");
+ serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
}
- serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
- serf_bucket_headers_set( hdrs_bkt, "Content-Length",
- rtl::OUStringToOString( rtl::OUString::valueOf( aBodyText.getLength() ), RTL_TEXTENCODING_UTF8 ) );
+ }
+ else
+ {
+ OSL_ASSERT("Headers Bucket missing");
}
return req_bkt;
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx Wed Jun 20 08:12:37 2012
@@ -54,10 +54,6 @@ serf_bucket_t * SerfPutReqProcImpl::crea
if ( mpData != 0 && mnDataLen > 0 )
{
body_bkt = SERF_BUCKET_SIMPLE_STRING_LEN( mpData, mnDataLen, pSerfBucketAlloc );
- if ( useChunkedEncoding() )
- {
- body_bkt = serf_bucket_chunk_create( body_bkt, pSerfBucketAlloc );
- }
}
// create serf request
@@ -66,23 +62,7 @@ serf_bucket_t * SerfPutReqProcImpl::crea
getPathStr(),
body_bkt,
serf_request_get_alloc( inSerfRequest ) );
-
- // set request header fields
- serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
- // general header fields provided by caller
- setRequestHeaders( hdrs_bkt );
-
- // request specific header fields
- if ( body_bkt != 0 )
- {
- if ( useChunkedEncoding() )
- {
- serf_bucket_headers_set( hdrs_bkt, "Transfer-Encoding", "chunked");
- }
- serf_bucket_headers_set( hdrs_bkt, "Content-Length",
- rtl::OUStringToOString( rtl::OUString::valueOf( (sal_Int32)mnDataLen ), RTL_TEXTENCODING_UTF8 ) );
- }
-
+ handleChunkedEncoding(req_bkt, mnDataLen);
return req_bkt;
}
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.cxx Wed Jun 20 08:12:37 2012
@@ -21,6 +21,14 @@
#include <SerfRequestProcessorImpl.hxx>
+namespace
+{
+// Define a magic value that is used by serf to reset chunked
+// encoding. The value definition is not supported by serf, hence the
+// definition here.
+static const apr_int64_t SERF_UNKNOWN_LENGTH (-1);
+}
+
namespace http_dav_ucp
{
@@ -51,6 +59,27 @@ const bool SerfRequestProcessorImpl::use
return mbUseChunkedEncoding;
}
+
+void SerfRequestProcessorImpl::handleChunkedEncoding (
+ serf_bucket_t* pRequestBucket,
+ apr_int64_t nLength) const
+{
+ if (pRequestBucket != NULL)
+ {
+ if (useChunkedEncoding())
+ {
+ // Activate chunked encoding.
+ serf_bucket_request_set_CL(pRequestBucket, SERF_UNKNOWN_LENGTH);
+ }
+ else
+ {
+ // Deactivate chunked encoding by setting the length.
+ serf_bucket_request_set_CL(pRequestBucket, nLength);
+ }
+ }
+}
+
+
void SerfRequestProcessorImpl::setRequestHeaders( serf_bucket_t* inoutSerfHeaderBucket )
{
DAVRequestHeaders::const_iterator aHeaderIter( mrRequestHeaders.begin() );
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfRequestProcessorImpl.hxx Wed Jun 20 08:12:37 2012
@@ -49,6 +49,13 @@ public:
void activateChunkedEncoding();
+ /** Turn chunked encoding on or off, dependeing on the result of
+ useChunkedEncoding().
+ */
+ void handleChunkedEncoding (
+ serf_bucket_t* pRequestBucket,
+ apr_int64_t nLength) const;
+
protected:
void setRequestHeaders( serf_bucket_t* inoutSerfHeaderBucket );
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.cxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.cxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.cxx Wed Jun 20 08:12:37 2012
@@ -269,6 +269,7 @@ apr_status_t SerfSession::setupSerfConne
*/
serf_ssl_server_cert_chain_callback_set(
serf_bucket_ssl_decrypt_context_get(tmpInputBkt),
+ NULL,
Serf_CertificateChainValidation,
this);
serf_ssl_set_hostname( serf_bucket_ssl_decrypt_context_get( tmpInputBkt ),
@@ -367,7 +368,7 @@ namespace {
apr_status_t SerfSession::verifySerfCertificateChain (
int,
- const char** pCertificateChainBase64Encoded,
+ const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded,
int nCertificateChainLength)
{
// Check arguments.
@@ -414,9 +415,13 @@ apr_status_t SerfSession::verifySerfCert
}
// Decode the server certificate.
+ const char* sBase64EncodedServerCertificate (
+ serf_ssl_cert_export(
+ pCertificateChainBase64Encoded[0],
+ getAprPool()));
uno::Reference< security::XCertificate > xServerCertificate(
xSecurityEnv->createCertificateFromAscii(
- rtl::OUString::createFromAscii(pCertificateChainBase64Encoded[0])));
+ rtl::OUString::createFromAscii(sBase64EncodedServerCertificate)));
if ( ! xServerCertificate.is())
return SERF_SSL_CERT_UNKNOWN_FAILURE;
@@ -457,9 +462,13 @@ apr_status_t SerfSession::verifySerfCert
std::vector< uno::Reference< security::XCertificate > > aChain;
for (int nIndex=1; nIndex<nCertificateChainLength; ++nIndex)
{
+ const char* sBase64EncodedCertificate (
+ serf_ssl_cert_export(
+ pCertificateChainBase64Encoded[nIndex],
+ getAprPool()));
uno::Reference< security::XCertificate > xCertificate(
xSecurityEnv->createCertificateFromAscii(
- rtl::OUString::createFromAscii(pCertificateChainBase64Encoded[nIndex])));
+ rtl::OUString::createFromAscii(sBase64EncodedCertificate)));
if ( ! xCertificate.is())
return SERF_SSL_CERT_UNKNOWN_FAILURE;
aChain.push_back(xCertificate);
Modified: incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.hxx?rev=1351981&r1=1351980&r2=1351981&view=diff
==============================================================================
--- incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.hxx (original)
+++ incubator/ooo/trunk/main/ucb/source/ucp/webdav/SerfSession.hxx Wed Jun 20 08:12:37 2012
@@ -99,7 +99,7 @@ public:
apr_status_t verifySerfCertificateChain (
int nFailures,
- const char** pCertificateChainBase64Encoded,
+ const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded,
int nCertificateChainLength);
serf_bucket_t* acceptSerfResponse( serf_request_t * inSerfRequest,