You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Dave Fisher <wa...@apache.org> on 2024/04/27 16:45:46 UTC
Re: (openoffice) 01/12: Port our WebDAV content provider from serf/apr/apr-util, to curl.
Hi Arrigo,
With this change do we eliminate all dependencies on Apache APR?
Best,
Dave
> On Apr 27, 2024, at 9:32 AM, ardovm@apache.org wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> ardovm pushed a commit to branch AOO42X
> in repository https://gitbox.apache.org/repos/asf/openoffice.git
>
> commit 9646dec509b481cb88dbe1130c2f325ed13af748
> Author: Damjan Jovanovic <da...@apache.org>
> AuthorDate: Mon Apr 4 03:06:47 2022 +0200
>
> Port our WebDAV content provider from serf/apr/apr-util, to curl.
>
> Patch by: me
>
> (adapted from commit 51ba086bf122dbb5b50fd813e5b9a81c051aa16b by Arrigo
> Marchiori)
> ---
> ext_libraries/apr-util/apr-util-1.6.1.apu.hw.patch | 13 -
> ext_libraries/apr-util/apr-util-1.6.1.expat.patch | 17 -
> .../apr-util/apr-util-1.6.1.makewin32.patch | 199 --
> ext_libraries/apr-util/aprutil_version.mk | 24 -
> ext_libraries/apr-util/makefile.mk | 139 --
> ext_libraries/apr-util/prj/build.lst | 5 -
> ext_libraries/apr-util/prj/d.lst | 15 -
> ext_libraries/apr/apr-1.6.5-no-devenv.patch | 16 -
> ext_libraries/apr/apr-1.6.5-windows.patch | 11 -
> ext_libraries/apr/apr_version.mk | 24 -
> ext_libraries/apr/makefile.mk | 128 --
> ext_libraries/apr/prj/build.lst | 3 -
> ext_libraries/apr/prj/d.lst | 24 -
> ext_libraries/serf/NULbytes.patch | 313 ----
> ext_libraries/serf/makefile.mk | 134 --
> ext_libraries/serf/prj/build.lst | 3 -
> ext_libraries/serf/prj/d.lst | 12 -
> ext_libraries/serf/serf-1.2.1.ldl.patch | 11 -
> ext_libraries/serf/serf-1.2.1.libs.patch | 11 -
> ext_libraries/serf/serf-1.2.1.logging.patch | 27 -
> ext_libraries/serf/serf_version.mk | 24 -
> ext_libraries/serf/win/Library_serf.mk | 89 -
> ext_libraries/serf/win/Makefile | 30 -
> ext_libraries/serf/win/Module_serf.mk | 27 -
> ext_libraries/serf/win/Package_inc.mk | 27 -
> main/NOTICE | 6 -
> main/RepositoryExternal.mk | 106 --
> main/configure.ac | 82 +-
> main/curl/curl-wnt.patch | 38 +
> main/curl/makefile.mk | 18 +-
> main/curl/prj/build.lst | 2 +-
> main/external_deps.lst | 18 -
> main/scp2/prj/build.lst | 2 +-
> main/scp2/source/ooo/file_library_ooo.scp | 61 -
> main/scp2/source/ooo/makefile.mk | 23 -
> main/scp2/source/ooo/shortcut_ooo.scp | 47 -
> main/set_soenv.in | 9 -
> main/ucb/Library_ucpdav1.mk | 34 +-
> main/ucb/prj/build.lst | 2 +-
> main/ucb/source/ucp/webdav/ContentProperties.cxx | 4 +-
> .../{SerfInputStream.cxx => CurlInputStream.cxx} | 40 +-
> .../{SerfInputStream.hxx => CurlInputStream.hxx} | 15 +-
> .../{SerfLockStore.cxx => CurlLockStore.cxx} | 50 +-
> .../{SerfLockStore.hxx => CurlLockStore.hxx} | 38 +-
> main/ucb/source/ucp/webdav/CurlRequest.cxx | 391 ++++
> main/ucb/source/ucp/webdav/CurlRequest.hxx | 130 ++
> main/ucb/source/ucp/webdav/CurlSession.cxx | 1959 ++++++++++++++++++++
> .../webdav/{SerfSession.hxx => CurlSession.hxx} | 144 +-
> .../ucp/webdav/{SerfTypes.hxx => CurlTypes.hxx} | 15 +-
> .../source/ucp/webdav/{SerfUri.cxx => CurlUri.cxx} | 174 +-
> .../source/ucp/webdav/{SerfUri.hxx => CurlUri.hxx} | 42 +-
> main/ucb/source/ucp/webdav/DAVProperties.cxx | 6 +-
> main/ucb/source/ucp/webdav/DAVProperties.hxx | 8 +-
> main/ucb/source/ucp/webdav/DAVResourceAccess.cxx | 12 +-
> main/ucb/source/ucp/webdav/DAVResourceAccess.hxx | 4 +-
> main/ucb/source/ucp/webdav/DAVSessionFactory.cxx | 12 +-
> main/ucb/source/ucp/webdav/LockRequest.cxx | 61 +
> .../ucp/webdav/{AprEnv.cxx => LockRequest.hxx} | 42 +-
> main/ucb/source/ucp/webdav/PropfindRequest.cxx | 81 +
> ...erfMkColReqProcImpl.hxx => PropfindRequest.hxx} | 43 +-
> main/ucb/source/ucp/webdav/ProppatchRequest.cxx | 126 ++
> .../webdav/{AprEnv.hxx => ProppatchRequest.hxx} | 35 +-
> main/ucb/source/ucp/webdav/SerfCallbacks.cxx | 121 --
> main/ucb/source/ucp/webdav/SerfCallbacks.hxx | 69 -
> main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx | 91 -
> main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx | 59 -
> .../source/ucp/webdav/SerfDeleteReqProcImpl.cxx | 77 -
> .../source/ucp/webdav/SerfDeleteReqProcImpl.hxx | 55 -
> main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx | 187 --
> main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx | 84 -
> main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx | 141 --
> main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx | 67 -
> .../source/ucp/webdav/SerfLockRefreshProcImpl.cxx | 80 -
> .../source/ucp/webdav/SerfLockRefreshProcImpl.hxx | 51 -
> main/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx | 155 --
> main/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx | 74 -
> .../ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx | 72 -
> main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx | 91 -
> main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx | 59 -
> main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx | 136 --
> main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx | 79 -
> .../source/ucp/webdav/SerfPropFindReqProcImpl.cxx | 202 --
> .../source/ucp/webdav/SerfPropFindReqProcImpl.hxx | 77 -
> .../source/ucp/webdav/SerfPropPatchReqProcImpl.cxx | 200 --
> .../source/ucp/webdav/SerfPropPatchReqProcImpl.hxx | 60 -
> main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx | 93 -
> main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx | 61 -
> .../ucb/source/ucp/webdav/SerfRequestProcessor.cxx | 721 -------
> .../ucb/source/ucp/webdav/SerfRequestProcessor.hxx | 208 ---
> .../source/ucp/webdav/SerfRequestProcessorImpl.cxx | 164 --
> .../source/ucp/webdav/SerfRequestProcessorImpl.hxx | 79 -
> .../ucp/webdav/SerfRequestProcessorImplFac.cxx | 286 ---
> .../ucp/webdav/SerfRequestProcessorImplFac.hxx | 142 --
> main/ucb/source/ucp/webdav/SerfSession.cxx | 1708 -----------------
> main/ucb/source/ucp/webdav/SerfUnlockProcImpl.cxx | 92 -
> main/ucb/source/ucp/webdav/SerfUnlockProcImpl.hxx | 69 -
> main/ucb/source/ucp/webdav/webdavcontent.cxx | 26 +-
> main/ucb/source/ucp/webdav/webdavdatasupplier.cxx | 10 +-
> main/ucb/source/ucp/webdav/webdavprovider.cxx | 21 +-
> 99 files changed, 3201 insertions(+), 7972 deletions(-)
>
> diff --git a/ext_libraries/apr-util/apr-util-1.6.1.apu.hw.patch b/ext_libraries/apr-util/apr-util-1.6.1.apu.hw.patch
> deleted file mode 100644
> index bdd636214b..0000000000
> --- a/ext_libraries/apr-util/apr-util-1.6.1.apu.hw.patch
> +++ /dev/null
> @@ -1,13 +0,0 @@
> ---- misc/apr-util-1.6.1/include/apu.hw 2008-11-21 07:18:37.000000000 +0100
> -+++ misc/build/apr-util-1.6.1/include/apu.hw 2012-01-03 13:37:20.042007300 +0100
> -@@ -132,8 +132,8 @@
> - #define APU_HAVE_NSS 0
> - #endif
> -
> --#define APU_HAVE_APR_ICONV 1
> --#define APU_HAVE_ICONV 0
> -+#undef APU_HAVE_APR_ICONV
> -+#undef APU_HAVE_ICONV
> - #define APR_HAS_XLATE (APU_HAVE_APR_ICONV || APU_HAVE_ICONV)
> -
> - #endif /* APU_H */
> diff --git a/ext_libraries/apr-util/apr-util-1.6.1.expat.patch b/ext_libraries/apr-util/apr-util-1.6.1.expat.patch
> deleted file mode 100644
> index 3a84a6a3a6..0000000000
> --- a/ext_libraries/apr-util/apr-util-1.6.1.expat.patch
> +++ /dev/null
> @@ -1,17 +0,0 @@
> ---- misc/apr-util-1.6.1/build/apu-conf.m4 2011-08-08 06:32:27.000000000 -0300
> -+++ misc/build/apr-util-1.6.1/build/apu-conf.m4 2013-06-12 20:09:05.877947541 -0300
> -@@ -87,8 +87,14 @@ dnl be dropped later.
> - dnl
> - AC_DEFUN([APU_SYSTEM_EXPAT], [
> -
> -+ APU_TRY_EXPAT_LINK([OpenOffice expat], apu_cv_expat_openoffice,
> -+ [expat.h], [-L"$SOLARLIBDIR" -lexpat_xmlparse -lexpat_xmltok],
> -+ [APR_ADDTO(APRUTIL_INCLUDES, [-I"$SOLARINCDIR"/external])] )
> -+
> -+ if test $apu_has_expat = 0; then
> - APU_TRY_EXPAT_LINK([Expat 1.95.x], apu_cv_expat_system,
> - [expat.h], [-lexpat])
> -+ fi
> -
> - if test $apu_has_expat = 0; then
> - APU_TRY_EXPAT_LINK([old Debian-packaged expat], apu_cv_expat_debian,
> diff --git a/ext_libraries/apr-util/apr-util-1.6.1.makewin32.patch b/ext_libraries/apr-util/apr-util-1.6.1.makewin32.patch
> deleted file mode 100644
> index f986fde96d..0000000000
> --- a/ext_libraries/apr-util/apr-util-1.6.1.makewin32.patch
> +++ /dev/null
> @@ -1,199 +0,0 @@
> ---- misc/apr-util-1.6.1/Library_apr-util.mk 2012-01-05 14:49:40.529219100 +0100
> -+++ misc/build/apr-util-1.6.1/Library_apr-util.mk 2012-01-05 14:47:18.621102400 +0100
> -@@ -1 +1,89 @@
> --dummy
> -+#/**************************************************************
> -+# *
> -+# * Licensed to the Apache Software Foundation (ASF) under one
> -+# * or more contributor license agreements. See the NOTICE file
> -+# * distributed with this work for additional information
> -+# * regarding copyright ownership. The ASF licenses this file
> -+# * to you under the Apache License, Version 2.0 (the
> -+# * "License"); you may not use this file except in compliance
> -+# * with the License. You may obtain a copy of the License at
> -+# *
> -+# * http://www.apache.org/licenses/LICENSE-2.0
> -+# *
> -+# * Unless required by applicable law or agreed to in writing,
> -+# * software distributed under the License is distributed on an
> -+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -+# * KIND, either express or implied. See the License for the
> -+# * specific language governing permissions and limitations
> -+# * under the License.
> -+# *
> -+# *************************************************************/
> -+
> -+$(eval $(call gb_Library_Library,apr-util))
> -+
> -+$(eval $(call gb_Library_add_package_headers,apr-util,apr-util_inc))
> -+
> -+$(eval $(call gb_Library_set_include,apr-util,\
> -+ $$(INCLUDE) \
> -+ -I./include \
> -+ -I./include/private \
> -+ -I$(OUTDIR)/inc/apr \
> -+))
> -+
> -+$(eval $(call gb_Library_add_defs,apr-util,\
> -+ -DAPU_DECLARE_EXPORT -DWIN32 -DNDEBUG -D_WINDOWS -D_USRDLL -DWIN32_EXPORTS \
> -+))
> -+
> -+$(eval $(call gb_Library_add_linked_libs,apr-util,\
> -+ apr \
> -+ expat_xmltok \
> -+ expat_xmlparse \
> -+ $(gb_STDLIBS) \
> -+))
> -+
> -+$(eval $(call gb_Library_add_cobjects,apr-util,\
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_brigade \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_alloc \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_eos \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_file \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_flush \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_heap \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_mmap \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_pipe \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_pool \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_refcount \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_simple \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/buckets/apr_buckets_socket \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/crypto/apr_crypto \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/crypto/apr_md4 \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/crypto/apr_md5 \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/crypto/apr_sha1 \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/crypto/getuuid \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/crypto/uuid \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/dbd/apr_dbd \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/dbm/apr_dbm \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/dbm/apr_dbm_sdbm \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/dbm/sdbm/sdbm \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/dbm/sdbm/sdbm_hash \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/dbm/sdbm/sdbm_lock \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/dbm/sdbm/sdbm_pair \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/encoding/apr_base64 \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/hooks/apr_hooks \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/ldap/apr_ldap_stub \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/ldap/apr_ldap_url \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/memcache/apr_memcache \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/misc/apr_date \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/misc/apr_queue \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/misc/apr_reslist \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/misc/apr_rmm \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/misc/apr_thread_pool \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/misc/apu_dso \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/misc/apu_version \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/strmatch/apr_strmatch \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/uri/apr_uri \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/xlate/xlate \
> -+ apr-util/$(INPATH)/misc/build/apr-util-1.6.1/xml/apr_xml \
> -+))
> -+
> -+# vim: set noet sw=4 ts=4:
> ---- misc/apr-util-1.6.1/Makefile 2012-01-05 14:49:40.420212900 +0100
> -+++ misc/build/apr-util-1.6.1/Makefile 2012-01-05 14:47:07.827485100 +0100
> -@@ -1 +1,32 @@
> --dummy
> -+#/**************************************************************
> -+# *
> -+# * Licensed to the Apache Software Foundation (ASF) under one
> -+# * or more contributor license agreements. See the NOTICE file
> -+# * distributed with this work for additional information
> -+# * regarding copyright ownership. The ASF licenses this file
> -+# * to you under the Apache License, Version 2.0 (the
> -+# * "License"); you may not use this file except in compliance
> -+# * with the License. You may obtain a copy of the License at
> -+# *
> -+# * http://www.apache.org/licenses/LICENSE-2.0
> -+# *
> -+# * Unless required by applicable law or agreed to in writing,
> -+# * software distributed under the License is distributed on an
> -+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -+# * KIND, either express or implied. See the License for the
> -+# * specific language governing permissions and limitations
> -+# * under the License.
> -+# *
> -+# *************************************************************/
> -+
> -+ifeq ($(strip $(SOLARENV)),)
> -+$(error No environment set!)
> -+endif
> -+
> -+gb_PARTIALBUILD := T
> -+GBUILDDIR := $(SOLARENV)/gbuild
> -+include $(GBUILDDIR)/gbuild.mk
> -+
> -+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
> -+
> -+# vim: set noet sw=4 ts=4:
> ---- misc/apr-util-1.6.1/Module_apr-util.mk 2012-01-05 14:49:40.476216100 +0100
> -+++ misc/build/apr-util-1.6.1/Module_apr-util.mk 2012-01-05 14:47:42.567472100 +0100
> -@@ -1 +1,29 @@
> --dummy
> -+#/**************************************************************
> -+# *
> -+# * Licensed to the Apache Software Foundation (ASF) under one
> -+# * or more contributor license agreements. See the NOTICE file
> -+# * distributed with this work for additional information
> -+# * regarding copyright ownership. The ASF licenses this file
> -+# * to you under the Apache License, Version 2.0 (the
> -+# * "License"); you may not use this file except in compliance
> -+# * with the License. You may obtain a copy of the License at
> -+# *
> -+# * http://www.apache.org/licenses/LICENSE-2.0
> -+# *
> -+# * Unless required by applicable law or agreed to in writing,
> -+# * software distributed under the License is distributed on an
> -+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -+# * KIND, either express or implied. See the License for the
> -+# * specific language governing permissions and limitations
> -+# * under the License.
> -+# *
> -+# *************************************************************/
> -+
> -+$(eval $(call gb_Module_Module,apr-util))
> -+
> -+$(eval $(call gb_Module_add_targets,apr-util,\
> -+ Library_apr-util \
> -+ Package_inc \
> -+))
> -+
> -+# vim: set noet ts=4 sw=4:
> ---- misc/apr-util-1.6.1/Package_inc.mk 2012-01-05 14:49:40.585222300 +0100
> -+++ misc/build/apr-util-1.6.1/Package_inc.mk 2012-01-05 14:47:51.616989700 +0100
> -@@ -1 +1,33 @@
> --dummy
> -+#/**************************************************************
> -+# *
> -+# * Licensed to the Apache Software Foundation (ASF) under one
> -+# * or more contributor license agreements. See the NOTICE file
> -+# * distributed with this work for additional information
> -+# * regarding copyright ownership. The ASF licenses this file
> -+# * to you under the Apache License, Version 2.0 (the
> -+# * "License"); you may not use this file except in compliance
> -+# * with the License. You may obtain a copy of the License at
> -+# *
> -+# * http://www.apache.org/licenses/LICENSE-2.0
> -+# *
> -+# * Unless required by applicable law or agreed to in writing,
> -+# * software distributed under the License is distributed on an
> -+# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -+# * KIND, either express or implied. See the License for the
> -+# * specific language governing permissions and limitations
> -+# * under the License.
> -+# *
> -+# *************************************************************/
> -+
> -+$(eval $(call gb_Package_Package,apr-util_inc,$(EXT_LIBRARIES)/apr-util/$(INPATH)/misc/build/apr-util-1.6.1/include))
> -+$(eval $(call gb_Package_add_files, apr-util_inc, inc/apr-util, \
> -+ apu.h \
> -+ apu_version.h \
> -+ apr_uri.h \
> -+ apr_date.h \
> -+ apr_uuid.h \
> -+ apr_md5.h \
> -+ apr_xlate.h \
> -+ apr_base64.h \
> -+))
> -+
> diff --git a/ext_libraries/apr-util/aprutil_version.mk b/ext_libraries/apr-util/aprutil_version.mk
> deleted file mode 100644
> index 6a4eabb335..0000000000
> --- a/ext_libraries/apr-util/aprutil_version.mk
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -#**************************************************************
> -#
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements. See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership. The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License. You may obtain a copy of the License at
> -#
> -# http://www.apache.org/licenses/LICENSE-2.0
> -#
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied. See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -#
> -#**************************************************************
> -
> -APR_UTIL_MAJOR=1
> -APR_UTIL_MINOR=6
> -APR_UTIL_MICRO=1
> diff --git a/ext_libraries/apr-util/makefile.mk b/ext_libraries/apr-util/makefile.mk
> deleted file mode 100644
> index c2ba7b5324..0000000000
> --- a/ext_libraries/apr-util/makefile.mk
> +++ /dev/null
> @@ -1,139 +0,0 @@
> -#**************************************************************
> -#
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements. See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership. The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License. You may obtain a copy of the License at
> -#
> -# http://www.apache.org/licenses/LICENSE-2.0
> -#
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied. See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -#
> -#**************************************************************
> -
> -PRJ=.
> -
> -PRJNAME=apr-util
> -TARGET=aprutil
> -
> -# --- Settings -----------------------------------------------------
> -
> -.INCLUDE : settings.mk
> -.INCLUDE : aprutil_version.mk
> -
> -# --- Files --------------------------------------------------------
> -
> -.IF "$(SYSTEM_APR_UTIL)"=="YES"
> -
> -all:
> - @echo "Using system apr-util. Does not have to be built."
> -
> -.ELSE
> -
> -# Assemble the full version number from the parts defined in aprutil_version.mk
> -APR_UTIL_VERSION=$(APR_UTIL_MAJOR).$(APR_UTIL_MINOR).$(APR_UTIL_MICRO)
> -
> -
> -TARFILE_NAME=$(PRJNAME)-$(APR_UTIL_VERSION)
> -TARFILE_MD5=bd502b9a8670a8012c4d90c31a84955f
> -
> -.IF "$(OS)"=="WNT"
> -
> -ADDITIONAL_FILES=Makefile Module_apr-util.mk Library_apr-util.mk Package_inc.mk
> -
> -PATCH_FILES= \
> - $(TARFILE_NAME).apu.hw.patch \
> - $(TARFILE_NAME).makewin32.patch
> -
> -CONFIGURE_DIR=
> -CONFIGURE_ACTION=cp include/apu.hw include/apu.h; \
> - cp include/apr_ldap.hw include/apr_ldap.h; \
> - cp include/private/apu_config.hw include/private/apu_config.h; \
> - cp include/private/apu_select_dbm.hw include/private/apu_select_dbm.h
> -CONFIGURE_FLAGS=
> -
> -BUILD_DIR=$(CONFIGURE_DIR)
> -BUILD_ACTION=$(GNUMAKE)
> -#BUILD_FLAGS+= -j$(EXTMAXPROCESS)
> -
> -.ELIF "$(GUI)" == "OS2"
> -
> -@all:
> - @echo "using system apr-util. nothing do do."
> -
> -
> -.ELSE
> -
> -
> -
> -CONFIGURE_DIR=
> -CONFIGURE_ACTION=autoconf && .$/configure
> -CONFIGURE_FLAGS= \
> - --with-apr=$(OUTDIR)/bin/apr-1-config \
> - --prefix=$(OUTDIR) \
> - --includedir=$(OUTDIR)$/inc$/apr-util \
> - --with-iconv="no"
> -
> -
> -# Use our own expat on the Mac. Maybe we should do this on Linux, too? Yes!
> -.IF "$(OS)" == "MACOSX" || ("$(OS)" == "LINUX" && "$(SYSTEM_EXPAT)"!="YES")
> -
> -# Recent versions of clang on macOS break some tests in APR 1.6 (and older)
> -# configure (mostly around testing sizeof) due to errors now being fatal.
> -# Work around this by ignoring all errors
> -.IF "$(OS)"=="MACOSX"
> -XCPPFLAGS=-Wno-error=all
> -.ENDIF
> -
> -expat_CPPFLAGS=-I$(SOLARINCDIR)$/external
> -expat_LDFLAGS+=-L$(SOLARLIBDIR)
> -XCPPFLAGS+=$(expat_CPPFLAGS)
> -CONFIGURE_FLAGS+= SOLARINCDIR=$(SOLARINCDIR) SOLARLIBDIR=$(SOLARLIBDIR) \
> - CPPFLAGS="$(XCPPFLAGS)" LDFLAGS=$(expat_LDFLAGS)
> -
> -# The non-standard names of our expat libraries (yes, plural) make
> -# a special handling in apr-utils configure necessary.
> -PATCH_FILES+= $(TARFILE_NAME).expat.patch
> -
> -.ENDIF
> -
> -
> -BUILD_DIR=$(CONFIGURE_DIR)
> -BUILD_ACTION=$(GNUMAKE)
> -BUILD_FLAGS+= -j$(EXTMAXPROCESS)
> -
> -# Make apu-1-config believe that apr-util has been installed.
> -INSTALL_ACTION=if [ -f apu-1-config.orig ]; then mv -f apu-1-config.orig apu-1-config; fi; \
> - cp apu-1-config apu-1-config.orig; \
> - sed -e "s/^location=source/location=installed/;s/^\(installbuilddir=.*\)\/.*/\\1\/lib\/apr-util\"/" apu-1-config > apu-1-config.installed; \
> - mv -f apu-1-config.installed apu-1-config; \
> - chmod +x apu-1-config
> -
> -OUT2INC+=include$/apr*.h
> -OUT2INC+=include$/apu*.h
> -OUT2INC_SUBDIR=apr-util
> -
> -.IF "$(OS)"=="MACOSX"
> -OUT2LIB+=.libs/libaprutil-1.*dylib
> -.ELSE
> -OUT2LIB=.libs/libaprutil-1.so*
> -.ENDIF
> -OUT2BIN=apu-1-config
> -
> -.ENDIF
> -
> -# --- Targets ------------------------------------------------------
> -
> -.INCLUDE : set_ext.mk
> -.INCLUDE : target.mk
> -.INCLUDE : tg_ext.mk
> -
> -.ENDIF
> diff --git a/ext_libraries/apr-util/prj/build.lst b/ext_libraries/apr-util/prj/build.lst
> deleted file mode 100644
> index d205e1992e..0000000000
> --- a/ext_libraries/apr-util/prj/build.lst
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -# adding dependence on sal due to used $gb_STDLIBS which contain uwinapi for Windows
> -# here a corresponding cleanup is needed as apr-util should not have a dependence on uwinapi
> -apru apr-util : sal APR:apr EXPAT:expat NULL
> -apru apr-util usr1 - all apru_mkout NULL
> -apru apr-util nmake - all apru_apr-util NULL
> diff --git a/ext_libraries/apr-util/prj/d.lst b/ext_libraries/apr-util/prj/d.lst
> deleted file mode 100644
> index 5c67d11cf0..0000000000
> --- a/ext_libraries/apr-util/prj/d.lst
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -mkdir: %_DEST%\inc%_EXT%\apr-util
> -..\%__SRC%\inc\apr-util\apr*.h %_DEST%\inc%_EXT%\apr-util
> -..\%__SRC%\inc\apr-util\apu*.h %_DEST%\inc%_EXT%\apr-util
> -..\aprutil_version.mk %_DEST%\inc%_EXT%
> -
> -# Unixes
> -..\%__SRC%\bin\apu-1-config %_DEST%\bin%_EXT%
> -
> -# Linux
> -..\%__SRC%\lib\libaprutil-1.so.*.* %_DEST%\lib%_EXT%
> -..\%__SRC%\lib\libaprutil-1.so.* %_DEST%\lib%_EXT%
> -linklib: libaprutil-1.so.*
> -
> -# Mac
> -..\%__SRC%\lib\libaprutil-1.*dylib %_DEST%\lib%_EXT%
> diff --git a/ext_libraries/apr/apr-1.6.5-no-devenv.patch b/ext_libraries/apr/apr-1.6.5-no-devenv.patch
> deleted file mode 100644
> index 1f79190c41..0000000000
> --- a/ext_libraries/apr/apr-1.6.5-no-devenv.patch
> +++ /dev/null
> @@ -1,16 +0,0 @@
> ---- misc/build/apr-1.6.5/Makefile.win 2013-10-03 12:58:21.000000000 +0200
> -+++ misc/build/apr-1.6.5/Makefile.win 2016-07-26 12:59:58.183576182 +0200
> -@@ -26,12 +26,7 @@
> - # nmake -f Makefile.win PREFIX=C:\APR buildall checkall install clean
> - #
> -
> --!IF EXIST("apr.sln") && ([devenv /help > NUL 2>&1] == 0) \
> -- && !defined(USEMAK) && !defined(USEDSW)
> --USESLN=1
> --USEMAK=0
> --USEDSW=0
> --!ELSEIF EXIST("apr.mak") && !defined(USEDSW)
> -+!IF EXIST("apr.mak") && !defined(USEDSW)
> - USESLN=0
> - USEMAK=1
> - USEDSW=0
> diff --git a/ext_libraries/apr/apr-1.6.5-windows.patch b/ext_libraries/apr/apr-1.6.5-windows.patch
> deleted file mode 100644
> index 917573a934..0000000000
> --- a/ext_libraries/apr/apr-1.6.5-windows.patch
> +++ /dev/null
> @@ -1,11 +0,0 @@
> ---- misc/build/apr-1.6.5/Makefile.win 2018-03-05 05:48:04.021330400 +0200
> -+++ misc/build/apr-1.6.5/Makefile.win 2018-03-05 05:58:03.647346500 +0200
> -@@ -39,7 +39,7 @@
> - PREFIX=..\apr-dist
> -
> - !IF [$(COMSPEC) /c cl /nologo /? \
> -- | $(SystemRoot)\System32\find.exe "x64" >NUL ] == 0
> -+ | findstr.exe "x64" >NUL ] == 0
> - ARCH=x64 Release
> - !ELSE
> - ARCH=Win32 Release
> diff --git a/ext_libraries/apr/apr_version.mk b/ext_libraries/apr/apr_version.mk
> deleted file mode 100644
> index 3c924440f3..0000000000
> --- a/ext_libraries/apr/apr_version.mk
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -#**************************************************************
> -#
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements. See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership. The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License. You may obtain a copy of the License at
> -#
> -# http://www.apache.org/licenses/LICENSE-2.0
> -#
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied. See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -#
> -#**************************************************************
> -
> -APR_MAJOR=1
> -APR_MINOR=6
> -APR_MICRO=5
> diff --git a/ext_libraries/apr/makefile.mk b/ext_libraries/apr/makefile.mk
> deleted file mode 100644
> index ea007d9c23..0000000000
> --- a/ext_libraries/apr/makefile.mk
> +++ /dev/null
> @@ -1,128 +0,0 @@
> -#**************************************************************
> -#
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements. See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership. The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License. You may obtain a copy of the License at
> -#
> -# http://www.apache.org/licenses/LICENSE-2.0
> -#
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied. See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -#
> -#**************************************************************
> -
> -PRJ=.
> -
> -PRJNAME=apr
> -TARGET=apr
> -
> -# --- Settings -----------------------------------------------------
> -
> -.INCLUDE : settings.mk
> -.INCLUDE : apr_version.mk
> -
> -# --- Files --------------------------------------------------------
> -
> -.IF "$(SYSTEM_APR)"=="YES"
> -
> -all:
> - @echo "Using system apr. Does not have to be built."
> -
> -.ELSE
> -
> -# Assemble the full version number from the parts defined in apr_version.mk
> -APRVERSION=$(APR_MAJOR).$(APR_MINOR).$(APR_MICRO)
> -
> -TARFILE_NAME=$(PRJNAME)-$(APRVERSION)
> -TARFILE_MD5=0759294408daace192c935b7c9e76e04
> -
> -.IF "$(OS)"=="WNT"
> -
> -PATCH_FILES+= $(TARFILE_NAME)-no-devenv.patch
> -PATCH_FILES+= $(TARFILE_NAME)-windows.patch
> -CONFIGURE_ACTION=cp include/apr.hw include/apr.h
> -BUILD_DIR=
> -BUILD_ACTION=INCLUDE="$(INCLUDE);./include" USEMAK=1 nmake -f Makefile.win buildall
> -
> -.ELIF "$(GUI)" == "OS2"
> -
> -@all:
> - @echo "using system apr. nothing do do."
> -
> -.ELSE
> -
> -CONFIGURE_DIR=
> -CONFIGURE_ACTION=.$/configure --prefix=$(OUTDIR) --includedir=$(OUTDIR)$/inc$/apr
> -
> -# Recent versions of clang (clang-12xxx) on macOS break some tests in APR 1.6 (and older)
> -# configure (mostly around testing sizeof) due to errors now being fatal.
> -# Work around this by ignoring all errors but only with the later versions of Xcode
> -.IF "$(OS)"=="MACOSX" && "$(COM)"=="CLANG" && "$(CCNUMVER)" > "001100000003"
> -CONFIGURE_FLAGS=CPPFLAGS="-Wno-error=all"
> -.ELSE
> -CONFIGURE_FLAGS=
> -.ENDIF
> -
> -BUILD_DIR=$(CONFIGURE_DIR)
> -BUILD_ACTION=$(GNUMAKE) --debug=b
> -#BUILD_FLAGS+= -j$(EXTMAXPROCESS)
> -
> -# Make apr-1-config believe that apr has been installed.
> -INSTALL_ACTION=if [ -f apr-1-config.orig ]; then mv -f apr-1-config.orig apr-1-config; fi; \
> - cp apr-1-config apr-1-config.orig; \
> - sed -e "s/^location=source/location=installed/;s/^\(installbuilddir=.*\)\/.*/\\1\/lib\/apr\"/" apr-1-config > apr-1-config.installed; \
> - mv -f apr-1-config.installed apr-1-config; \
> - chmod +x apr-1-config
> -
> -.ENDIF
> -
> -OUT2INC+=include$/apr*.h
> -OUT2INC_SUBDIR=apr
> -
> -.IF "$(OS)"=="WNT"
> -.IF "$(CPUNAME)"=="INTEL"
> -OUT2LIB+=LibR$/*.lib
> -OUT2LIB+=LibR$/*.pdb
> -OUT2LIB+=Release$/libaprapp-1.lib
> -OUT2LIB+=Release$/libaprapp-1.pdb
> -OUT2LIB+=Release$/libapr-1.lib
> -OUT2LIB+=Release$/libapr-1.exp
> -OUT2BIN+=Release$/libapr-1.dll
> -OUT2BIN+=Release$/libapr-1.pdb
> -.ELIF "$(CPUNAME)"=="X86_64"
> -OUT2LIB+=x64/LibR$/*.lib
> -OUT2LIB+=x64/LibR$/*.pdb
> -OUT2LIB+=x64/Release$/libaprapp-1.lib
> -OUT2LIB+=x64/Release$/libaprapp-1.pdb
> -OUT2LIB+=x64/Release$/libapr-1.lib
> -OUT2LIB+=x64/Release$/libapr-1.exp
> -OUT2BIN+=x64/Release$/libapr-1.dll
> -OUT2BIN+=x64/Release$/libapr-1.pdb
> -.ENDIF
> -.ELSE
> -.IF "$(OS)"=="MACOSX"
> -OUT2LIB+=.libs/libapr-1.*dylib
> -.ELSE
> -OUT2LIB+=.libs/libapr-1.so*
> -.ENDIF
> -OUT2BIN=build/apr_rules.mk
> -OUT2BIN+=libtool
> -OUT2BIN+=apr-1-config
> -.ENDIF
> -
> -
> -# --- Targets ------------------------------------------------------
> -
> -.INCLUDE : set_ext.mk
> -.INCLUDE : target.mk
> -.INCLUDE : tg_ext.mk
> -
> -.ENDIF
> diff --git a/ext_libraries/apr/prj/build.lst b/ext_libraries/apr/prj/build.lst
> deleted file mode 100644
> index 9393650666..0000000000
> --- a/ext_libraries/apr/prj/build.lst
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -apr apr : solenv NULL
> -apr apr usr1 - all apr_mkout NULL
> -apr apr nmake - all apr_apr NULL
> diff --git a/ext_libraries/apr/prj/d.lst b/ext_libraries/apr/prj/d.lst
> deleted file mode 100644
> index 926421f9f7..0000000000
> --- a/ext_libraries/apr/prj/d.lst
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -mkdir: %_DEST%\inc%_EXT%\apr
> -mkdir: %_DEST%\lib%_EXT%\apr
> -
> -# Includes
> -..\%__SRC%\inc\apr\apr*.h %_DEST%\inc%_EXT%\apr
> -..\apr_version.mk %_DEST%\inc%_EXT%
> -
> -# Windows
> -..\%__SRC%\bin\libapr-1.dll %_DEST%\bin%_EXT%
> -..\%__SRC%\lib\libapr-1.lib %_DEST%\lib%_EXT%
> -
> -# Unixes
> -..\%__SRC%\bin\apr-1-config %_DEST%\bin%_EXT%
> -..\%__SRC%\bin\libtool %_DEST%\lib%_EXT%\apr
> -..\%__SRC%\bin\apr_rules.mk %_DEST%\lib%_EXT%\apr
> -
> -# Linux
> -..\%__SRC%\lib\libapr-1.so.*.* %_DEST%\lib%_EXT%
> -..\%__SRC%\lib\libapr-1.so.* %_DEST%\lib%_EXT%
> -linklib: libapr-1.so.*.*
> -linklib: libapr-1.so.*
> -
> -# Mac
> -..\%__SRC%\lib\libapr-1.*dylib %_DEST%\lib%_EXT%
> diff --git a/ext_libraries/serf/NULbytes.patch b/ext_libraries/serf/NULbytes.patch
> deleted file mode 100644
> index 12593d92e3..0000000000
> --- a/ext_libraries/serf/NULbytes.patch
> +++ /dev/null
> @@ -1,313 +0,0 @@
> -------------------------------------------------------------------------
> -r1699925 | breser | 2014-08-04 11:04:00 -0700 (Mon, 04 Aug 2014) | 5 lines
> -
> -On the 1.3.x branch:
> -
> -Merge changes from trunk:
> -- r2392: Handle NUL bytes in fields of X.509 certs.
> -
> -------------------------------------------------------------------------
> -Index: misc/build/serf-1.2.1/buckets/ssl_buckets.c
> -===================================================================
> ---- misc/serf-1.2.1/buckets/ssl_buckets.c (revision 1699924)
> -+++ misc/build/serf-1.2.1/buckets/ssl_buckets.c (revision 1699925)
> -@@ -202,6 +202,8 @@
> - };
> -
> - static void disable_compression(serf_ssl_context_t *ssl_ctx);
> -+static char *
> -+ pstrdup_escape_nul_bytes(const char *buf, int len, apr_pool_t *pool);
> -
> - #if SSL_VERBOSE
> - /* Log all ssl alerts that we receive from the server. */
> -@@ -427,6 +429,81 @@
> - #endif
> - };
> -
> -+typedef enum san_copy_t {
> -+ EscapeNulAndCopy = 0,
> -+ ErrorOnNul = 1,
> -+} san_copy_t;
> -+
> -+
> -+static apr_status_t
> -+get_subject_alt_names(apr_array_header_t **san_arr, X509 *ssl_cert,
> -+ san_copy_t copy_action, apr_pool_t *pool)
> -+{
> -+ STACK_OF(GENERAL_NAME) *names;
> -+
> -+ /* assert: copy_action == ErrorOnNul || (san_arr && pool) */
> -+
> -+ /* Get subjectAltNames */
> -+ names = X509_get_ext_d2i(ssl_cert, NID_subject_alt_name, NULL, NULL);
> -+ if (names) {
> -+ int names_count = sk_GENERAL_NAME_num(names);
> -+ int name_idx;
> -+
> -+ if (san_arr)
> -+ *san_arr = apr_array_make(pool, names_count, sizeof(char*));
> -+ for (name_idx = 0; name_idx < names_count; name_idx++) {
> -+ char *p = NULL;
> -+ GENERAL_NAME *nm = sk_GENERAL_NAME_value(names, name_idx);
> -+
> -+ switch (nm->type) {
> -+ case GEN_DNS:
> -+ if (copy_action == ErrorOnNul &&
> -+ strlen(nm->d.ia5->data) != nm->d.ia5->length)
> -+ return SERF_ERROR_SSL_CERT_FAILED;
> -+ if (san_arr && *san_arr)
> -+ p = pstrdup_escape_nul_bytes((const char *)nm->d.ia5->data,
> -+ nm->d.ia5->length,
> -+ pool);
> -+ break;
> -+ default:
> -+ /* Don't know what to do - skip. */
> -+ break;
> -+ }
> -+
> -+ if (p) {
> -+ APR_ARRAY_PUSH(*san_arr, char*) = p;
> -+ }
> -+ }
> -+ sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
> -+ }
> -+
> -+ return APR_SUCCESS;
> -+}
> -+
> -+static apr_status_t validate_cert_hostname(X509 *server_cert, apr_pool_t *pool)
> -+{
> -+ char buf[1024];
> -+ int length;
> -+ apr_status_t ret;
> -+
> -+ ret = get_subject_alt_names(NULL, server_cert, ErrorOnNul, NULL);
> -+ if (ret) {
> -+ return ret;
> -+ } else {
> -+ /* Fail if the subject's CN field contains \0 characters. */
> -+ X509_NAME *subject = X509_get_subject_name(server_cert);
> -+ if (!subject)
> -+ return SERF_ERROR_SSL_CERT_FAILED;
> -+
> -+ length = X509_NAME_get_text_by_NID(subject, NID_commonName, buf, 1024);
> -+ if (length != -1)
> -+ if (strlen(buf) != length)
> -+ return SERF_ERROR_SSL_CERT_FAILED;
> -+ }
> -+
> -+ return APR_SUCCESS;
> -+}
> -+
> - static int
> - validate_server_certificate(int cert_valid, X509_STORE_CTX *store_ctx)
> - {
> -@@ -435,6 +512,7 @@
> - X509 *server_cert;
> - int err, depth;
> - int failures = 0;
> -+ apr_status_t status;
> -
> - ssl = X509_STORE_CTX_get_ex_data(store_ctx,
> - SSL_get_ex_data_X509_STORE_CTX_idx());
> -@@ -475,6 +553,11 @@
> - }
> - }
> -
> -+ /* Validate hostname */
> -+ status = validate_cert_hostname(server_cert, ctx->pool);
> -+ if (status)
> -+ failures |= SERF_SSL_CERT_UNKNOWN_FAILURE;
> -+
> - /* Check certificate expiry dates. */
> - if (X509_cmp_current_time(X509_get_notBefore(server_cert)) >= 0) {
> - failures |= SERF_SSL_CERT_NOTYETVALID;
> -@@ -485,7 +568,6 @@
> -
> - if (ctx->server_cert_callback &&
> - (depth == 0 || failures)) {
> -- apr_status_t status;
> - serf_ssl_certificate_t *cert;
> - apr_pool_t *subpool;
> -
> -@@ -512,7 +594,6 @@
> -
> - if (ctx->server_cert_chain_callback
> - && (depth == 0 || failures)) {
> -- apr_status_t status;
> - STACK_OF(X509) *chain;
> - const serf_ssl_certificate_t **certs;
> - int certs_len;
> -@@ -1461,7 +1542,50 @@
> -
> - /* Functions to read a serf_ssl_certificate structure. */
> -
> --/* Creates a hash_table with keys (E, CN, OU, O, L, ST and C). */
> -+/* Takes a counted length string and escapes any NUL bytes so that
> -+ * it can be used as a C string. NUL bytes are escaped as 3 characters
> -+ * "\00" (that's a literal backslash).
> -+ * The returned string is allocated in POOL.
> -+ */
> -+static char *
> -+pstrdup_escape_nul_bytes(const char *buf, int len, apr_pool_t *pool)
> -+{
> -+ int i, nul_count = 0;
> -+ char *ret;
> -+
> -+ /* First determine if there are any nul bytes in the string. */
> -+ for (i = 0; i < len; i++) {
> -+ if (buf[i] == '\0')
> -+ nul_count++;
> -+ }
> -+
> -+ if (nul_count == 0) {
> -+ /* There aren't so easy case to just copy the string */
> -+ ret = apr_pstrdup(pool, buf);
> -+ } else {
> -+ /* There are so we have to replace nul bytes with escape codes
> -+ * Proper length is the length of the original string, plus
> -+ * 2 times the number of nulls (for two digit hex code for
> -+ * the value) + the trailing null. */
> -+ char *pos;
> -+ ret = pos = apr_palloc(pool, len + 2 * nul_count + 1);
> -+ for (i = 0; i < len; i++) {
> -+ if (buf[i] != '\0') {
> -+ *(pos++) = buf[i];
> -+ } else {
> -+ *(pos++) = '\\';
> -+ *(pos++) = '0';
> -+ *(pos++) = '0';
> -+ }
> -+ }
> -+ *pos = '\0';
> -+ }
> -+
> -+ return ret;
> -+}
> -+
> -+/* Creates a hash_table with keys (E, CN, OU, O, L, ST and C). Any NUL bytes in
> -+ these fields in the certificate will be escaped as \00. */
> - static apr_hash_t *
> - convert_X509_NAME_to_table(X509_NAME *org, apr_pool_t *pool)
> - {
> -@@ -1474,37 +1598,44 @@
> - NID_commonName,
> - buf, 1024);
> - if (ret != -1)
> -- apr_hash_set(tgt, "CN", APR_HASH_KEY_STRING, apr_pstrdup(pool, buf));
> -+ apr_hash_set(tgt, "CN", APR_HASH_KEY_STRING,
> -+ pstrdup_escape_nul_bytes(buf, ret, pool));
> - ret = X509_NAME_get_text_by_NID(org,
> - NID_pkcs9_emailAddress,
> - buf, 1024);
> - if (ret != -1)
> -- apr_hash_set(tgt, "E", APR_HASH_KEY_STRING, apr_pstrdup(pool, buf));
> -+ apr_hash_set(tgt, "E", APR_HASH_KEY_STRING,
> -+ pstrdup_escape_nul_bytes(buf, ret, pool));
> - ret = X509_NAME_get_text_by_NID(org,
> - NID_organizationalUnitName,
> - buf, 1024);
> - if (ret != -1)
> -- apr_hash_set(tgt, "OU", APR_HASH_KEY_STRING, apr_pstrdup(pool, buf));
> -+ apr_hash_set(tgt, "OU", APR_HASH_KEY_STRING,
> -+ pstrdup_escape_nul_bytes(buf, ret, pool));
> - ret = X509_NAME_get_text_by_NID(org,
> - NID_organizationName,
> - buf, 1024);
> - if (ret != -1)
> -- apr_hash_set(tgt, "O", APR_HASH_KEY_STRING, apr_pstrdup(pool, buf));
> -+ apr_hash_set(tgt, "O", APR_HASH_KEY_STRING,
> -+ pstrdup_escape_nul_bytes(buf, ret, pool));
> - ret = X509_NAME_get_text_by_NID(org,
> - NID_localityName,
> - buf, 1024);
> - if (ret != -1)
> -- apr_hash_set(tgt, "L", APR_HASH_KEY_STRING, apr_pstrdup(pool, buf));
> -+ apr_hash_set(tgt, "L", APR_HASH_KEY_STRING,
> -+ pstrdup_escape_nul_bytes(buf, ret, pool));
> - ret = X509_NAME_get_text_by_NID(org,
> - NID_stateOrProvinceName,
> - buf, 1024);
> - if (ret != -1)
> -- apr_hash_set(tgt, "ST", APR_HASH_KEY_STRING, apr_pstrdup(pool, buf));
> -+ apr_hash_set(tgt, "ST", APR_HASH_KEY_STRING,
> -+ pstrdup_escape_nul_bytes(buf, ret, pool));
> - ret = X509_NAME_get_text_by_NID(org,
> - NID_countryName,
> - buf, 1024);
> - if (ret != -1)
> -- apr_hash_set(tgt, "C", APR_HASH_KEY_STRING, apr_pstrdup(pool, buf));
> -+ apr_hash_set(tgt, "C", APR_HASH_KEY_STRING,
> -+ pstrdup_escape_nul_bytes(buf, ret, pool));
> -
> - return tgt;
> - }
> -@@ -1550,7 +1681,7 @@
> - unsigned int md_size, i;
> - unsigned char md[EVP_MAX_MD_SIZE];
> - BIO *bio;
> -- STACK_OF(GENERAL_NAME) *names;
> -+ apr_array_header_t *san_arr;
> -
> - /* sha1 fingerprint */
> - if (X509_digest(cert->ssl_cert, EVP_sha1(), md, &md_size)) {
> -@@ -1595,33 +1726,9 @@
> - BIO_free(bio);
> -
> - /* Get subjectAltNames */
> -- names = X509_get_ext_d2i(cert->ssl_cert, NID_subject_alt_name, NULL, NULL);
> -- if (names) {
> -- int names_count = sk_GENERAL_NAME_num(names);
> --
> -- apr_array_header_t *san_arr = apr_array_make(pool, names_count,
> -- sizeof(char*));
> -+ if (!get_subject_alt_names(&san_arr, cert->ssl_cert, EscapeNulAndCopy, pool))
> - apr_hash_set(tgt, "subjectAltName", APR_HASH_KEY_STRING, san_arr);
> -- for (i = 0; i < names_count; i++) {
> -- char *p = NULL;
> -- GENERAL_NAME *nm = sk_GENERAL_NAME_value(names, i);
> -
> -- switch (nm->type) {
> -- case GEN_DNS:
> -- p = apr_pstrmemdup(pool, (const char *)nm->d.ia5->data,
> -- nm->d.ia5->length);
> -- break;
> -- default:
> -- /* Don't know what to do - skip. */
> -- break;
> -- }
> -- if (p) {
> -- APR_ARRAY_PUSH(san_arr, char*) = p;
> -- }
> -- }
> -- sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
> -- }
> --
> - return tgt;
> - }
> -
> -------------------------------------------------------------------------
> -r1699931 | breser | 2014-08-05 19:24:00 -0700 (Tue, 05 Aug 2014) | 6 lines
> -
> -On the 1.3.x branch:
> -
> -Merge changes from trunk:
> -- r2398: Initialize san_arr when we're expected to fill it.
> -
> -
> -------------------------------------------------------------------------
> -Index: misc/build/serf-1.2.1/buckets/ssl_buckets.c
> -===================================================================
> ---- misc/serf-1.2.1/buckets/ssl_buckets.c (revision 1699930)
> -+++ misc/build/serf-1.2.1/buckets/ssl_buckets.c (revision 1699931)
> -@@ -443,6 +443,10 @@
> -
> - /* assert: copy_action == ErrorOnNul || (san_arr && pool) */
> -
> -+ if (san_arr) {
> -+ *san_arr = NULL;
> -+ }
> -+
> - /* Get subjectAltNames */
> - names = X509_get_ext_d2i(ssl_cert, NID_subject_alt_name, NULL, NULL);
> - if (names) {
> diff --git a/ext_libraries/serf/makefile.mk b/ext_libraries/serf/makefile.mk
> deleted file mode 100644
> index d3f7c553ac..0000000000
> --- a/ext_libraries/serf/makefile.mk
> +++ /dev/null
> @@ -1,134 +0,0 @@
> -#**************************************************************
> -#
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements. See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership. The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License. You may obtain a copy of the License at
> -#
> -# http://www.apache.org/licenses/LICENSE-2.0
> -#
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied. See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -#
> -#**************************************************************
> -
> -PRJ=.
> -
> -PRJNAME=serf
> -TARGET=so_serf
> -
> -# --- Settings -----------------------------------------------------
> -
> -.INCLUDE : settings.mk
> -.INCLUDE : serf_version.mk
> -
> -# --- Files --------------------------------------------------------
> -
> -.IF "$(SYSTEM_SERF)"=="YES"
> -
> -all:
> - @echo "Using system serf. Does not have to be built."
> -
> -.ELSE
> -
> -# Assemble the full version number from the parts defined in serf_version.mk
> -LIBSERFVERSION=$(SERF_MAJOR).$(SERF_MINOR).$(SERF_MICRO)
> -
> -TARFILE_NAME=$(PRJNAME)-$(LIBSERFVERSION)
> -# This is the SHA1 checksum, not MD5 but tg_ext.mk does not now about this and,
> -# thankfully, does not care.
> -TARFILE_MD5=f65fbbd72926c8e7cf0dbd4ada03b0d226f461fd
> -
> -PATCH_FILES=NULbytes.patch
> -
> -.IF "$(OS)"=="WNT"
> -
> -CONFIGURE_DIR=
> -CONFIGURE_ACTION=
> -CONFIGURE_FLAGS=
> -
> -BUILD_DIR=
> -BUILD_ACTION=$(GNUMAKE)
> -BUILD_FLAGS+= -f ../../../../win/Makefile -j$(EXTMAXPROCESS)
> -
> -.ELIF "$(GUI)" == "OS2"
> -
> -@all:
> - @echo "using system serf. nothing do do."
> -
> -.ELSE
> -
> -.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).libs.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
> -.ENDIF
> -
> -# Export ENABLE_SERF_LOGGING=YES to enable serf logging
> -.IF "$(ENABLE_SERF_LOGGING)" == "YES"
> -PATCH_FILES+=$(TARFILE_NAME).logging.patch
> -CDEFS+=-DENABLE_SERF_VERBOSE -DSERF_VERBOSE
> -.ENDIF
> -
> -CONFIGURE_DIR=
> -CONFIGURE_ACTION=autoconf && .$/configure
> -
> -.IF "$(OS)"=="LINUX"
> -.IF "$(SYSTEM_OPENSSL)"=="YES"
> -CDEFS+=$(OPENSSL_CFLAGS)
> -.ELSE
> -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
> -
> -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.dylib
> -SERF_FIXED_LIB=.libs/libserf-$(LIBSERFVERSION).0.dylib
> -INSTALL_ACTION=if [ -f "$(SERF_ORIGINAL_LIB)" -a ! -f "$(SERF_FIXED_LIB)" ]; then cp $(SERF_ORIGINAL_LIB) $(SERF_FIXED_LIB); fi
> -.ENDIF
> -
> -OUT2INC+=serf*.h
> -OUT2INC_SUBDIR=serf
> -
> -.IF "$(OS)"=="MACOSX"
> -OUT2LIB+=$(SERF_FIXED_LIB)
> -OUT2LIB+=.libs/libserf-1.*dylib
> -.ELSE
> -OUT2LIB=.libs/libserf-1.so*
> -.ENDIF
> -
> -.ENDIF
> -
> -# --- Targets ------------------------------------------------------
> -
> -.INCLUDE : set_ext.mk
> -.INCLUDE : target.mk
> -.INCLUDE : tg_ext.mk
> -
> -.ENDIF
> diff --git a/ext_libraries/serf/prj/build.lst b/ext_libraries/serf/prj/build.lst
> deleted file mode 100644
> index ccde897f4a..0000000000
> --- a/ext_libraries/serf/prj/build.lst
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -serf serf : APR_UTIL:apr-util OPENSSL:openssl NULL
> -serf serf usr1 - all serf_mkout NULL
> -serf serf nmake - all serf_serf NULL
> diff --git a/ext_libraries/serf/prj/d.lst b/ext_libraries/serf/prj/d.lst
> deleted file mode 100644
> index 29c8eb6c60..0000000000
> --- a/ext_libraries/serf/prj/d.lst
> +++ /dev/null
> @@ -1,12 +0,0 @@
> -mkdir: %_DEST%\inc%_EXT%\serf
> -..\%__SRC%\inc\serf\serf*.h %_DEST%\inc%_EXT%\serf
> -..\serf_version.mk %_DEST%\inc%_EXT%
> -
> -# Mac
> -..\%__SRC%\lib\libserf-1.*dylib %_DEST%\lib%_EXT%
> -
> -# Linux, BSD, et al
> -..\%__SRC%\lib\libserf-1.so.*.* %_DEST%\lib%_EXT%
> -..\%__SRC%\lib\libserf-1.so.* %_DEST%\lib%_EXT%
> -linklib: libserf-1.so.*.*
> -linklib: libserf-1.so.*
> diff --git a/ext_libraries/serf/serf-1.2.1.ldl.patch b/ext_libraries/serf/serf-1.2.1.ldl.patch
> deleted file mode 100644
> index 9b2758d04c..0000000000
> --- a/ext_libraries/serf/serf-1.2.1.ldl.patch
> +++ /dev/null
> @@ -1,11 +0,0 @@
> ---- misc/serf-1.2.1/Makefile.in 2013-06-03 15:21:14.000000000 -0300
> -+++ misc/build/serf-1.2.1/Makefile.in 2013-06-07 12:31:04.416862903 -0300
> -@@ -56,7 +56,7 @@ MKDIR = @mkdir_p@
> - INSTALL = @INSTALL@
> -
> - LDFLAGS = @EXTRA_LDFLAGS@ @LDFLAGS@
> --LIBS = @EXTRA_LIBS@ @SERF_LIBS@ -lz -lssl -lcrypto
> -+LIBS = @EXTRA_LIBS@ @SERF_LIBS@ -lz -lssl -lcrypto -ldl
> -
> - all: $(TARGET_LIB) $(PROGRAMS)
> -
> diff --git a/ext_libraries/serf/serf-1.2.1.libs.patch b/ext_libraries/serf/serf-1.2.1.libs.patch
> deleted file mode 100644
> index 8224203530..0000000000
> --- a/ext_libraries/serf/serf-1.2.1.libs.patch
> +++ /dev/null
> @@ -1,11 +0,0 @@
> ---- misc/serf-1.2.1/configure.in 2013-06-03 14:52:41.000000000 -0300
> -+++ misc/build/serf-1.2.1/configure.in 2013-06-07 12:27:36.914098933 -0300
> -@@ -257,7 +257,7 @@ AC_SEARCH_LIBS(fabs, m)
> -
> - libs=""
> - if test -n "$apu_config"; then
> -- APR_ADDTO(libs, [`$apu_config --link-libtool --libs`])
> -+ APR_ADDTO(libs, [`$apu_config --link-libtool`])
> - fi
> - APR_ADDTO(libs, [`$apr_config --link-libtool --libs` $LIBS])
> -
> diff --git a/ext_libraries/serf/serf-1.2.1.logging.patch b/ext_libraries/serf/serf-1.2.1.logging.patch
> deleted file mode 100644
> index a0714434d1..0000000000
> --- a/ext_libraries/serf/serf-1.2.1.logging.patch
> +++ /dev/null
> @@ -1,27 +0,0 @@
> ---- misc/serf-1.2.1/serf_private.h 2013-06-03 14:22:51.000000000 -0300
> -+++ misc/build/serf-1.2.1/serf_private.h 2013-06-07 12:33:34.432688365 -0300
> -@@ -32,12 +32,18 @@
> -
> - /* Internal logging facilities, set flag to 1 to enable console logging for
> - the selected component. */
> --#define SSL_VERBOSE 0
> --#define SSL_MSG_VERBOSE 0 /* logs decrypted requests and responses. */
> --#define SOCK_VERBOSE 0
> --#define SOCK_MSG_VERBOSE 0 /* logs bytes received from or written to a socket. */
> --#define CONN_VERBOSE 0
> --#define AUTH_VERBOSE 0
> -+#ifdef ENABLE_SERF_VERBOSE
> -+#define SERF_VERBOSE_FLAG 1
> -+#else
> -+#define SERF_VERBOSE_FLAG 0
> -+#endif
> -+
> -+#define SSL_VERBOSE SERF_VERBOSE_FLAG
> -+#define SSL_MSG_VERBOSE SERF_VERBOSE_FLAG /* logs decrypted requests and responses. */
> -+#define SOCK_VERBOSE SERF_VERBOSE_FLAG
> -+#define SOCK_MSG_VERBOSE SERF_VERBOSE_FLAG /* logs bytes received from or written to a socket. */
> -+#define CONN_VERBOSE SERF_VERBOSE_FLAG
> -+#define AUTH_VERBOSE SERF_VERBOSE_FLAG
> -
> -
> - typedef struct serf__authn_scheme_t serf__authn_scheme_t;
> diff --git a/ext_libraries/serf/serf_version.mk b/ext_libraries/serf/serf_version.mk
> deleted file mode 100644
> index 4cf137984f..0000000000
> --- a/ext_libraries/serf/serf_version.mk
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -#**************************************************************
> -#
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements. See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership. The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License. You may obtain a copy of the License at
> -#
> -# http://www.apache.org/licenses/LICENSE-2.0
> -#
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied. See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -#
> -#**************************************************************
> -
> -SERF_MAJOR=1
> -SERF_MINOR=2
> -SERF_MICRO=1
> diff --git a/ext_libraries/serf/win/Library_serf.mk b/ext_libraries/serf/win/Library_serf.mk
> deleted file mode 100755
> index 64e0861e37..0000000000
> --- a/ext_libraries/serf/win/Library_serf.mk
> +++ /dev/null
> @@ -1,89 +0,0 @@
> -#/**************************************************************
> -# *
> -# * Licensed to the Apache Software Foundation (ASF) under one
> -# * or more contributor license agreements. See the NOTICE file
> -# * distributed with this work for additional information
> -# * regarding copyright ownership. The ASF licenses this file
> -# * to you under the Apache License, Version 2.0 (the
> -# * "License"); you may not use this file except in compliance
> -# * with the License. You may obtain a copy of the License at
> -# *
> -# * http://www.apache.org/licenses/LICENSE-2.0
> -# *
> -# * Unless required by applicable law or agreed to in writing,
> -# * software distributed under the License is distributed on an
> -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# * KIND, either express or implied. See the License for the
> -# * specific language governing permissions and limitations
> -# * under the License.
> -# *
> -# *************************************************************/
> -
> -$(eval $(call gb_Library_Library,serf))
> -
> -$(eval $(call gb_Library_add_package_headers,serf,serf_inc))
> -
> -$(eval $(call gb_Library_set_include,serf,\
> - $$(INCLUDE) \
> - -I. \
> - -I$(OUTDIR)/inc/apr \
> - -I$(OUTDIR)/inc/apr-util \
> - -I$(OUTDIR)/inc/external/zlib \
> -))
> -
> -$(eval $(call gb_Library_add_defs,serf,\
> - -DWIN32 -DNDEBUG -D_WINDOWS -D_USRDLL -DWIN32_EXPORTS \
> -))
> -
> -ORIGINAL_DEF_FILE=build/serf.def
> -FIXED_DEF_FILE=build/fixed-serf.def
> -
> -$(call gb_LinkTarget_get_target,$(call gb_Library__get_linktargetname,serf)) : $(FIXED_DEF_FILE)
> -$(FIXED_DEF_FILE) : $(ORIGINAL_DEF_FILE)
> - cp $< $@
> - echo serf_bucket_request_set_CL >> $@
> -
> -$(eval $(call gb_Library_add_ldflags,serf,\
> - -DEF:$(FIXED_DEF_FILE) \
> -))
> -
> -$(eval $(call gb_Library_add_linked_libs,serf,\
> - apr \
> - apr-util \
> - libeay32 \
> - ssleay32 \
> - zlib \
> - $(gb_STDLIBS) \
> -))
> -
> -$(eval $(call gb_Library_add_cobjects,serf,\
> - serf/$(INPATH)/misc/build/serf-1.2.1/auth/auth \
> - serf/$(INPATH)/misc/build/serf-1.2.1/auth/auth_basic \
> - serf/$(INPATH)/misc/build/serf-1.2.1/auth/auth_digest \
> - serf/$(INPATH)/misc/build/serf-1.2.1/auth/auth_kerb \
> - serf/$(INPATH)/misc/build/serf-1.2.1/auth/auth_kerb_gss \
> - serf/$(INPATH)/misc/build/serf-1.2.1/auth/auth_kerb_sspi \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/aggregate_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/allocator \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/barrier_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/bwtp_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/chunk_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/dechunk_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/deflate_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/file_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/headers_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/iovec_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/limit_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/mmap_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/request_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/response_body_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/response_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/simple_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/socket_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/buckets/ssl_buckets \
> - serf/$(INPATH)/misc/build/serf-1.2.1/context \
> - serf/$(INPATH)/misc/build/serf-1.2.1/incoming \
> - serf/$(INPATH)/misc/build/serf-1.2.1/outgoing \
> - serf/$(INPATH)/misc/build/serf-1.2.1/ssltunnel \
> -))
> diff --git a/ext_libraries/serf/win/Makefile b/ext_libraries/serf/win/Makefile
> deleted file mode 100755
> index 8dfd47b297..0000000000
> --- a/ext_libraries/serf/win/Makefile
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -#/**************************************************************
> -# *
> -# * Licensed to the Apache Software Foundation (ASF) under one
> -# * or more contributor license agreements. See the NOTICE file
> -# * distributed with this work for additional information
> -# * regarding copyright ownership. The ASF licenses this file
> -# * to you under the Apache License, Version 2.0 (the
> -# * "License"); you may not use this file except in compliance
> -# * with the License. You may obtain a copy of the License at
> -# *
> -# * http://www.apache.org/licenses/LICENSE-2.0
> -# *
> -# * Unless required by applicable law or agreed to in writing,
> -# * software distributed under the License is distributed on an
> -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# * KIND, either express or implied. See the License for the
> -# * specific language governing permissions and limitations
> -# * under the License.
> -# *
> -# *************************************************************/
> -
> -ifeq ($(strip $(SOLARENV)),)
> -$(error No environment set!)
> -endif
> -
> -gb_PARTIALBUILD := T
> -GBUILDDIR := $(SOLARENV)/gbuild
> -include $(GBUILDDIR)/gbuild.mk
> -
> -$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))Module*.mk)))
> diff --git a/ext_libraries/serf/win/Module_serf.mk b/ext_libraries/serf/win/Module_serf.mk
> deleted file mode 100755
> index 2258d05e3f..0000000000
> --- a/ext_libraries/serf/win/Module_serf.mk
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -#/**************************************************************
> -# *
> -# * Licensed to the Apache Software Foundation (ASF) under one
> -# * or more contributor license agreements. See the NOTICE file
> -# * distributed with this work for additional information
> -# * regarding copyright ownership. The ASF licenses this file
> -# * to you under the Apache License, Version 2.0 (the
> -# * "License"); you may not use this file except in compliance
> -# * with the License. You may obtain a copy of the License at
> -# *
> -# * http://www.apache.org/licenses/LICENSE-2.0
> -# *
> -# * Unless required by applicable law or agreed to in writing,
> -# * software distributed under the License is distributed on an
> -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# * KIND, either express or implied. See the License for the
> -# * specific language governing permissions and limitations
> -# * under the License.
> -# *
> -# *************************************************************/
> -
> -$(eval $(call gb_Module_Module,serf))
> -
> -$(eval $(call gb_Module_add_targets,serf,\
> - Library_serf \
> - Package_inc \
> -))
> diff --git a/ext_libraries/serf/win/Package_inc.mk b/ext_libraries/serf/win/Package_inc.mk
> deleted file mode 100755
> index 7d47447e57..0000000000
> --- a/ext_libraries/serf/win/Package_inc.mk
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -#/**************************************************************
> -# *
> -# * Licensed to the Apache Software Foundation (ASF) under one
> -# * or more contributor license agreements. See the NOTICE file
> -# * distributed with this work for additional information
> -# * regarding copyright ownership. The ASF licenses this file
> -# * to you under the Apache License, Version 2.0 (the
> -# * "License"); you may not use this file except in compliance
> -# * with the License. You may obtain a copy of the License at
> -# *
> -# * http://www.apache.org/licenses/LICENSE-2.0
> -# *
> -# * Unless required by applicable law or agreed to in writing,
> -# * software distributed under the License is distributed on an
> -# * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# * KIND, either express or implied. See the License for the
> -# * specific language governing permissions and limitations
> -# * under the License.
> -# *
> -# *************************************************************/
> -
> -$(eval $(call gb_Package_Package,serf_inc,$(EXT_LIBRARIES)/serf/$(INPATH)/misc/build/serf-1.2.1))
> -$(eval $(call gb_Package_add_files, serf_inc, inc/serf, \
> - serf.h \
> - serf_bucket_types.h \
> - serf_bucket_util.h \
> - ))
> diff --git a/main/NOTICE b/main/NOTICE
> index 0b8baa42fa..43d0de4cc7 100644
> --- a/main/NOTICE
> +++ b/main/NOTICE
> @@ -172,17 +172,11 @@ ____
>
> As part of the base system this product also includes code from the following
> projects which are licensed under the Apache license:
> -- serf
> - redland
> - StAX
>
> The notices from these projects are following:
>
> -serf
> -This product includes software developed by
> -The Apache Software Foundation (https://www.apache.org/).
> -
> -
> redland
> This product includes Redland software (http://librdf.org/)
> developed at the Institute for Learning and Research Technology,
> diff --git a/main/RepositoryExternal.mk b/main/RepositoryExternal.mk
> index 44c91900e8..afc4420ba1 100644
> --- a/main/RepositoryExternal.mk
> +++ b/main/RepositoryExternal.mk
> @@ -396,112 +396,6 @@ endef
> endif # SYSTEM_OPENSSL
>
>
> -ifeq ($(SYSTEM_APR),YES)
> -
> -define gb_LinkTarget__use_apr
> -$(call gb_LinkTarget_add_defs,$(1),\
> - -DSYSTEM_APR \
> -)
> -$(call gb_LinkTarget_set_include,$(1),\
> - $$(INCLUDE) \
> - $(APR_CFLAGS) \
> -)
> -$(call gb_LinkTarget_add_libs,$(1),$(APR_LIBS))
> -endef
> -
> -else # !SYSTEM_APR
> -
> -ifeq ($(OS),WNT)
> -$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,libapr-1))
> -else
> -$(eval $(call gb_Helper_register_libraries,PLAINLIBS_NONE,apr-1))
> -endif
> -
> -define gb_LinkTarget__use_apr
> -$(call gb_LinkTarget_set_include,$(1),\
> - $$(INCLUDE) \
> - -I$(OUTDIR)/inc/apr \
> -)
> -ifeq ($(OS),WNT)
> -$(call gb_LinkTarget_add_linked_libs,$(1),libapr-1)
> -else
> -$(call gb_LinkTarget_add_linked_libs,$(1),apr-1)
> -endif
> -endef
> -
> -endif # SYSTEM_APR
> -
> -
> -ifeq ($(SYSTEM_APR_UTIL),YES)
> -
> -define gb_LinkTarget__use_apr_util
> -$(call gb_LinkTarget_add_defs,$(1),\
> - -DSYSTEM_APR_UTIL \
> -)
> -$(call gb_LinkTarget_set_include,$(1),\
> - $$(INCLUDE) \
> - $(APR_UTIL_CFLAGS) \
> -)
> -$(call gb_LinkTarget_add_libs,$(1),$(APR_UTIL_LIBS))
> -endef
> -
> -else # !SYSTEM_APR_UTIL
> -
> -# on Windows apr-util is registered by ext_libraries/Repository.mk
> -ifneq ($(OS),WNT)
> -$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,aprutil-1))
> -endif
> -
> -define gb_LinkTarget__use_apr_util
> -$(call gb_LinkTarget_set_include,$(1),\
> - $$(INCLUDE) \
> - -I$(OUTDIR)/inc/apr-util \
> -)
> -ifeq ($(OS),WNT)
> -$(call gb_LinkTarget_add_linked_libs,$(1),apr-util)
> -else
> -$(call gb_LinkTarget_add_linked_libs,$(1),aprutil-1)
> -endif
> -endef
> -
> -endif # SYSTEM_APR_UTIL
> -
> -
> -ifeq ($(SYSTEM_SERF),YES)
> -
> -define gb_LinkTarget__use_serf
> -$(call gb_LinkTarget_add_defs,$(1),\
> - -DSYSTEM_SERF \
> -)
> -$(call gb_LinkTarget_set_include,$(1),\
> - $$(INCLUDE) \
> - $(SERF_CFLAGS) \
> -)
> -$(call gb_LinkTarget_add_libs,$(1),$(SERF_LIBS))
> -endef
> -
> -else # !SYSTEM_SERF
> -
> -# on Windows serf is registered by ext_libraries/Repository.mk
> -ifneq ($(OS),WNT)
> -$(eval $(call gb_Helper_register_libraries,PLAINLIBS_OOO,serf-1))
> -endif
> -
> -define gb_LinkTarget__use_serf
> -$(call gb_LinkTarget_set_include,$(1),\
> - $$(INCLUDE) \
> - -I$(OUTDIR)/inc/serf \
> -)
> -ifeq ($(OS),WNT)
> -$(call gb_LinkTarget_add_linked_libs,$(1),serf)
> -else
> -$(call gb_LinkTarget_add_linked_libs,$(1),serf-1)
> -endif
> -endef
> -
> -endif # SYSTEM_SERF
> -
> -
> ifeq ($(SYSTEM_CURL),YES)
>
> define gb_LinkTarget__use_curl
> diff --git a/main/configure.ac b/main/configure.ac
> index e0ba7564f4..62cd7932f4 100644
> --- a/main/configure.ac
> +++ b/main/configure.ac
> @@ -772,15 +772,6 @@ AC_ARG_WITH(local-solver,
> AC_ARG_ENABLE(javascript,
> [ --disable-javascript Disables support for JavaScript macros.
> ],,)
> -AC_ARG_WITH(system-apr,
> -[ --with-system-apr Use apr library already installed on the system
> -],,)
> -AC_ARG_WITH(system-apr-util,
> -[ --with-system-apr-util Use apr-util library already installed on the system
> -],,)
> -AC_ARG_WITH(system-serf,
> -[ --with-system-serf Use serf library already installed on the system
> -],,)
> AC_ARG_WITH(system-coinmp,
> [ --with-system-coinmp Use CoinMP library already installed on the system
> ],,)
> @@ -4437,70 +4428,6 @@ fi
> AC_SUBST(ENABLE_JAVASCRIPT)
>
>
> -dnl ===================================================================
> -dnl Check for system apr
> -dnl ===================================================================
> -SYSTEM_APR=NO
> -APR_CFLAGS=
> -APR_LIBS=
> -AC_MSG_CHECKING([which libapr to use])
> -if test "x$with_system_apr" = "xyes" -o -n "$with_system_libs"; then
> - AC_MSG_RESULT([system])
> - PKG_CHECK_MODULES([APR], [apr-1 >= 1.0])
> - SYSTEM_APR=YES
> -else
> - AC_MSG_RESULT([internal])
> - SYSTEM_APR=NO
> - BUILD_TYPE="$BUILD_TYPE APR"
> -fi
> -AC_SUBST(SYSTEM_APR)
> -AC_SUBST(APR_CFLAGS)
> -AC_SUBST(APR_LIBS)
> -
> -
> -dnl ===================================================================
> -dnl Check for system apr-util
> -dnl ===================================================================
> -SYSTEM_APR_UTIL=NO
> -APR_UTIL_CFLAGS=
> -APR_UTIL_LIBS=
> -AC_MSG_CHECKING([which libapr-util to use])
> -if test "x$with_system_apr_util" = "xyes" -o -n "$with_system_libs"; then
> - AC_MSG_RESULT([system])
> - PKG_CHECK_MODULES([APR_UTIL], [apr-util-1 >= 1.0])
> - SYSTEM_APR_UTIL=YES
> -else
> - AC_MSG_RESULT([internal])
> - SYSTEM_APR_UTIL=NO
> - BUILD_TYPE="$BUILD_TYPE APR_UTIL"
> -fi
> -AC_SUBST(SYSTEM_APR_UTIL)
> -AC_SUBST(APR_UTIL_CFLAGS)
> -AC_SUBST(APR_UTIL_LIBS)
> -
> -
> -dnl ===================================================================
> -dnl Check for system serf
> -dnl ===================================================================
> -SYSTEM_SERF=NO
> -SERF_CFLAGS=
> -SERF_LIBS=
> -AC_MSG_CHECKING([which libserf to use])
> -if test -n "$with_system_serf" -o -n "$with_system_libs" && \
> - test "$with_system_serf" != "no"; then
> - AC_MSG_RESULT([system])
> - PKG_CHECK_MODULES([SERF], [serf-1 >= 1.1])
> - SYSTEM_SERF=YES
> -else
> - AC_MSG_RESULT([internal])
> - SYSTEM_SERF=NO
> - BUILD_TYPE="$BUILD_TYPE SERF"
> -fi
> -AC_SUBST(SYSTEM_SERF)
> -AC_SUBST(SERF_CFLAGS)
> -AC_SUBST(SERF_LIBS)
> -
> -
> dnl ===================================================================
> dnl Check for CoinMP
> dnl ===================================================================
> @@ -4564,6 +4491,15 @@ if test -n "$with_system_curl" -o -n "$with_system_libs" && \
> else
> AC_MSG_RESULT([yes])
> fi
> +
> + # Does curl use OpenSSL as its SSL implementation? Needed for ucb/source/ucp/webdav.
> + AC_MSG_CHECKING([whether curl uses OpenSSL as its SSL backend])
> + if $CURLCONFIG --ssl-backends | $GREP -q 'OpenSSL'; then
> + AC_MSG_RESULT([yes])
> + else
> + AC_MSG_ERROR([no, cannot use system curl whose SSL backend isn't OpenSSL])
> + fi
> +
> CURL_LIBS=`$CURLCONFIG --libs`
> CURL_CFLAGS=`$CURLCONFIG --cflags`
> else
> diff --git a/main/curl/curl-wnt.patch b/main/curl/curl-wnt.patch
> new file mode 100644
> index 0000000000..b38ad3c4c0
> --- /dev/null
> +++ b/main/curl/curl-wnt.patch
> @@ -0,0 +1,38 @@
> +--- misc/build/curl-7.72.0/winbuild/MakefileBuild.vc 2020-08-17 00:28:40.000000000 +0200
> ++++ misc/build/curl-7.72.0/winbuild/MakefileBuild.vc 2022-04-23 19:57:39.594763000 +0200
> +@@ -115,7 +115,7 @@
> + !IFNDEF WITH_DEVEL
> + WITH_DEVEL = ../../deps
> + !ENDIF
> +-DEVEL_INCLUDE= $(WITH_DEVEL)/include
> ++DEVEL_INCLUDE= $(WITH_DEVEL)/inc/external
> + DEVEL_LIB = $(WITH_DEVEL)/lib
> +
> + !IF EXISTS("$(DEVEL_INCLUDE)")
> +@@ -233,7 +233,7 @@
> + ZLIB_LIB_DIR = $(ZLIB_PATH)\lib
> + ZLIB_LFLAGS = $(ZLIB_LFLAGS) "/LIBPATH:$(ZLIB_LIB_DIR)"
> + !ELSE
> +-ZLIB_INC_DIR = $(DEVEL_INCLUDE)
> ++ZLIB_INC_DIR = $(DEVEL_INCLUDE)\zlib
> + ZLIB_LIB_DIR = $(DEVEL_LIB)
> + !ENDIF
> +
> +@@ -568,6 +568,7 @@
> + @if not exist "$(LIB_DIROBJ)\vtls" mkdir $(LIB_DIROBJ)\vtls
> + @if not exist "$(LIB_DIROBJ)\vssh" mkdir $(LIB_DIROBJ)\vssh
> + @if not exist "$(LIB_DIROBJ)\vquic" mkdir $(LIB_DIROBJ)\vquic
> ++ @if not exist "$(LIB_DIROBJ)\vssh" mkdir $(LIB_DIROBJ)\vssh
> +
> + $(CURL_DIROBJ):
> + @if not exist "$(CURL_DIROBJ)" mkdir $(CURL_DIROBJ)
> +@@ -590,6 +591,9 @@
> + $(CURL_CC) $(CFLAGS) /Fo"$@" $<
> +
> + {$(LIBCURL_SRC_DIR)\vquic\}.c{$(LIB_DIROBJ)\vquic\}.obj:
> ++ $(CURL_CC) $(CFLAGS) /Fo"$@" $<
> ++
> ++{$(LIBCURL_SRC_DIR)\vssh\}.c{$(LIB_DIROBJ)\vssh\}.obj:
> + $(CURL_CC) $(CFLAGS) /Fo"$@" $<
> +
> + $(LIB_DIROBJ)\libcurl.res: $(LIBCURL_SRC_DIR)\libcurl.rc
> diff --git a/main/curl/makefile.mk b/main/curl/makefile.mk
> index 533495b3a5..dafa4a6b30 100644
> --- a/main/curl/makefile.mk
> +++ b/main/curl/makefile.mk
> @@ -39,7 +39,7 @@ all:
>
> TARFILE_NAME=curl-7.72.0
> TARFILE_MD5=7422feb126df677d2d33294a1fd079ea
> -PATCH_FILES=buildssh.patch
> +PATCH_FILES=curl-wnt.patch
>
> #ADDITIONAL_FILES= lib$/config-os2.h lib$/Makefile.os2
>
> @@ -58,7 +58,7 @@ curl_LDFLAGS+:=$(ARCH_FLAGS)
> CONFIGURE_DIR=.$/
> #relative to CONFIGURE_DIR
> CONFIGURE_ACTION=.$/configure
> -CONFIGURE_FLAGS= --without-ssl --without-libidn --enable-ftp --enable-ipv6 --enable-http --disable-gopher --disable-file --disable-ldap --disable-telnet --disable-dict --disable-static CPPFLAGS="$(curl_CFLAGS)" LDFLAGS="$(curl_LDFLAGS)"
> +CONFIGURE_FLAGS= --with-ssl --without-libidn --enable-ftp --enable-ipv6 --enable-http --disable-gopher --disable-file --disable-ldap --disable-telnet --disable-dict --disable-static CPPFLAGS="$(curl_CFLAGS)" LDFLAGS="$(curl_LDFLAGS)"
>
> BUILD_DIR=$(CONFIGURE_DIR)$/lib
> BUILD_ACTION=$(GNUMAKE)
> @@ -81,7 +81,7 @@ curl_LIBS+=$(MINGW_SHARED_LIBSTDCPP)
> CONFIGURE_DIR=.$/
> #relative to CONFIGURE_DIR
> CONFIGURE_ACTION=.$/configure
> -CONFIGURE_FLAGS= --without-ssl --enable-ftp --enable-ipv6 --disable-http --disable-gopher --disable-file --disable-ldap --disable-telnet --disable-dict --build=i586-pc-mingw32 --host=i586-pc-mingw32 CC="$(curl_CC)" CPPFLAGS="$(INCLUDE)" OBJDUMP="objdump" LDFLAGS="-L$(ILIB:s/;/ -L/)" LIBS="$(curl_LIBS)"
> +CONFIGURE_FLAGS= --with-ssl --enable-ftp --enable-ipv6 --enable-http --disable-gopher --disable-file --disable-ldap --disable-telnet --disable-dict --build=i586-pc-mingw32 --host=i586-pc-mingw32 CC="$(curl_CC)" CPPFLAGS="$(INCLUDE)" OBJDUMP="objdump" LDFLAGS="-L$(ILIB:s/;/ -L/)" LIBS="$(curl_LIBS)"
> BUILD_DIR=$(CONFIGURE_DIR)$/lib
> BUILD_ACTION=make
> OUT2BIN=$(BUILD_DIR)$/.libs$/libcurl*.dll
> @@ -104,17 +104,17 @@ curl_MACHINE:="X64"
>
> BUILD_DIR=.$/winbuild
> .IF "$(debug)"==""
> -BUILD_ACTION=CC="cl.exe" nmake -f Makefile.vc mode=dll VC=9 EXCFLAGS=$(EXCFLAGS) MACHINE=$(curl_MACHINE)
> +BUILD_ACTION=CC="cl.exe" nmake -f Makefile.vc mode=dll VC=9 EXCFLAGS=$(EXCFLAGS) MACHINE=$(curl_MACHINE) RTLIBCFG=static WITH_DEVEL=$(OUTDIR) WITH_ZLIB=dll WITH_SSL=dll
> .ELSE
> -BUILD_ACTION=CC="cl.exe" nmake -f Makefile.vc mode=dll VC=9 DEBUG=yes EXCFLAGS=$(EXCFLAGS) MACHINE=$(curl_MACHINE)
> +BUILD_ACTION=CC="cl.exe" nmake -f Makefile.vc mode=dll VC=9 DEBUG=yes EXCFLAGS=$(EXCFLAGS) MACHINE=$(curl_MACHINE) RTLIBCFG=static WITH_DEVEL=$(OUTDIR) WITH_ZLIB=dll WITH_SSL=dll
> .ENDIF
>
> .IF "$(CPUNAME)"=="INTEL"
> -OUT2BIN=$(BUILD_DIR)$/../builds/libcurl-vc9-X86-release-dll-ipv6-sspi-schannel/bin/libcurl.dll
> -OUT2LIB=$(BUILD_DIR)$/../builds/libcurl-vc9-X86-release-dll-ipv6-sspi-schannel/lib/libcurl.lib
> +OUT2BIN=$(BUILD_DIR)$/../builds/libcurl-vc9-X86-release-dll-ssl-dll-zlib-dll-ipv6-sspi/bin/libcurl.dll
> +OUT2LIB=$(BUILD_DIR)$/../builds/libcurl-vc9-X86-release-dll-ssl-dll-zlib-dll-ipv6-sspi/lib/libcurl.lib
> .ELIF "$(CPUNAME)"=="X86_64"
> -OUT2BIN=$(BUILD_DIR)$/../builds/libcurl-vc9-X64-release-dll-ipv6-sspi-schannel/bin/libcurl.dll
> -OUT2LIB=$(BUILD_DIR)$/../builds/libcurl-vc9-X64-release-dll-ipv6-sspi-schannel/lib/libcurl.lib
> +OUT2BIN=$(BUILD_DIR)$/../builds/libcurl-vc9-X64-release-dll-ssl-dll-zlib-dll-ipv6-sspi/bin/libcurl.dll
> +OUT2LIB=$(BUILD_DIR)$/../builds/libcurl-vc9-X64-release-dll-ssl-dll-zlib-dll-ipv6-sspi/lib/libcurl.lib
> .ENDIF
>
> .ENDIF
> diff --git a/main/curl/prj/build.lst b/main/curl/prj/build.lst
> index d3aab47811..46a7d3b613 100644
> --- a/main/curl/prj/build.lst
> +++ b/main/curl/prj/build.lst
> @@ -1,3 +1,3 @@
> -xc curl : stlport external NULL
> +xc curl : stlport external OPENSSL:openssl ZLIB:zlib NULL
> xc curl usr1 - all xc_mkout NULL
> xc curl nmake - all xc_curl NULL
> diff --git a/main/external_deps.lst b/main/external_deps.lst
> index 1ed310164e..072031667e 100644
> --- a/main/external_deps.lst
> +++ b/main/external_deps.lst
> @@ -126,12 +126,6 @@ if ( true )
> URL1 = https://sourceforge.net/projects/icu/files/ICU4C/4.0.1/$(name)
> URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
>
> -if ( true )
> - SHA1 = f65fbbd72926c8e7cf0dbd4ada03b0d226f461fd
> - name = serf-1.2.1.tar.bz2
> - URL1 = https://archive.apache.org/dist/serf/serf-1.2.1.tar.bz2
> - URL2 = $(OOO_EXTRAS)$(SHA1)-$(name)
> -
> if (SOLAR_JAVA==TRUE && (ENABLE_MEDIAWIKI==YES || ENABLE_REPORTBUILDER==YES))
> MD5 = e8e197d628436490886d17cffa108fe3
> name = commons-logging-1.1.3-src.tar.gz
> @@ -162,18 +156,6 @@ if (SYSTEM_OPENSSL!=YES && DISABLE_OPENSSL!=TRUE)
> URL1 = https://www.openssl.org/source/old/1.0.2/$(name)
> URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
>
> -if ( true )
> - MD5 = 0759294408daace192c935b7c9e76e04
> - name = apr-1.6.5.tar.gz
> - URL1 = https://archive.apache.org/dist/apr/$(name)
> - URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
> -
> -if ( true )
> - MD5 = bd502b9a8670a8012c4d90c31a84955f
> - name = apr-util-1.6.1.tar.gz
> - URL1 = https://archive.apache.org/dist/apr/$(name)
> - URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
> -
> if (SYSTEM_LIBXML != YES)
> MD5 = 10942a1dc23137a8aa07f0639cbfece5
> name = libxml2-2.9.10.tar.gz
> diff --git a/main/scp2/prj/build.lst b/main/scp2/prj/build.lst
> index 46b8008c6e..bc387ead46 100644
> --- a/main/scp2/prj/build.lst
> +++ b/main/scp2/prj/build.lst
> @@ -1,4 +1,4 @@
> -cp scp2 : L10N:l10n i18npool setup_native l10ntools PYTHON:python ICU:icu REDLAND:redland LIBXSLT:libxslt APR:apr apr-util SERF:serf NULL
> +cp scp2 : L10N:l10n i18npool setup_native l10ntools PYTHON:python ICU:icu REDLAND:redland LIBXSLT:libxslt NULL
> cp scp2 usr1 - all cp_mkout NULL
> cp scp2\macros nmake - all cp_langmacros NULL
> cp scp2\source\templates nmake - all cp_langtemplates NULL
> diff --git a/main/scp2/source/ooo/file_library_ooo.scp b/main/scp2/source/ooo/file_library_ooo.scp
> index f3435a8b6a..7e7c39d7ba 100644
> --- a/main/scp2/source/ooo/file_library_ooo.scp
> +++ b/main/scp2/source/ooo/file_library_ooo.scp
> @@ -2010,64 +2010,3 @@ End
> #endif
> #endif
>
> -// AF: is this still needed with explicit support for system apr,apr-util,serf ?
> -#if !defined(OS2) // using system libs
> -
> -#ifdef APR_MAJOR
> -File gid_File_Lib_Apr
> - #ifdef WNT
> - Name = SPECIAL_NAME(libapr-1);
> - #else
> - // Looks like the major version number is part of the name, not
> - // part of the suffix. An error?
> - #ifdef MACOSX
> - Name = STRING(CONCAT2(libapr-1,UNXSUFFIX));
> - #elif FREEBSD
> - Name = STRING(CONCAT3(libapr-1,UNXSUFFIX,.5));
> - #else
> - Name = STRING(CONCAT6(libapr-1,UNXSUFFIX,.0.,APR_MINOR,.,APR_MICRO));
> - #endif
> - #endif
> - PACKED_LIB_FILE_BODY;
> -End
> -#endif
> -
> -#ifdef APR_UTIL_MAJOR
> -File gid_File_Lib_AprUtil
> - #ifdef WNT
> - Name = SPECIAL_NAME(apr-util);
> - #else
> - // Looks like the major version number is part of the name, not
> - // part of the suffix. An error?
> - #ifdef MACOSX
> - Name = STRING(CONCAT2(libaprutil-1,UNXSUFFIX));
> - #elif FREEBSD
> - Name = STRING(CONCAT3(libaprutil-1,UNXSUFFIX,.5));
> - #else
> - Name = STRING(CONCAT6(libaprutil-1,UNXSUFFIX,.0.,APR_UTIL_MINOR,.,APR_UTIL_MICRO));
> - #endif
> - #endif
> - PACKED_LIB_FILE_BODY;
> -End
> -#endif
> -
> -#ifdef SERF_MAJOR
> -File gid_File_Lib_Serf
> - #ifdef WNT
> - Name = SPECIAL_NAME(serf);
> - #else
> - // Looks like the major version number is part of the name, not
> - // part of the suffix. An error?
> - #ifdef MACOSX
> - Name = STRING(CONCAT3(libserf-,SERF_MAJOR,UNXSUFFIX));
> - #elif FREEBSD
> - Name = STRING(CONCAT3(libserf-1,UNXSUFFIX,.0));
> - #else
> - Name = STRING(CONCAT3(libserf-1,UNXSUFFIX,.0.0.0));
> - #endif
> - #endif
> - PACKED_LIB_FILE_BODY;
> -End
> -#endif
> -
> -#endif // !defined(OS2)
> diff --git a/main/scp2/source/ooo/makefile.mk b/main/scp2/source/ooo/makefile.mk
> index 10f4805b39..f5ce610c4a 100644
> --- a/main/scp2/source/ooo/makefile.mk
> +++ b/main/scp2/source/ooo/makefile.mk
> @@ -231,29 +231,6 @@ SCPDEFS+=-DOPENSSL
> SCPDEFS+=-DDISABLE_ATL
> .ENDIF
>
> -# Detect version numbers for apr, apr-util, serf.
> -.IF "$(SYSTEM_APR)"!="YES"
> -.INCLUDE : apr_version.mk
> -SCPDEFS+=\
> - -DAPR_MAJOR=$(APR_MAJOR) \
> - -DAPR_MINOR=$(APR_MINOR) \
> - -DAPR_MICRO=$(APR_MICRO)
> -.ENDIF
> -.IF "$(SYSTEM_APR_UTIL)"!="YES"
> -.INCLUDE : aprutil_version.mk
> -SCPDEFS+=\
> - -DAPR_UTIL_MAJOR=$(APR_UTIL_MAJOR) \
> - -DAPR_UTIL_MINOR=$(APR_UTIL_MINOR) \
> - -DAPR_UTIL_MICRO=$(APR_UTIL_MICRO)
> -.ENDIF
> -.IF "$(SYSTEM_SERF)"!="YES"
> -.INCLUDE : serf_version.mk
> -SCPDEFS+=\
> - -DSERF_MAJOR=$(SERF_MAJOR) \
> - -DSERF_MINOR=$(SERF_MINOR) \
> - -DSERF_MICRO=$(SERF_MICRO)
> -.ENDIF
> -
> .IF "$(SYSTEM_PYTHON)" == "YES"
> SCPDEFS+=-DSYSTEM_PYTHON
> .ENDIF
> diff --git a/main/scp2/source/ooo/shortcut_ooo.scp b/main/scp2/source/ooo/shortcut_ooo.scp
> index 9fbc33f7f7..80bc4224b8 100644
> --- a/main/scp2/source/ooo/shortcut_ooo.scp
> +++ b/main/scp2/source/ooo/shortcut_ooo.scp
> @@ -105,51 +105,4 @@ End
>
> #endif
>
> -#ifdef UNX
> -
> -// Create links to the fully quantified libraries apr, apr-util, and serf.
> -// The major version number is handled in a non-standard way (part of the name).
> -// Therefore the hard-coded .0 suffix.
> -
> -#ifdef APR_MAJOR
> -Shortcut gid_Shortcut_Lib_Apr
> - FileID = gid_File_Lib_Apr;
> - Dir = SCP2_OOO_BIN_DIR;
> - #ifdef MACOSX
> - Name = STRING(CONCAT2(libapr-1.0,UNXSUFFIX));
> - #else
> - Name = STRING(CONCAT3(libapr-1,UNXSUFFIX,.0));
> - #endif
> - Styles = (NETWORK,RELATIVE,FORCE_INTO_UPDATE_PACKAGE);
> -End
> -#endif
> -
> -#ifdef APR_UTIL_MAJOR
> -Shortcut gid_Shortcut_Lib_AprUtil
> - FileID = gid_File_Lib_AprUtil;
> - Dir = SCP2_OOO_BIN_DIR;
> - #ifdef MACOSX
> - Name = STRING(CONCAT2(libaprutil-1.0,UNXSUFFIX));
> - #else
> - Name = STRING(CONCAT3(libaprutil-1,UNXSUFFIX,.0));
> - #endif
> - Styles = (NETWORK,RELATIVE,FORCE_INTO_UPDATE_PACKAGE);
> -End
> -#endif
> -
> -#ifdef SERF_MAJOR
> -Shortcut gid_Shortcut_Lib_Serf
> - FileID = gid_File_Lib_Serf;
> - Dir = SCP2_OOO_BIN_DIR;
> - #ifdef MACOSX
> - Name = STRING(CONCAT2(libserf-1.0,UNXSUFFIX));
> - #else
> - Name = STRING(CONCAT3(libserf-1,UNXSUFFIX,.0));
> - #endif
> - Styles = (NETWORK,RELATIVE,FORCE_INTO_UPDATE_PACKAGE);
> -End
> -#endif
> -
> -#endif
> -
> //i44154 -end-
> diff --git a/main/set_soenv.in b/main/set_soenv.in
> index b57d46cf41..0af5fa2423 100644
> --- a/main/set_soenv.in
> +++ b/main/set_soenv.in
> @@ -1983,15 +1983,6 @@ ToFile( "SYSTEM_SAXON", "@SYSTEM_SAXON@", "e" );
> ToFile( "SAXON_JAR", "@SAXON_JAR@", "e" );
> ToFile( "DISABLE_SAXON", "@DISABLE_SAXON@", "e" );
> ToFile( "ENABLE_JAVASCRIPT", "@ENABLE_JAVASCRIPT@","e" );
> -ToFile( "SYSTEM_APR", "@SYSTEM_APR@", "e" );
> -ToFile( "APR_CFLAGS", "@APR_CFLAGS@", "e" );
> -ToFile( "APR_LIBS", "@APR_LIBS@", "e" );
> -ToFile( "SYSTEM_APR_UTIL", "@SYSTEM_APR_UTIL@", "e" );
> -ToFile( "APR_UTIL_CFLAGS", "@APR_UTIL_CFLAGS@", "e" );
> -ToFile( "APR_UTIL_LIBS", "@APR_UTIL_LIBS@", "e" );
> -ToFile( "SYSTEM_SERF", "@SYSTEM_SERF@", "e" );
> -ToFile( "SERF_CFLAGS", "@SERF_CFLAGS@", "e" );
> -ToFile( "SERF_LIBS", "@SERF_LIBS@", "e" );
> ToFile( "SYSTEM_COINMP", "@SYSTEM_COINMP@", "e" );
> ToFile( "ENABLE_COINMP", "@ENABLE_COINMP@", "e" );
> ToFile( "COINMP_CFLAGS", "@COINMP_CFLAGS@", "e" );
> diff --git a/main/ucb/Library_ucpdav1.mk b/main/ucb/Library_ucpdav1.mk
> index 1e074b7e28..697662fe25 100644
> --- a/main/ucb/Library_ucpdav1.mk
> +++ b/main/ucb/Library_ucpdav1.mk
> @@ -65,11 +65,9 @@ $(eval $(call gb_Library_add_linked_libs,ucpdav1,\
> ))
> endif
>
> -$(call gb_Library_use_external,ucpdav1,apr)
> -$(call gb_Library_use_external,ucpdav1,apr_util)
> +$(call gb_Library_use_external,ucpdav1,curl)
> $(call gb_Library_use_external,ucpdav1,libxml2)
> $(call gb_Library_use_external,ucpdav1,openssl)
> -$(call gb_Library_use_external,ucpdav1,serf)
>
> $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
> ucb/source/ucp/webdav/webdavservices \
> @@ -82,29 +80,15 @@ $(eval $(call gb_Library_add_exception_objects,ucpdav1,\
> ucb/source/ucp/webdav/DAVProperties \
> ucb/source/ucp/webdav/DAVSessionFactory \
> ucb/source/ucp/webdav/DAVResourceAccess \
> - ucb/source/ucp/webdav/AprEnv \
> ucb/source/ucp/webdav/webdavresponseparser \
> - ucb/source/ucp/webdav/SerfUri \
> - ucb/source/ucp/webdav/SerfRequestProcessor \
> - ucb/source/ucp/webdav/SerfRequestProcessorImpl \
> - ucb/source/ucp/webdav/SerfRequestProcessorImplFac \
> - ucb/source/ucp/webdav/SerfPropFindReqProcImpl \
> - ucb/source/ucp/webdav/SerfPropPatchReqProcImpl \
> - ucb/source/ucp/webdav/SerfGetReqProcImpl \
> - ucb/source/ucp/webdav/SerfHeadReqProcImpl \
> - ucb/source/ucp/webdav/SerfPutReqProcImpl \
> - ucb/source/ucp/webdav/SerfPostReqProcImpl \
> - ucb/source/ucp/webdav/SerfDeleteReqProcImpl \
> - ucb/source/ucp/webdav/SerfMkColReqProcImpl \
> - ucb/source/ucp/webdav/SerfCopyReqProcImpl \
> - ucb/source/ucp/webdav/SerfMoveReqProcImpl \
> - ucb/source/ucp/webdav/SerfLockReqProcImpl \
> - ucb/source/ucp/webdav/SerfLockRefreshProcImpl \
> - ucb/source/ucp/webdav/SerfUnlockProcImpl \
> - ucb/source/ucp/webdav/SerfLockStore \
> - ucb/source/ucp/webdav/SerfSession \
> - ucb/source/ucp/webdav/SerfCallbacks \
> - ucb/source/ucp/webdav/SerfInputStream \
> + ucb/source/ucp/webdav/CurlSession \
> + ucb/source/ucp/webdav/CurlRequest \
> + ucb/source/ucp/webdav/CurlLockStore \
> + ucb/source/ucp/webdav/LockRequest \
> + ucb/source/ucp/webdav/PropfindRequest \
> + ucb/source/ucp/webdav/ProppatchRequest \
> + ucb/source/ucp/webdav/CurlUri \
> + ucb/source/ucp/webdav/CurlInputStream \
> ucb/source/ucp/webdav/DateTimeHelper \
> ucb/source/ucp/webdav/UCBDeadPropertyValue \
> ))
> diff --git a/main/ucb/prj/build.lst b/main/ucb/prj/build.lst
> index 8272c9235c..3fba3fbe2a 100644
> --- a/main/ucb/prj/build.lst
> +++ b/main/ucb/prj/build.lst
> @@ -1,3 +1,3 @@
> -uc ucb : cppuhelper CURL:curl OPENSSL:openssl LIBXML2:libxml2 LIBXSLT:libxslt offapi sal salhelper ucbhelper udkapi comphelper SERF:serf tools NULL
> +uc ucb : cppuhelper CURL:curl OPENSSL:openssl LIBXML2:libxml2 LIBXSLT:libxslt offapi sal salhelper ucbhelper udkapi comphelper tools NULL
> uc ucb usr1 - all uc_mkout NULL
> uc ucb\prj nmake - all uc_prj NULL
> diff --git a/main/ucb/source/ucp/webdav/ContentProperties.cxx b/main/ucb/source/ucp/webdav/ContentProperties.cxx
> index 0e5f86de42..a0c04e6f3a 100644
> --- a/main/ucb/source/ucp/webdav/ContentProperties.cxx
> +++ b/main/ucb/source/ucp/webdav/ContentProperties.cxx
> @@ -31,7 +31,7 @@
> *************************************************************************/
> #include <osl/diagnose.h>
> #include <com/sun/star/util/DateTime.hpp>
> -#include "SerfUri.hxx"
> +#include "CurlUri.hxx"
> #include "DAVResource.hxx"
> #include "DAVProperties.hxx"
> #include "DateTimeHelper.hxx"
> @@ -97,7 +97,7 @@ ContentProperties::ContentProperties( const DAVResource& rResource )
> // Title
> try
> {
> - SerfUri aURI( rResource.uri );
> + CurlUri aURI( rResource.uri );
> m_aEscapedTitle = aURI.GetPathBaseName();
>
> (*m_xProps)[ rtl::OUString::createFromAscii( "Title" ) ]
> diff --git a/main/ucb/source/ucp/webdav/SerfInputStream.cxx b/main/ucb/source/ucp/webdav/CurlInputStream.cxx
> similarity index 86%
> rename from main/ucb/source/ucp/webdav/SerfInputStream.cxx
> rename to main/ucb/source/ucp/webdav/CurlInputStream.cxx
> index 32b7df3923..2d72b6a201 100644
> --- a/main/ucb/source/ucp/webdav/SerfInputStream.cxx
> +++ b/main/ucb/source/ucp/webdav/CurlInputStream.cxx
> @@ -23,7 +23,7 @@
>
> // MARKER(update_precomp.py): autogen include statement, do not remove
> #include "precompiled_webdav.hxx"
> -#include "SerfInputStream.hxx"
> +#include "CurlInputStream.hxx"
> #include <rtl/memory.h>
>
> using namespace cppu;
> @@ -36,16 +36,17 @@ using namespace http_dav_ucp;
> // -------------------------------------------------------------------
> // Constructor
> // -------------------------------------------------------------------
> -SerfInputStream::SerfInputStream( void )
> +CurlInputStream::CurlInputStream( void )
> : mLen( 0 ),
> - mPos( 0 )
> + mPos( 0 ),
> + mCapacity( 0 )
> {
> }
>
> // -------------------------------------------------------------------
> // Destructor
> // -------------------------------------------------------------------
> -SerfInputStream::~SerfInputStream( void )
> +CurlInputStream::~CurlInputStream( void )
> {
> }
>
> @@ -53,17 +54,24 @@ SerfInputStream::~SerfInputStream( void )
> // AddToStream
> // Allows the caller to add some data to the "end" of the stream
> // -------------------------------------------------------------------
> -void SerfInputStream::AddToStream( const char * inBuf, sal_Int32 inLen )
> +void CurlInputStream::AddToStream( const char * inBuf, sal_Int32 inLen )
> {
> - mInputBuffer.realloc( sal::static_int_cast<sal_Int32>(mLen) + inLen );
> + if ( mLen + inLen > mCapacity )
> + {
> + if ( 2*mCapacity >= ( mLen + inLen ) )
> + mCapacity *= 2;
> + else
> + mCapacity = mLen + inLen;
> + mInputBuffer.realloc( mCapacity );
> + }
> rtl_copyMemory( mInputBuffer.getArray() + mLen, inBuf, inLen );
> - mLen += inLen;
> + mLen += inLen;
> }
>
> // -------------------------------------------------------------------
> // queryInterface
> // -------------------------------------------------------------------
> -Any SerfInputStream::queryInterface( const Type &type )
> +Any CurlInputStream::queryInterface( const Type &type )
> throw( RuntimeException )
> {
> Any aRet = ::cppu::queryInterface( type,
> @@ -76,7 +84,7 @@ Any SerfInputStream::queryInterface( const Type &type )
> // readBytes
> // "Reads" the specified number of bytes from the stream
> // -------------------------------------------------------------------
> -sal_Int32 SAL_CALL SerfInputStream::readBytes(
> +sal_Int32 SAL_CALL CurlInputStream::readBytes(
> ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
> throw( ::com::sun::star::io::NotConnectedException,
> ::com::sun::star::io::BufferSizeExceededException,
> @@ -105,7 +113,7 @@ sal_Int32 SAL_CALL SerfInputStream::readBytes(
> // -------------------------------------------------------------------
> // readSomeBytes
> // -------------------------------------------------------------------
> -sal_Int32 SAL_CALL SerfInputStream::readSomeBytes(
> +sal_Int32 SAL_CALL CurlInputStream::readSomeBytes(
> ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
> throw( ::com::sun::star::io::NotConnectedException,
> ::com::sun::star::io::BufferSizeExceededException,
> @@ -120,7 +128,7 @@ sal_Int32 SAL_CALL SerfInputStream::readSomeBytes(
> // skipBytes
> // Moves the current stream position forward
> // -------------------------------------------------------------------
> -void SAL_CALL SerfInputStream::skipBytes( sal_Int32 nBytesToSkip )
> +void SAL_CALL CurlInputStream::skipBytes( sal_Int32 nBytesToSkip )
> throw( ::com::sun::star::io::NotConnectedException,
> ::com::sun::star::io::BufferSizeExceededException,
> ::com::sun::star::io::IOException,
> @@ -135,7 +143,7 @@ void SAL_CALL SerfInputStream::skipBytes( sal_Int32 nBytesToSkip )
> // available
> // Returns the number of unread bytes currently remaining on the stream
> // -------------------------------------------------------------------
> -sal_Int32 SAL_CALL SerfInputStream::available( )
> +sal_Int32 SAL_CALL CurlInputStream::available( )
> throw( ::com::sun::star::io::NotConnectedException,
> ::com::sun::star::io::IOException,
> ::com::sun::star::uno::RuntimeException )
> @@ -146,7 +154,7 @@ sal_Int32 SAL_CALL SerfInputStream::available( )
> // -------------------------------------------------------------------
> // closeInput
> // -------------------------------------------------------------------
> -void SAL_CALL SerfInputStream::closeInput( void )
> +void SAL_CALL CurlInputStream::closeInput( void )
> throw( ::com::sun::star::io::NotConnectedException,
> ::com::sun::star::io::IOException,
> ::com::sun::star::uno::RuntimeException )
> @@ -156,7 +164,7 @@ void SAL_CALL SerfInputStream::closeInput( void )
> // -------------------------------------------------------------------
> // seek
> // -------------------------------------------------------------------
> -void SAL_CALL SerfInputStream::seek( sal_Int64 location )
> +void SAL_CALL CurlInputStream::seek( sal_Int64 location )
> throw( ::com::sun::star::lang::IllegalArgumentException,
> ::com::sun::star::io::IOException,
> ::com::sun::star::uno::RuntimeException )
> @@ -173,7 +181,7 @@ void SAL_CALL SerfInputStream::seek( sal_Int64 location )
> // -------------------------------------------------------------------
> // getPosition
> // -------------------------------------------------------------------
> -sal_Int64 SAL_CALL SerfInputStream::getPosition()
> +sal_Int64 SAL_CALL CurlInputStream::getPosition()
> throw( ::com::sun::star::io::IOException,
> ::com::sun::star::uno::RuntimeException )
> {
> @@ -183,7 +191,7 @@ sal_Int64 SAL_CALL SerfInputStream::getPosition()
> // -------------------------------------------------------------------
> // getLength
> // -------------------------------------------------------------------
> -sal_Int64 SAL_CALL SerfInputStream::getLength()
> +sal_Int64 SAL_CALL CurlInputStream::getLength()
> throw( ::com::sun::star::io::IOException,
> ::com::sun::star::uno::RuntimeException )
> {
> diff --git a/main/ucb/source/ucp/webdav/SerfInputStream.hxx b/main/ucb/source/ucp/webdav/CurlInputStream.hxx
> similarity index 93%
> rename from main/ucb/source/ucp/webdav/SerfInputStream.hxx
> rename to main/ucb/source/ucp/webdav/CurlInputStream.hxx
> index 1c38f2f4a9..24628ee14d 100644
> --- a/main/ucb/source/ucp/webdav/SerfInputStream.hxx
> +++ b/main/ucb/source/ucp/webdav/CurlInputStream.hxx
> @@ -20,8 +20,8 @@
> *************************************************************/
>
>
> -#ifndef INCLUDED_NEONINPUTSTREAM_HXX
> -#define INCLUDED_NEONINPUTSTREAM_HXX
> +#ifndef INCLUDED_CURLINPUTSTREAM_HXX
> +#define INCLUDED_CURLINPUTSTREAM_HXX
>
> #include <sal/types.h>
> #include <rtl/ustring.hxx>
> @@ -34,11 +34,11 @@ namespace http_dav_ucp
> {
>
> // -------------------------------------------------------------------
> -// SerfInputStream
> +// CurlInputStream
> // A simple XInputStream implementation provided specifically for use
> // by the DAVSession::GET method.
> // -------------------------------------------------------------------
> -class SerfInputStream : public ::com::sun::star::io::XInputStream,
> +class CurlInputStream : public ::com::sun::star::io::XInputStream,
> public ::com::sun::star::io::XSeekable,
> public ::cppu::OWeakObject
> {
> @@ -46,10 +46,11 @@ class SerfInputStream : public ::com::sun::star::io::XInputStream,
> com::sun::star::uno::Sequence< sal_Int8 > mInputBuffer;
> sal_Int64 mLen;
> sal_Int64 mPos;
> + sal_Int64 mCapacity;
>
> public:
> - SerfInputStream( void );
> - virtual ~SerfInputStream();
> + CurlInputStream( void );
> + virtual ~CurlInputStream();
>
> // Add some data to the end of the stream
> void AddToStream( const char * inBuf, sal_Int32 inLen );
> @@ -118,4 +119,4 @@ class SerfInputStream : public ::com::sun::star::io::XInputStream,
>
> } // namespace http_dav_ucp
>
> -#endif // INCLUDED_NEONINPUTSTREAM_HXX
> +#endif // INCLUDED_CURLINPUTSTREAM_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfLockStore.cxx b/main/ucb/source/ucp/webdav/CurlLockStore.cxx
> similarity index 86%
> rename from main/ucb/source/ucp/webdav/SerfLockStore.cxx
> rename to main/ucb/source/ucp/webdav/CurlLockStore.cxx
> index bbe409b685..a3f23a5626 100644
> --- a/main/ucb/source/ucp/webdav/SerfLockStore.cxx
> +++ b/main/ucb/source/ucp/webdav/CurlLockStore.cxx
> @@ -27,9 +27,9 @@
> #include <rtl/ustring.hxx>
> #include <osl/time.h>
> #include <osl/thread.hxx>
> -#include "SerfTypes.hxx"
> -#include "SerfSession.hxx"
> -#include "SerfLockStore.hxx"
> +#include "CurlTypes.hxx"
> +#include "CurlSession.hxx"
> +#include "CurlLockStore.hxx"
>
> using namespace http_dav_ucp;
>
> @@ -38,11 +38,11 @@ namespace http_dav_ucp {
> class TickerThread : public osl::Thread
> {
> bool m_bFinish;
> - SerfLockStore & m_rLockStore;
> + CurlLockStore & m_rLockStore;
>
> public:
>
> - TickerThread( SerfLockStore & rLockStore )
> + TickerThread( CurlLockStore & rLockStore )
> : osl::Thread(), m_bFinish( false ), m_rLockStore( rLockStore ) {}
>
> void finish() { m_bFinish = true; }
> @@ -81,25 +81,25 @@ void TickerThread::run()
> }
>
> // -------------------------------------------------------------------
> -SerfLockStore::SerfLockStore()
> +CurlLockStore::CurlLockStore()
> : m_pTickerThread( 0 )
> {
> }
>
> // -------------------------------------------------------------------
> -SerfLockStore::~SerfLockStore()
> +CurlLockStore::~CurlLockStore()
> {
> stopTicker();
>
> // release active locks, if any.
> OSL_ENSURE( m_aLockInfoMap.size() == 0,
> - "SerfLockStore::~SerfLockStore - Releasing active locks!" );
> + "CurlLockStore::~CurlLockStore - Releasing active locks!" );
>
> LockInfoMap::const_iterator it( m_aLockInfoMap.begin() );
> const LockInfoMap::const_iterator end( m_aLockInfoMap.end() );
> while ( it != end )
> {
> - SerfLock * pLock = (*it).first;
> + CurlLock * pLock = (*it).first;
> try
> {
> (*it).second.xSession->UNLOCK( pLock );
> @@ -112,7 +112,7 @@ SerfLockStore::~SerfLockStore()
> }
>
> // -------------------------------------------------------------------
> -void SerfLockStore::startTicker()
> +void CurlLockStore::startTicker()
> {
> osl::MutexGuard aGuard( m_aMutex );
>
> @@ -124,7 +124,7 @@ void SerfLockStore::startTicker()
> }
>
> // -------------------------------------------------------------------
> -void SerfLockStore::stopTicker()
> +void CurlLockStore::stopTicker()
> {
> osl::MutexGuard aGuard( m_aMutex );
>
> @@ -139,7 +139,7 @@ void SerfLockStore::stopTicker()
>
> #if 0 //not currently used
> // -------------------------------------------------------------------
> -void SerfLockStore::registerSession( SerfSession /* aSession */ )
> +void CurlLockStore::registerSession( CurlSession /* aSession */ )
> {
> osl::MutexGuard aGuard( m_aMutex );
>
> @@ -147,7 +147,7 @@ void SerfLockStore::registerSession( SerfSession /* aSession */ )
> #endif
>
> // -------------------------------------------------------------------
> -SerfLock * SerfLockStore::findByUri( rtl::OUString const & rUri)
> +CurlLock * CurlLockStore::findByUri( rtl::OUString const & rUri)
> {
> osl::MutexGuard aGuard( m_aMutex );
>
> @@ -156,7 +156,7 @@ SerfLock * SerfLockStore::findByUri( rtl::OUString const & rUri)
>
> while ( it != end )
> {
> - SerfLock * pLock = (*it).first;
> + CurlLock * pLock = (*it).first;
> if( pLock->getResourceUri().equals( rUri ) )
> {
> return pLock;
> @@ -164,12 +164,12 @@ SerfLock * SerfLockStore::findByUri( rtl::OUString const & rUri)
> ++it;
> }
>
> - return static_cast<SerfLock*>(0);
> + return static_cast<CurlLock*>(0);
> }
>
> // -------------------------------------------------------------------
> -void SerfLockStore::addLock( SerfLock * pLock,
> - rtl::Reference< SerfSession > const & xSession,
> +void CurlLockStore::addLock( CurlLock * pLock,
> + rtl::Reference< CurlSession > const & xSession,
> sal_Int32 nLastChanceToSendRefreshRequest )
> {
> osl::MutexGuard aGuard( m_aMutex );
> @@ -184,7 +184,7 @@ void SerfLockStore::addLock( SerfLock * pLock,
> pLock->getLock().Owner >>= aOwner;
> rtl::OUString aToken;
> aToken = pLock->getLock().LockTokens[0];
> - OSL_TRACE("SerfLockStore::addLock: new lock added aOwner '%s', token '%s'",
> + OSL_TRACE("CurlLockStore::addLock: new lock added aOwner '%s', token '%s'",
> rtl::OUStringToOString(aOwner, RTL_TEXTENCODING_UTF8).getStr(),
> rtl::OUStringToOString(aToken, RTL_TEXTENCODING_UTF8).getStr() );
> #endif
> @@ -193,14 +193,14 @@ void SerfLockStore::addLock( SerfLock * pLock,
>
> #if 0 //not currently used
> // -------------------------------------------------------------------
> -void SerfLockStore::updateLock( SerfLock * pLock,
> +void CurlLockStore::updateLock( CurlLock * pLock,
> sal_Int32 nLastChanceToSendRefreshRequest )
> {
> osl::MutexGuard aGuard( m_aMutex );
>
> LockInfoMap::iterator it( m_aLockInfoMap.find( pLock ) );
> OSL_ENSURE( it != m_aLockInfoMap.end(),
> - "SerfLockStore::updateLock: lock not found!" );
> + "CurlLockStore::updateLock: lock not found!" );
>
> if ( it != m_aLockInfoMap.end() )
> {
> @@ -211,7 +211,7 @@ void SerfLockStore::updateLock( SerfLock * pLock,
> #endif
>
> // -------------------------------------------------------------------
> -void SerfLockStore::removeLock( SerfLock * pLock )
> +void CurlLockStore::removeLock( CurlLock * pLock )
> {
> osl::MutexGuard aGuard( m_aMutex );
>
> @@ -221,14 +221,14 @@ void SerfLockStore::removeLock( SerfLock * pLock )
> LockInfo & rInfo = (*it).second;
> rInfo.xSession->release();
> m_aLockInfoMap.erase( pLock );
> - //the caller should deallocate SerfLock class after the call!
> + //the caller should deallocate CurlLock class after the call!
> if ( m_aLockInfoMap.size() == 0 )
> stopTicker();
> }
> }
>
> // -------------------------------------------------------------------
> -void SerfLockStore::refreshLocks()
> +void CurlLockStore::refreshLocks()
> {
> osl::MutexGuard aGuard( m_aMutex );
>
> @@ -252,7 +252,7 @@ void SerfLockStore::refreshLocks()
> aLock.Owner >>= aOwner;
> rtl::OUString aToken;
> aToken = aLock.LockTokens[0];
> - OSL_TRACE( "SerfLockStore::refreshLocks: refresh started for lock: aOwner '%s', token '%s'",
> + OSL_TRACE( "CurlLockStore::refreshLocks: refresh started for lock: aOwner '%s', token '%s'",
> rtl::OUStringToOString(aOwner, RTL_TEXTENCODING_UTF8).getStr(),
> rtl::OUStringToOString(aToken, RTL_TEXTENCODING_UTF8).getStr() );
> #endif
> @@ -276,7 +276,7 @@ void SerfLockStore::refreshLocks()
> // may be just ignore and go on, it's possible the net is temporary down?
> rInfo.nLastChanceToSendRefreshRequest = -1;
> #if OSL_DEBUG_LEVEL > 0
> - OSL_TRACE( "SerfLockStore::refreshLocks: Lock '%s' not refreshed! (error: DAVException.mStatusCode %d)",
> + OSL_TRACE( "CurlLockStore::refreshLocks: Lock '%s' not refreshed! (error: DAVException.mStatusCode %d)",
> rtl::OUStringToOString(aToken, RTL_TEXTENCODING_UTF8).getStr(), e.getStatus() );
> #endif
> }
> diff --git a/main/ucb/source/ucp/webdav/SerfLockStore.hxx b/main/ucb/source/ucp/webdav/CurlLockStore.hxx
> similarity index 71%
> rename from main/ucb/source/ucp/webdav/SerfLockStore.hxx
> rename to main/ucb/source/ucp/webdav/CurlLockStore.hxx
> index 13ee204560..974d9c6597 100644
> --- a/main/ucb/source/ucp/webdav/SerfLockStore.hxx
> +++ b/main/ucb/source/ucp/webdav/CurlLockStore.hxx
> @@ -20,24 +20,24 @@
> *************************************************************/
>
>
> -#ifndef INCLUDED_SERFLOCKSTORE_HXX
> -#define INCLUDED_SERFLOCKSTORE_HXX
> +#ifndef INCLUDED_CURLLOCKSTORE_HXX
> +#define INCLUDED_CURLLOCKSTORE_HXX
>
> #include <map>
> #include <osl/mutex.hxx>
> #include <rtl/ref.hxx>
> -#include "SerfTypes.hxx"
> -#include "SerfSession.hxx"
> +#include "CurlTypes.hxx"
> +#include "CurlSession.hxx"
>
> namespace http_dav_ucp
> {
>
> class TickerThread;
> -class SerfSession;
> +class CurlSession;
>
> struct ltptr
> {
> - bool operator()( const SerfLock * p1, const SerfLock * p2 ) const
> + bool operator()( const CurlLock * p1, const CurlLock * p2 ) const
> {
> return p1 < p2;
> }
> @@ -45,45 +45,45 @@ struct ltptr
>
> typedef struct _LockInfo
> {
> - rtl::Reference< SerfSession > xSession;
> + rtl::Reference< CurlSession > xSession;
> sal_Int32 nLastChanceToSendRefreshRequest;
>
> _LockInfo()
> : nLastChanceToSendRefreshRequest( -1 ) {}
>
> - _LockInfo( rtl::Reference< SerfSession > const & _xSession,
> + _LockInfo( rtl::Reference< CurlSession > const & _xSession,
> sal_Int32 _nLastChanceToSendRefreshRequest )
> : xSession( _xSession )
> , nLastChanceToSendRefreshRequest( _nLastChanceToSendRefreshRequest ) {}
>
> } LockInfo;
>
> -typedef std::map< SerfLock *, LockInfo, ltptr > LockInfoMap;
> +typedef std::map< CurlLock *, LockInfo, ltptr > LockInfoMap;
>
> -class SerfLockStore
> +class CurlLockStore
> {
> osl::Mutex m_aMutex;
> TickerThread * m_pTickerThread;
> LockInfoMap m_aLockInfoMap;
>
> public:
> - SerfLockStore();
> - ~SerfLockStore();
> + CurlLockStore();
> + ~CurlLockStore();
>
> - void registerSession( SerfSession aSession );
> + void registerSession( CurlSession aSession );
>
> - SerfLock * findByUri( rtl::OUString const & rUri );
> + CurlLock * findByUri( rtl::OUString const & rUri );
>
> - void addLock( SerfLock * pLock,
> - rtl::Reference< SerfSession > const & xSession,
> + void addLock( CurlLock * pLock,
> + rtl::Reference< CurlSession > const & xSession,
> // time in seconds since Jan 1 1970
> // -1: infinite lock, no refresh
> sal_Int32 nLastChanceToSendRefreshRequest );
>
> - void updateLock( SerfLock * pLock,
> + void updateLock( CurlLock * pLock,
> sal_Int32 nLastChanceToSendRefreshRequest );
>
> - void removeLock( SerfLock * pLock );
> + void removeLock( CurlLock * pLock );
>
> void refreshLocks();
>
> @@ -94,4 +94,4 @@ private:
>
> } // namespace http_dav_ucp
>
> -#endif // INCLUDED_SERFLOCKSTORE_HXX
> +#endif // INCLUDED_CURLLOCKSTORE_HXX
> diff --git a/main/ucb/source/ucp/webdav/CurlRequest.cxx b/main/ucb/source/ucp/webdav/CurlRequest.cxx
> new file mode 100644
> index 0000000000..ee6e906e99
> --- /dev/null
> +++ b/main/ucb/source/ucp/webdav/CurlRequest.cxx
> @@ -0,0 +1,391 @@
> +/**************************************************************
> + *
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *
> + *************************************************************/
> +
> +
> +
> +// MARKER(update_precomp.py): autogen include statement, do not remove
> +#include "precompiled_webdav.hxx"
> +
> +#include "CurlRequest.hxx"
> +
> +using namespace ::com::sun::star;
> +using namespace http_dav_ucp;
> +
> +CurlRequest::CurlRequest( CURL *curl )
> + : curl( curl )
> + , curlUrl( NULL )
> + , requestHeaders( NULL )
> + , requestBody( NULL )
> + , requestBodyOffset( 0 )
> + , requestBodySize( 0 )
> + , useChunkedEncoding( false )
> + , provideCredentialsCallback( NULL )
> + , provideCredentialsUserdata( NULL )
> + , statusCode( 0 )
> + , responseBodyInputStream( new CurlInputStream() )
> +{
> + curl_easy_setopt( curl, CURLOPT_HEADERFUNCTION, Curl_HeaderReceived );
> + curl_easy_setopt( curl, CURLOPT_HEADERDATA, this );
> + curl_easy_setopt( curl, CURLOPT_WRITEFUNCTION, Curl_MoreBodyReceived );
> + curl_easy_setopt( curl, CURLOPT_WRITEDATA, this );
> +}
> +
> +CurlRequest::~CurlRequest()
> +{
> + if ( curlUrl != NULL )
> + curl_url_cleanup( curlUrl );
> + curl_easy_setopt( curl, CURLOPT_CURLU, NULL );
> +
> + curl_easy_setopt( curl, CURLOPT_HTTPHEADER, NULL );
> + if ( requestHeaders != NULL )
> + curl_slist_free_all( requestHeaders );
> + curl_easy_setopt( curl, CURLOPT_READFUNCTION, NULL );
> + curl_easy_setopt( curl, CURLOPT_READDATA, NULL );
> + curl_easy_setopt( curl, CURLOPT_INFILESIZE, -1 );
> + curl_easy_setopt( curl, CURLOPT_SEEKFUNCTION, NULL );
> + curl_easy_setopt( curl, CURLOPT_SEEKDATA, NULL );
> + curl_easy_setopt( curl, CURLOPT_HEADERFUNCTION, NULL );
> + curl_easy_setopt( curl, CURLOPT_HEADERDATA, NULL );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, NULL );
> + curl_easy_setopt( curl, CURLOPT_WRITEFUNCTION, NULL );
> + curl_easy_setopt( curl, CURLOPT_WRITEDATA, NULL );
> +}
> +
> +void CurlRequest::addHeader( const rtl::OString &name, const rtl::OString &value) throw (DAVException)
> +{
> + rtl::OString line = name + ": " + value;
> + struct curl_slist *appended = curl_slist_append( requestHeaders, line.getStr() );
> + if ( appended != NULL )
> + {
> + requestHeaders = appended;
> + curl_easy_setopt( curl, CURLOPT_HTTPHEADER, requestHeaders );
> + }
> + else
> + throw DAVException( DAVException::DAV_SESSION_CREATE, rtl::OUString::createFromAscii( "Out of memory" ) );
> +}
> +
> +void CurlRequest::setRequestBody( const char *body, size_t size )
> +{
> + requestBody = body;
> + requestBodyOffset = 0;
> + requestBodySize = size;
> +
> + curl_easy_setopt( curl, CURLOPT_READFUNCTION, Curl_SendMoreBody );
> + curl_easy_setopt( curl, CURLOPT_READDATA, this );
> + curl_easy_setopt( curl, CURLOPT_SEEKFUNCTION, Curl_SeekCallback );
> + curl_easy_setopt( curl, CURLOPT_SEEKDATA, this );
> + if ( useChunkedEncoding )
> + addHeader( "Transfer-Encoding", "chunked" );
> + else
> + curl_easy_setopt( curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)size );
> +}
> +
> +int CurlRequest::Curl_SeekCallback( void *userdata, curl_off_t offset, int origin )
> +{
> + CurlRequest *request = static_cast< CurlRequest* >( userdata );
> + if ( origin == SEEK_SET )
> + request->requestBodyOffset = (size_t) offset;
> + else if ( origin == SEEK_CUR )
> + request->requestBodyOffset += (size_t) offset;
> + else if ( origin == SEEK_END )
> + request->requestBodyOffset += (size_t) ((curl_off_t)request->requestBodySize + offset);
> + else
> + return CURL_SEEKFUNC_CANTSEEK;
> + if ( request->requestBodyOffset > request->requestBodySize )
> + request->requestBodyOffset = request->requestBodySize;
> + return CURL_SEEKFUNC_OK;
> +}
> +
> +size_t CurlRequest::Curl_SendMoreBody( char *buffer, size_t size, size_t nitems, void *userdata )
> +{
> + CurlRequest *request = static_cast< CurlRequest* >( userdata );
> + OSL_TRACE("Curl_SendMoreBody");
> + return request->curlSendMoreBody( buffer, nitems );
> +}
> +
> +size_t CurlRequest::curlSendMoreBody( char *buffer, size_t len )
> +{
> + size_t bytesToSend = requestBodySize - requestBodyOffset;
> + if ( bytesToSend > len )
> + bytesToSend = len;
> + memcpy( buffer, requestBody, bytesToSend );
> + requestBodyOffset += bytesToSend;
> + return bytesToSend;
> +}
> +
> +void CurlRequest::setProvideCredentialsCallback( bool (*callback)(long statusCode, void *userdata) throw (DAVException), void *userdata )
> +{
> + provideCredentialsCallback = callback;
> + provideCredentialsUserdata = userdata;
> +}
> +
> +void CurlRequest::setURI( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + if ( curlUrl != NULL )
> + {
> + curl_url_cleanup( curlUrl );
> + curlUrl = NULL;
> + }
> +
> + curlUrl = curl_url();
> + if ( curlUrl == NULL )
> + throw DAVException( DAVException::DAV_SESSION_CREATE, rtl::OUString::createFromAscii( "Out of memory" ) );
> +
> + if ( CurlUri( path ).GetHost().isEmpty() )
> + {
> + // "path" is really a path, not a URI
> + curl_url_set( curlUrl, CURLUPART_URL, rtl::OUStringToOString( uri.GetURI(), RTL_TEXTENCODING_UTF8 ).getStr(), 0 );
> + curl_url_set( curlUrl, CURLUPART_PATH, rtl::OUStringToOString( path, RTL_TEXTENCODING_UTF8 ).getStr(), 0 );
> + }
> + else
> + {
> + // The "path" is a full URI
> + curl_url_set( curlUrl, CURLUPART_URL, rtl::OUStringToOString( path, RTL_TEXTENCODING_UTF8 ).getStr(), 0 );
> + }
> + curl_easy_setopt( curl, CURLOPT_CURLU, curlUrl );
> +}
> +
> +CURLcode CurlRequest::copy( CurlUri uri, rtl::OUString path ) throw(DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_HTTPGET, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "COPY" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::delete_( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_HTTPGET, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "DELETE" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::get( CurlUri uri, rtl::OUString path ) throw(DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_HTTPGET, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "GET" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::head( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_NOBODY, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "HEAD" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::lock( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_UPLOAD, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "LOCK" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::mkcol( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_HTTPGET, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "MKCOL" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::move( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_HTTPGET, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "MOVE" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::post( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_UPLOAD, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "POST" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::propfind( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_UPLOAD, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "PROPFIND" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::proppatch( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_UPLOAD, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "PROPPATCH" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::put( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_UPLOAD, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "PUT" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::unlock( CurlUri uri, rtl::OUString path ) throw (DAVException)
> +{
> + setURI( uri, path );
> + curl_easy_setopt( curl, CURLOPT_HTTPGET, 1L );
> + curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST, "UNLOCK" );
> + return perform();
> +}
> +
> +CURLcode CurlRequest::perform() throw (DAVException)
> +{
> + CURLcode rc = curl_easy_perform( curl );
> + long statusCode = 0;
> + curl_easy_getinfo( curl, CURLINFO_RESPONSE_CODE, &statusCode );
> + if ( ( statusCode == 401 || statusCode == 407 ) && provideCredentialsCallback != NULL )
> + {
> + bool haveCredentials = provideCredentialsCallback( statusCode, provideCredentialsUserdata );
> + if ( haveCredentials )
> + {
> + // rewind body:
> + requestBodyOffset = 0;
> + // retry with credentials:
> + rc = curl_easy_perform( curl );
> + // If this was to authenticate with the proxy, we may need to authenticate
> + // with the destination host too:
> + if ( statusCode == 407 )
> + {
> + curl_easy_getinfo( curl, CURLINFO_RESPONSE_CODE, &statusCode );
> + if ( statusCode == 401 && provideCredentialsCallback != NULL )
> + {
> + haveCredentials = provideCredentialsCallback( statusCode, provideCredentialsUserdata );
> + if ( haveCredentials )
> + {
> + // rewind body:
> + requestBodyOffset = 0;
> + // retry with credentials:
> + rc = curl_easy_perform( curl );
> + }
> + }
> + }
> + }
> + }
> + return rc;
> +}
> +
> +size_t CurlRequest::Curl_HeaderReceived( char *buffer, size_t size, size_t nitems, void *userdata )
> +{
> + CurlRequest *request = static_cast< CurlRequest* >( userdata );
> + OSL_TRACE("Curl_HeaderReceived");
> + request->curlHeaderReceived( buffer, nitems );
> + return nitems;
> +}
> +
> +void CurlRequest::curlHeaderReceived( const char *buffer, size_t size )
> +{
> + rtl::OString lineCrLf( buffer, size );
> + sal_Int32 cr = lineCrLf.indexOf( "\r" );
> + if ( cr < 0 )
> + return;
> +
> + rtl::OString line = lineCrLf.copy( 0, cr );
> + if ( line.indexOf( "HTTP/" ) == 0 )
> + {
> + // Status line
> + // Throw away any response headers from a prior response:
> + responseHeaders.clear();
> + sal_Int32 idxFirstSpace = line.indexOf( ' ' );
> + if ( idxFirstSpace > 0 )
> + {
> + int idxSecondSpace = line.indexOf( ' ', idxFirstSpace + 1 );
> + if ( idxSecondSpace > 0 )
> + {
> + reasonPhrase = line.copy( idxSecondSpace + 1 );
> + statusCode = line.copy( idxFirstSpace + 1, idxSecondSpace - idxFirstSpace - 1 ).toInt32();
> + }
> + else
> + {
> + reasonPhrase = "";
> + statusCode = line.copy( idxFirstSpace + 1 ).toInt32();
> + }
> + }
> + }
> + else
> + {
> + // Header line
> + if ( line.getLength() == 0 )
> + {
> + // End of HTTP header
> + // Discard any intermediate body from 100 Trying or 401 Authentication required:
> + responseBodyInputStream = new CurlInputStream();
> + return;
> + }
> + sal_Int32 colon = line.indexOf( ':' );
> + if ( colon < 0 )
> + {
> + OSL_TRACE("Non-empty HTTP line without a ':'. Folded header deprecated by RFC 7230?");
> + return;
> + }
> + Header header;
> + header.name = line.copy( 0, colon ).toAsciiLowerCase();
> + header.value = line.copy( colon + 1 ).trim();
> + responseHeaders.push_back(header);
> + }
> +}
> +
> +const CurlRequest::Header *CurlRequest::findResponseHeader( const rtl::OString &name )
> +{
> + std::vector< CurlRequest::Header >::const_iterator it( responseHeaders.begin() );
> + const std::vector< CurlRequest::Header >::const_iterator end( responseHeaders.end() );
> + for ( ; it != end; it++ )
> + {
> + if ( name.equalsIgnoreAsciiCase( it->name ) )
> + return &(*it);
> + }
> + return NULL;
> +}
> +
> +void CurlRequest::saveResponseBodyTo( const uno::Reference< io::XOutputStream > & xOutStream)
> +{
> + xOutputStream = xOutStream;
> +}
> +
> +size_t CurlRequest::Curl_MoreBodyReceived( char *buffer, size_t size, size_t nitems, void *userdata )
> +{
> + CurlRequest *request = static_cast< CurlRequest* >( userdata );
> + request->curlMoreBodyReceived( buffer, nitems );
> + return nitems;
> +}
> +
> +void CurlRequest::curlMoreBodyReceived( const char *buffer, size_t size )
> +{
> + if ( xOutputStream.is() )
> + {
> + const uno::Sequence< sal_Int8 > aDataSeq( (sal_Int8 *)buffer, size );
> + xOutputStream->writeBytes( aDataSeq );
> + }
> + else if ( responseBodyInputStream.is() )
> + responseBodyInputStream->AddToStream( buffer, size );
> +}
> \ No newline at end of file
> diff --git a/main/ucb/source/ucp/webdav/CurlRequest.hxx b/main/ucb/source/ucp/webdav/CurlRequest.hxx
> new file mode 100644
> index 0000000000..3c7093e0c6
> --- /dev/null
> +++ b/main/ucb/source/ucp/webdav/CurlRequest.hxx
> @@ -0,0 +1,130 @@
> +/**************************************************************
> + *
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *
> + *************************************************************/
> +
> +#ifndef INCLUDED_CURLREQUEST_HXX
> +#define INCLUDED_CURLREQUEST_HXX
> +
> +#include <vector>
> +#include "DAVException.hxx"
> +#include <com/sun/star/io/XOutputStream.hpp>
> +#include "CurlInputStream.hxx"
> +#include "CurlTypes.hxx"
> +#include "CurlUri.hxx"
> +#include <curl/curl.h>
> +
> +namespace http_dav_ucp
> +{
> +
> +/* Since Curl persists all settings for the duration of
> + * the CURL* structure, and we need some of them to only last for
> + * the duration of a request, use this class to reset the short-lived
> + * settings at the end of each request using RAII, and to capture
> + * some results in a convenient format.
> + *
> + * Features are opt-in to their non-default values.
> + *
> + * External pointers (CURL*, request body, etc.) are only shared with us,
> + * never copied, temporarily used by us, and never belong to us.
> + */
> +class CurlRequest
> +{
> +public:
> + class Header
> + {
> + public:
> + rtl::OString name;
> + rtl::OString value;
> + };
> +
> + CurlRequest( CURL *curl );
> + ~CurlRequest();
> +
> + // Request setup methods:
> + void addHeader( const rtl::OString &name, const rtl::OString &value ) throw (DAVException);
> + void setRequestBody( const char *body, size_t size );
> + bool isChunkedEncoding() { return useChunkedEncoding; }
> + void setChunkedEncoding( bool isChunkedEncoding ) { useChunkedEncoding = isChunkedEncoding; }
> + void saveResponseBodyTo( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xOutputStream );
> + void setProvideCredentialsCallback(
> + bool (*provideCredsCallback)(long statusCode, void *userdata) throw (DAVException),
> + void *credsUserdata );
> +
> + // Requests
> + CURLcode copy( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode delete_( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode get( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode head( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode lock( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode mkcol( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode move( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode post( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode propfind( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode proppatch( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode put( CurlUri uri, rtl::OUString path ) throw(DAVException);
> + CURLcode unlock( CurlUri uri, rtl::OUString path ) throw(DAVException);
> +
> + // Response methods:
> + int getStatusCode() { return statusCode; }
> + rtl::OString& getReasonPhrase() { return reasonPhrase; }
> + // TODO: a multimap would be O(n * log(m)) instead of O(n * m)
> + std::vector<Header>& getResponseHeaders() { return responseHeaders; }
> + const Header *findResponseHeader( const rtl::OString &name );
> + com::sun::star::uno::Reference < CurlInputStream > getResponseBody() { return responseBodyInputStream; }
> +
> +private:
> + CurlRequest( const CurlRequest &curlRequest ); // No copy constructor.
> + void setURI( CurlUri uri, rtl::OUString path ) throw (DAVException);
> + CURLcode perform() throw (DAVException);
> +
> + static int Curl_SeekCallback(void *userp, curl_off_t offset, int origin);
> +
> + static size_t Curl_SendMoreBody( char *buffer, size_t size, size_t nitems, void *userdata );
> + size_t curlSendMoreBody( char *buffer, size_t len );
> +
> + static size_t Curl_HeaderReceived( char *buffer, size_t size, size_t nitems, void *userdata );
> + void curlHeaderReceived( const char *buffer, size_t len );
> +
> + static size_t Curl_MoreBodyReceived( char *buffer, size_t size, size_t nitems, void *userdata );
> + void curlMoreBodyReceived( const char *buffer, size_t len );
> +
> + CURL *curl;
> + CURLU *curlUrl;
> +
> + // Request values:
> + curl_slist *requestHeaders;
> + const char *requestBody;
> + size_t requestBodyOffset;
> + size_t requestBodySize;
> + bool useChunkedEncoding;
> + bool (*provideCredentialsCallback)( long statusCode, void *userdata ) throw (DAVException);
> + void *provideCredentialsUserdata;
> +
> + // Response values:
> + rtl::OString reasonPhrase;
> + int statusCode;
> + std::vector<Header> responseHeaders;
> + com::sun::star::uno::Reference < CurlInputStream > responseBodyInputStream;
> + com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOutputStream;
> +};
> +
> +} // namespace http_dav_ucp
> +
> +#endif // INCLUDED_CURLREQUEST_HXX
> \ No newline at end of file
> diff --git a/main/ucb/source/ucp/webdav/CurlSession.cxx b/main/ucb/source/ucp/webdav/CurlSession.cxx
> new file mode 100644
> index 0000000000..5ca143273e
> --- /dev/null
> +++ b/main/ucb/source/ucp/webdav/CurlSession.cxx
> @@ -0,0 +1,1959 @@
> +/**************************************************************
> + *
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *
> + *************************************************************/
> +
> +
> +
> +// MARKER(update_precomp.py): autogen include statement, do not remove
> +#include "precompiled_webdav.hxx"
> +
> +#include <hash_map>
> +#include <vector>
> +#include <string.h>
> +#include <rtl/string.h>
> +#include <rtl/strbuf.hxx>
> +#include <rtl/ustrbuf.hxx>
> +#include <osl/time.h>
> +#include "comphelper/sequence.hxx"
> +#include "ucbhelper/simplecertificatevalidationrequest.hxx"
> +
> +#include "DAVAuthListener.hxx"
> +#include "CurlTypes.hxx"
> +#include "CurlSession.hxx"
> +#include "LockRequest.hxx"
> +#include "PropfindRequest.hxx"
> +#include "ProppatchRequest.hxx"
> +#include "CurlInputStream.hxx"
> +#include "UCBDeadPropertyValue.hxx"
> +#include "webdavuseragent.hxx"
> +#include "webdavresponseparser.hxx"
> +#include "webdavprovider.hxx"
> +
> +
> +#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
> +#include <com/sun/star/logging/LogLevel.hpp>
> +#include <com/sun/star/security/XCertificate.hpp>
> +#include <com/sun/star/security/CertificateValidity.hpp>
> +#include <com/sun/star/security/CertificateContainerStatus.hpp>
> +#include <com/sun/star/security/CertificateContainer.hpp>
> +#include <com/sun/star/security/XCertificateContainer.hpp>
> +#include <com/sun/star/security/CertAltNameEntry.hpp>
> +#include <com/sun/star/security/XSanExtension.hpp>
> +#include <com/sun/star/ucb/Lock.hpp>
> +#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
> +
> +using namespace com::sun::star;
> +using namespace com::sun::star::logging;
> +using namespace http_dav_ucp;
> +
> +#define OID_SUBJECT_ALTERNATIVE_NAME "2.5.29.17"
> +
> +struct CredentialsData
> +{
> + CredentialsData( CurlSession *curlSession, CurlRequest &curlRequest, const DAVRequestEnvironment &requestEnvironment )
> + : session( curlSession)
> + , request( curlRequest )
> + , env( requestEnvironment )
> + {}
> +
> + CurlSession *session;
> + CurlRequest &request;
> + const DAVRequestEnvironment &env;
> +};
> +
> +// -------------------------------------------------------------------
> +// static members!
> +CurlLockStore CurlSession::m_aCurlLockStore;
> +
> +
> +// -------------------------------------------------------------------
> +// Constructor
> +// -------------------------------------------------------------------
> +CurlSession::CurlSession(
> + const rtl::Reference< DAVSessionFactory > & rSessionFactory,
> + const rtl::OUString& inUri,
> + const ucbhelper::InternetProxyDecider & rProxyDecider )
> + throw ( DAVException )
> + : DAVSession( rSessionFactory )
> + , m_aMutex()
> + , m_aContext( m_xFactory->getServiceFactory() )
> + , m_aLogger( m_aContext.getUNOContext(), WEBDAV_CONTENT_PROVIDER_SERVICE_NAME )
> + , m_aUri( inUri )
> + , m_aProxyName()
> + , m_nProxyPort( 0 )
> + , m_aServerHeaderField()
> + , m_pCurl( 0 )
> + , m_bUseChunkedEncoding( false )
> + , m_bTransferEncodingSwitched( false )
> + , m_rProxyDecider( rProxyDecider )
> + , m_aEnv()
> +{
> + m_pCurl = curl_easy_init();
> +
> + curl_easy_setopt( m_pCurl, CURLOPT_HTTPAUTH, CURLAUTH_ANY );
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXYAUTH, CURLAUTH_ANY );
> +
> + curl_easy_setopt( m_pCurl, CURLOPT_SSL_CTX_FUNCTION, Curl_SSLContextCallback );
> + curl_easy_setopt( m_pCurl, CURLOPT_SSL_CTX_DATA, this );
> +
> + if ( m_aLogger.getLogLevel() == LogLevel::FINEST )
> + {
> + curl_easy_setopt( m_pCurl, CURLOPT_DEBUGFUNCTION, Curl_DebugCallback );
> + curl_easy_setopt( m_pCurl, CURLOPT_DEBUGDATA, this );
> + curl_easy_setopt( m_pCurl, CURLOPT_VERBOSE, 1L);
> + }
> + m_aLogger.log( LogLevel::INFO, "CurlSession::CurlSession with URL $1$",
> + rtl::OUStringToOString( inUri, RTL_TEXTENCODING_UTF8 ).getStr() );
> +}
> +
> +// -------------------------------------------------------------------
> +// Destructor
> +// -------------------------------------------------------------------
> +CurlSession::~CurlSession( )
> +{
> + if ( m_pCurl )
> + {
> + curl_easy_cleanup( m_pCurl );
> + m_pCurl = 0;
> + m_aLogger.log( LogLevel::INFO, "CurlSession::~CurlSession: closed curl session");
> + }
> +}
> +
> +// -------------------------------------------------------------------
> +void CurlSession::Init( const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> + m_aEnv = rEnv;
> + Init();
> +}
> +
> +// -------------------------------------------------------------------
> +void CurlSession::Init()
> + throw ( DAVException )
> +{
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + const sal_Char *url = rtl::OUStringToOString( m_aUri.GetURI(), RTL_TEXTENCODING_UTF8 ).getStr();
> + CURLcode rc;
> + rc = curl_easy_setopt( m_pCurl, CURLOPT_URL, url );
> + if ( rc != CURLE_OK )
> + throw DAVException( DAVException::DAV_SESSION_CREATE,
> + CurlUri::makeConnectionEndPointString( m_aUri.GetHost(), m_aUri.GetPort() ) );
> +
> + const ucbhelper::InternetProxyServer & rProxyCfg = getProxySettings();
> + if ( ( rProxyCfg.aName != m_aProxyName )
> + || ( rProxyCfg.nPort != m_nProxyPort ) )
> + {
> + m_aProxyName = rProxyCfg.aName;
> + m_nProxyPort = rProxyCfg.nPort;
> + if ( !m_aProxyName.isEmpty() )
> + {
> + m_aLogger.log( LogLevel::INFO, "Using $1$ proxy server at $2$:$3$",
> + m_aUri.GetScheme(), m_aProxyName, m_nProxyPort );
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXY, rtl::OUStringToOString( m_aProxyName, RTL_TEXTENCODING_UTF8 ).getStr() );
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXYPORT, (long)m_nProxyPort );
> + if ( m_aUri.GetScheme().equalsAscii( "https" ) )
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS );
> + else
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
> + // no other proxy types are implemented by AOO
> + }
> + else
> + {
> + // Empty string as opposed to NULL, means don't use the default curl proxy.
> + m_aLogger.log( LogLevel::INFO, "Not using a proxy server" );
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXY, "" );
> + }
> + // if we change the proxy settings, clear the credentials for the previous proxy too
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXYUSERNAME, "" );
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXYPASSWORD, "" );
> + }
> +}
> +
> +bool CurlSession::isSSLNeeded()
> +{
> + return m_aUri.GetScheme().equalsIgnoreAsciiCase( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "https" ) ) );
> +}
> +
> +// -------------------------------------------------------------------
> +// helper function
> +// it composes the uri for lockstore registration
> +rtl::OUString CurlSession::composeCurrentUri(const rtl::OUString & inPath)
> +{
> + rtl::OUString aScheme( m_aUri.GetScheme() );
> + rtl::OUStringBuffer aBuf( aScheme );
> + aBuf.appendAscii( "://" );
> + if ( m_aUri.GetUserName().getLength() > 0 )
> + {
> + aBuf.append( m_aUri.GetUserName() );
> + if ( m_aUri.GetPassword().getLength() > 0 )
> + {
> + aBuf.appendAscii( ":" );
> + aBuf.append( m_aUri.GetPassword() );
> + }
> + aBuf.appendAscii( "@" );
> + }
> + // Is host a numeric IPv6 address?
> + if ( ( m_aUri.GetHost().indexOf( ':' ) != -1 ) &&
> + ( m_aUri.GetHost()[ 0 ] != sal_Unicode( '[' ) ) )
> + {
> + aBuf.appendAscii( "[" );
> + aBuf.append( m_aUri.GetHost() );
> + aBuf.appendAscii( "]" );
> + }
> + else
> + {
> + aBuf.append( m_aUri.GetHost() );
> + }
> +
> + // append port, but only, if not default port.
> + bool bAppendPort = true;
> + sal_Int32 aPort = m_aUri.GetPort();
> + switch ( aPort )
> + {
> + case DEFAULT_HTTP_PORT:
> + bAppendPort = aScheme.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "http" ) );
> + break;
> +
> + case DEFAULT_HTTPS_PORT:
> + bAppendPort = !aScheme.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "https" ) );
> + break;
> + }
> + if ( bAppendPort )
> + {
> + aBuf.appendAscii( ":" );
> + aBuf.append( rtl::OUString::valueOf( aPort ) );
> + }
> + aBuf.append( inPath );
> +
> + rtl::OUString aUri(aBuf.makeStringAndClear() );
> + return aUri;
> +}
> +
> +// -------------------------------------------------------------------
> +// virtual
> +sal_Bool CurlSession::CanUse( const rtl::OUString & inUri )
> +{
> + try
> + {
> + CurlUri theUri( inUri );
> + if ( ( theUri.GetPort() == m_aUri.GetPort() ) &&
> + ( theUri.GetHost() == m_aUri.GetHost() ) &&
> + ( theUri.GetScheme() == m_aUri.GetScheme() ) )
> + {
> + return sal_True;
> + }
> + }
> + catch ( DAVException const & )
> + {
> + return sal_False;
> + }
> + return sal_False;
> +}
> +
> +// -------------------------------------------------------------------
> +// virtual
> +sal_Bool CurlSession::UsesProxy()
> +{
> + Init();
> + return ( m_aProxyName.getLength() > 0 );
> +}
> +
> +int CurlSession::Curl_DebugCallback( CURL *, curl_infotype type, unsigned char *data, size_t size, void* userdata )
> +{
> + CurlSession *session = static_cast< CurlSession* >( userdata );
> + return session->curlDebugOutput( type, reinterpret_cast<char*>( data ), size );
> +}
> +
> +int CurlSession::curlDebugOutput( curl_infotype type, char *data, int size )
> +{
> + const char *prefix;
> + switch ( type )
> + {
> + case CURLINFO_TEXT:
> + prefix = "[CurlINFO ]";
> + break;
> + case CURLINFO_HEADER_IN:
> + prefix = "[CurlHDR <-]";
> + break;
> + case CURLINFO_HEADER_OUT:
> + prefix = "[CurlHDR ->]";
> + break;
> + case CURLINFO_DATA_IN:
> + prefix = "[CurlData<-]";
> + break;
> + case CURLINFO_DATA_OUT:
> + prefix = "[CurlData->]";
> + break;
> + default:
> + return 0;
> + }
> +
> + // Trim the trailing \r\n
> + if ( size >= 1 && ( data[size - 1] == '\r' || data[size - 1] == '\n' ) )
> + --size;
> + if ( size >= 1 && ( data[size - 1] == '\r' || data[size - 1] == '\n' ) )
> + --size;
> + rtl::OString message( data, size );
> + m_aLogger.log( LogLevel::FINEST, "$1$ $2$", prefix, message );
> + return 0;
> +}
> +
> +CURLcode CurlSession::Curl_SSLContextCallback( CURL *, void *ssl_ctx, void *userptr )
> +{
> + CurlSession *session = static_cast<CurlSession*>( userptr );
> + SSL_CTX *context = static_cast<SSL_CTX*>( ssl_ctx );
> + SSL_CTX_set_app_data( context, session );
> + SSL_CTX_set_verify( context, SSL_VERIFY_PEER, OPENSSL_ValidateServerCertificate );
> + return CURLE_OK;
> +}
> +
> +int CurlSession::OPENSSL_ValidateServerCertificate( int preverify_ok, X509_STORE_CTX *x509_ctx )
> +{
> + SSL *ssl = static_cast<SSL*> (
> + X509_STORE_CTX_get_ex_data( x509_ctx, SSL_get_ex_data_X509_STORE_CTX_idx() ) );
> + SSL_CTX *ssl_ctx = SSL_get_SSL_CTX( ssl );
> + CurlSession *session = static_cast<CurlSession*>( SSL_CTX_get_app_data( ssl_ctx ) );
> + int verifyOk = session->validateServerX509Certificate( x509_ctx, preverify_ok );
> + // When a certificate's verification fails within OpenSSL, yet passes from the
> + // SSL_CTX_set_verify() callback (ie. this function) (by returning 1),
> + // OpenSSL allows the connection to proceed, yet stores that last verification
> + // error and allows it to be retrieved using SSL_get_verify_result(3).
> + //
> + // Unfortunately, Curl calls SSL_get_verify_result(3) internally, and treats
> + // errors as terminal, disconnecting with an error even when we return 1 here.
> + // Therefore, to approve a certificate that OpenSSL would reject, we have to
> + // both return 1, and overwrite the X509_STORE_CTX's last error with X509_V_OK:
> + if ( verifyOk )
> + X509_STORE_CTX_set_error( x509_ctx, X509_V_OK );
> + return verifyOk;
> +}
> +
> +static uno::Sequence< sal_Int8 > convertCertificateToAsn1Der( X509 *certificate )
> +{
> + uno::Sequence< sal_Int8 > asn1DerCertificate;
> + int len = i2d_X509( certificate, NULL );
> + if ( len < 0 )
> + return asn1DerCertificate;
> + asn1DerCertificate.realloc( len );
> + unsigned char *end = reinterpret_cast< unsigned char *>( asn1DerCertificate.getArray() );
> + len = i2d_X509( certificate, &end );
> + if ( len >= 0 )
> + return asn1DerCertificate;
> + else
> + return uno::Sequence< sal_Int8 >();
> +}
> +
> +int CurlSession::validateServerX509Certificate( X509_STORE_CTX *x509StoreContext, int verifyOk )
> +{
> + X509 *serverCertificate = X509_STORE_CTX_get_current_cert( x509StoreContext );
> + int depth = X509_STORE_CTX_get_error_depth( x509StoreContext );
> + STACK_OF(X509) *chain =
> +#if OPENSSL_VERSION_NUMBER >= 0x10100000L
> + X509_STORE_CTX_get0_chain( x509StoreContext );
> +#else
> + X509_STORE_CTX_get_chain( x509StoreContext );
> +#endif
> +
> + if ( depth == 0 ) {
> + std::vector< uno::Sequence< sal_Int8 > > asn1DerCertificates;
> + if ( chain != NULL ) {
> + int nCertificates = sk_X509_num( chain );
> + for ( int i = 0; i < nCertificates; i++ ) {
> + X509 *certificate = sk_X509_value( chain, i );
> + uno::Sequence< sal_Int8 > asn1DerCertificate = convertCertificateToAsn1Der( certificate );
> + if ( asn1DerCertificate.getLength() == 0 )
> + return 0;
> + asn1DerCertificates.push_back( asn1DerCertificate );
> + }
> + } else {
> + uno::Sequence< sal_Int8 > asn1DerCertificate = convertCertificateToAsn1Der( serverCertificate );
> + if ( asn1DerCertificate.getLength() == 0 )
> + return 0;
> + asn1DerCertificates.push_back( asn1DerCertificate );
> + }
> + verifyOk = verifyCertificateChain( asn1DerCertificates );
> + }
> + m_aLogger.log( LogLevel::FINE, "validateServerX509Certificate() returning $1$ at depth $2$",
> + (sal_Int32)verifyOk, (sal_Int32)depth );
> + return verifyOk;
> +}
> +
> +int CurlSession::verifyCertificateChain (
> + std::vector< uno::Sequence< sal_Int8 > > &asn1DerCertificates )
> +{
> + // Check arguments.
> + if (asn1DerCertificates.size()<=0)
> + {
> + OSL_ASSERT(asn1DerCertificates.size()>0);
> + return 0;
> + }
> +
> + // Create some crypto objects to decode and handle the base64
> + // encoded certificate chain.
> + uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
> + uno::Reference< security::XCertificateContainer > xCertificateContainer;
> + uno::Reference< xml::crypto::XXMLSecurityContext > xSecurityContext;
> + uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv;
> + try
> + {
> + // Create a certificate container.
> + xCertificateContainer = uno::Reference< security::XCertificateContainer >(
> + getMSF()->createInstance(
> + rtl::OUString::createFromAscii(
> + "com.sun.star.security.CertificateContainer" ) ),
> + uno::UNO_QUERY_THROW);
> +
> + xSEInitializer = uno::Reference< xml::crypto::XSEInitializer >(
> + getMSF()->createInstance(
> + rtl::OUString::createFromAscii( "com.sun.star.xml.crypto.SEInitializer" ) ),
> + uno::UNO_QUERY_THROW);
> +
> + xSecurityContext = xSEInitializer->createSecurityContext( rtl::OUString() );
> + if (xSecurityContext.is())
> + xSecurityEnv = xSecurityContext->getSecurityEnvironment();
> +
> + if ( ! xSecurityContext.is() || ! xSecurityEnv.is())
> + {
> + // Do we have to dispose xSEInitializer or xCertificateContainer?
> + m_aLogger.log( LogLevel::WARNING, "Failure creating security services for certificate verification" );
> + return 0;
> + }
> + }
> + catch ( uno::Exception const &e)
> + {
> + m_aLogger.log( LogLevel::WARNING, "Error creating security services: $1$", e.Message );
> + return 0;
> + }
> +
> + // Decode the server certificate.
> + uno::Reference< security::XCertificate > xServerCertificate(
> + xSecurityEnv->createCertificateFromRaw( asn1DerCertificates[0] ) );
> + if ( ! xServerCertificate.is())
> + {
> + m_aLogger.log( LogLevel::WARNING, "Failed to create XCertificate" );
> + return 0;
> + }
> +
> + // Get the subject from the server certificate.
> + ::rtl::OUString sServerCertificateSubject (xServerCertificate->getSubjectName());
> + sal_Int32 nIndex = 0;
> + while (nIndex >= 0)
> + {
> + const ::rtl::OUString sToken (sServerCertificateSubject.getToken(0, ',', nIndex));
> + if (sToken.compareToAscii("CN=", 3) == 0)
> + {
> + sServerCertificateSubject = sToken.copy(3);
> + break;
> + }
> + else if (sToken.compareToAscii(" CN=", 4) == 0)
> + {
> + sServerCertificateSubject = sToken.copy(4);
> + break;
> + }
> + }
> +
> + // When the certificate container already contains a (trusted)
> + // entry for the server then we do not have to authenticate any
> + // certificate.
> + const security::CertificateContainerStatus eStatus (
> + xCertificateContainer->hasCertificate(
> + getHostName(), sServerCertificateSubject ) );
> + if (eStatus != security::CertificateContainerStatus_NOCERT)
> + {
> + m_aLogger.log( LogLevel::FINER, "Cached certificate found with status=$1$",
> + eStatus == security::CertificateContainerStatus_TRUSTED ? "trusted" : "untrusted" );
> + return eStatus == security::CertificateContainerStatus_TRUSTED
> + ? 1
> + : 0;
> + }
> +
> + // The shortcut failed, so try to verify the whole chain. This is
> + // done outside the isDomainMatch() block because the result is
> + // used by the interaction handler.
> + std::vector< uno::Reference< security::XCertificate > > aChain;
> + for (nIndex=0; nIndex < asn1DerCertificates.size(); ++nIndex)
> + {
> + uno::Reference< security::XCertificate > xCertificate(
> + xSecurityEnv->createCertificateFromRaw( asn1DerCertificates[ nIndex ] ) );
> + if ( ! xCertificate.is())
> + {
> + m_aLogger.log( LogLevel::FINE, "Failed to create XCertificate $1$", nIndex );
> + return 0;
> + }
> + aChain.push_back(xCertificate);
> + }
> + const sal_Int64 nVerificationResult (xSecurityEnv->verifyCertificate(
> + xServerCertificate,
> + ::comphelper::containerToSequence(aChain)));
> +
> + // When the certificate matches the host name then we can use the
> + // result of the verification.
> + bool bHostnameMatchesCertHostnames = false;
> + {
> + uno::Sequence< uno::Reference< security::XCertificateExtension > > extensions = xServerCertificate->getExtensions();
> + uno::Sequence< security::CertAltNameEntry > altNames;
> + for (sal_Int32 i = 0 ; i < extensions.getLength(); ++i)
> + {
> + uno::Reference< security::XCertificateExtension >element = extensions[i];
> +
> + const rtl::OString aId ( (const sal_Char *)element->getExtensionId().getArray(), element->getExtensionId().getLength());
> + if ( aId.equals( OID_SUBJECT_ALTERNATIVE_NAME ) )
> + {
> + uno::Reference< security::XSanExtension > sanExtension ( element, uno::UNO_QUERY );
> + altNames = sanExtension->getAlternativeNames();
> + break;
> + }
> + }
> +
> + uno::Sequence< ::rtl::OUString > certHostNames(altNames.getLength() + 1);
> + certHostNames[0] = sServerCertificateSubject;
> + for( int n = 0; n < altNames.getLength(); ++n )
> + {
> + if (altNames[n].Type == security::ExtAltNameType_DNS_NAME)
> + {
> + altNames[n].Value >>= certHostNames[n+1];
> + }
> + }
> +
> + for ( int i = 0; i < certHostNames.getLength() && !bHostnameMatchesCertHostnames; ++i )
> + {
> + bHostnameMatchesCertHostnames = isDomainMatch( certHostNames[i] );
> + }
> +
> + }
> + m_aLogger.log( LogLevel::FINE, "URL hostname $1$ certificate hostname",
> + bHostnameMatchesCertHostnames ? "matches" : "DOESN'T MATCH" );
> + if ( bHostnameMatchesCertHostnames )
> + {
> + if (nVerificationResult == 0)
> + {
> + m_aLogger.log( LogLevel::FINE, "Certificate (chain) is valid" );
> + xCertificateContainer->addCertificate(getHostName(), sServerCertificateSubject, sal_True);
> + return 1;
> + }
> + else if ((nVerificationResult & security::CertificateValidity::CHAIN_INCOMPLETE) != 0)
> + {
> + // We do not have enough information for verification,
> + // neither automatically (as we just discovered) nor
> + // manually (so there is no point in showing any dialog.)
> + m_aLogger.log( LogLevel::WARNING, "Certificate (chain) is incomplete" );
> + return 0;
> + }
> + else if ((nVerificationResult & security::CertificateValidity::REVOKED) != 0)
> + {
> + // Certificate (chain) is invalid.
> + m_aLogger.log( LogLevel::WARNING, "Certificate (chain) is revoked" );
> + xCertificateContainer->addCertificate(getHostName(), sServerCertificateSubject, sal_False);
> + return 0;
> + }
> + else
> + {
> + // For all other we have to ask the user.
> + m_aLogger.log( LogLevel::FINE, "Promping user to validate the certificate" );
> + }
> + }
> +
> + // We have not been able to automatically verify (or falsify) the
> + // certificate chain. To resolve this we have to ask the user.
> + const uno::Reference< ucb::XCommandEnvironment > xEnv( getRequestEnvironment().m_xEnv );
> + if ( xEnv.is() )
> + {
> + uno::Reference< task::XInteractionHandler > xIH( xEnv->getInteractionHandler() );
> + if ( xIH.is() )
> + {
> + rtl::Reference< ucbhelper::SimpleCertificateValidationRequest >
> + xRequest( new ucbhelper::SimpleCertificateValidationRequest(
> + static_cast<sal_Int32>(nVerificationResult), xServerCertificate, getHostName() ) );
> + xIH->handle( xRequest.get() );
> +
> + rtl::Reference< ucbhelper::InteractionContinuation > xSelection
> + = xRequest->getSelection();
> +
> + if ( xSelection.is() )
> + {
> + uno::Reference< task::XInteractionApprove > xApprove( xSelection.get(), uno::UNO_QUERY );
> + if ( xApprove.is() )
> + {
> + m_aLogger.log( LogLevel::FINE, "The user approved the certificate" );
> + xCertificateContainer->addCertificate( getHostName(), sServerCertificateSubject, sal_True );
> + return 1;
> + }
> + else
> + {
> + // Don't trust cert
> + m_aLogger.log( LogLevel::FINE, "The user REJECTED the certificate" );
> + xCertificateContainer->addCertificate( getHostName(), sServerCertificateSubject, sal_False );
> + return 0;
> + }
> + }
> + }
> + else
> + {
> + // Don't trust cert
> + m_aLogger.log( LogLevel::WARNING, "Couldn't create the interaction handler for user feedback, rejecting the certificate" );
> + xCertificateContainer->addCertificate( getHostName(), sServerCertificateSubject, sal_False );
> + return 0;
> + }
> + }
> + m_aLogger.log( LogLevel::WARNING, "No XCommandEnvironment, rejecting the certificate" );
> +
> + return 0;
> +}
> +
> +bool CurlSession::Curl_ProvideCredentials( long statusCode, void *userdata ) throw (DAVException)
> +{
> + CredentialsData *credentialsData = (CredentialsData*)userdata;
> + return credentialsData->session->provideCredentials( credentialsData->env, credentialsData->request, statusCode );
> +}
> +
> +bool CurlSession::provideCredentials( const DAVRequestEnvironment &env, CurlRequest &request, long statusCode ) throw (DAVException)
> +{
> + DAVAuthListener * pListener = env.m_xAuthListener.get();
> + if ( !pListener )
> + {
> + // abort
> + m_aLogger.log( LogLevel::FINE, "No DAVAuthListener found, failing credentials entry" );
> + return false;
> + }
> +
> + rtl::OUString theUserName;
> + rtl::OUString thePassWord;
> + try
> + {
> + CurlUri uri( env.m_aRequestURI );
> + theUserName = uri.GetUserName();
> + thePassWord = uri.GetPassword();
> + }
> + catch ( DAVException const &e )
> + {
> + // abort
> + m_aLogger.log(
> + LogLevel::WARNING,
> + "Error extracing userinfo from URI: exceptionCode=$1$, status=$2$, data=$3$, owner=$4$, extendedError=$5%",
> + (sal_Int32)e.getError(), e.getStatus(), e.getData(), e.getOwner(), e.getExtendedError()
> + );
> + return false;
> + }
> +
> + bool canUseSystemCreds = false;
> + long authMethods = 0;
> + CURLcode rc = CURLE_OK;
> + if ( statusCode == 401 )
> + rc = curl_easy_getinfo( m_pCurl, CURLINFO_HTTPAUTH_AVAIL, &authMethods );
> + else if ( statusCode == 407 )
> + rc = curl_easy_getinfo( m_pCurl, CURLINFO_PROXYAUTH_AVAIL, &authMethods );
> + if ( rc == 0 )
> + canUseSystemCreds = (authMethods & CURLAUTH_NEGOTIATE) || (authMethods & CURLAUTH_NTLM);
> + m_aLogger.log( LogLevel::FINE, "authMethods=$1$, canUseSystemCreds=$2$",
> + (sal_Int64)authMethods, (sal_Int32)canUseSystemCreds );
> +
> + const CurlRequest::Header *authHeader = NULL;
> + if ( statusCode == 401 )
> + authHeader = request.findResponseHeader( "WWW-Authenticate" );
> + else if ( statusCode == 407 )
> + authHeader = request.findResponseHeader( "Proxy-Authenticate" );
> + rtl::OUString realm;
> + if ( authHeader != NULL )
> + {
> + int realmStart = authHeader->value.indexOf( "realm=\"" );
> + if ( realmStart >= 0 )
> + {
> + realmStart += 7;
> + int realmEnd = authHeader->value.indexOf( "\"", realmStart );
> + if ( realmEnd > 0 )
> + realm = rtl::OStringToOUString( authHeader->value.copy( realmStart, realmEnd - realmStart ), RTL_TEXTENCODING_UTF8 );
> + }
> + }
> +
> + int theRetVal = pListener->authenticate( realm,
> + getHostName(),
> + theUserName,
> + thePassWord,
> + canUseSystemCreds,
> + // Authenticating with both the proxy
> + // and the destination server requires sal_True here,
> + // and needs filling out 2 x password dialogs.
> + sal_True );
> +
> + if ( theRetVal == 0 )
> + {
> + m_aLogger.log( LogLevel::FINEST, "got credentials for user=$1$ on realm=$2$", theUserName, realm );
> + // "System credentials" means username and password are empty
> + const char *curlUsername = NULL;
> + const char *curlPassword = NULL;
> + if ( !theUserName.isEmpty() )
> + curlUsername = rtl::OUStringToOString( theUserName, RTL_TEXTENCODING_UTF8 ).getStr();
> + if ( !thePassWord.isEmpty() )
> + curlPassword = rtl::OUStringToOString( thePassWord, RTL_TEXTENCODING_UTF8 ).getStr();
> + if ( statusCode == 401 )
> + {
> + curl_easy_setopt( m_pCurl, CURLOPT_USERNAME, curlUsername );
> + curl_easy_setopt( m_pCurl, CURLOPT_PASSWORD, curlPassword );
> + }
> + else
> + {
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXYUSERNAME, curlUsername );
> + curl_easy_setopt( m_pCurl, CURLOPT_PROXYPASSWORD, curlPassword );
> + }
> + return true;
> + }
> + m_aLogger.log( LogLevel::WARNING, "credentials entry cancelled or failed" );
> +
> + return false;
> +}
> +
> +void CurlSession::addEnvironmentRequestHeaders( CurlRequest &curlRequest, const DAVRequestEnvironment &env )
> + throw ( DAVException )
> +{
> + bool bHasUserAgent( false );
> + DAVRequestHeaders::const_iterator aHeaderIter( env.m_aRequestHeaders.begin() );
> + const DAVRequestHeaders::const_iterator aEnd( env.m_aRequestHeaders.end() );
> +
> + while ( aHeaderIter != aEnd )
> + {
> + const rtl::OString aHeader = rtl::OUStringToOString( aHeaderIter->first,
> + RTL_TEXTENCODING_UTF8 );
> + const rtl::OString aValue = rtl::OUStringToOString( aHeaderIter->second,
> + RTL_TEXTENCODING_UTF8 );
> +
> + if ( !bHasUserAgent )
> + bHasUserAgent = aHeaderIter->first.equalsAsciiL(
> + RTL_CONSTASCII_STRINGPARAM( "User-Agent" ) );
> +
> + curlRequest.addHeader( aHeader, aValue );
> +
> + ++aHeaderIter;
> + }
> +
> + if ( !bHasUserAgent )
> + {
> + const rtl::OUString &rUserAgent = WebDAVUserAgent::get();
> + curlRequest.addHeader( "User-Agent", rtl::OUStringToOString( rUserAgent, RTL_TEXTENCODING_UTF8 ) );
> + }
> +}
> +
> +void CurlSession::processResponse( CurlRequest &curlRequest, CURLcode curlCode )
> + throw( DAVException )
> +{
> + long statusCode = 0;
> + CURLcode curlRes;
> + curlRes = curl_easy_getinfo( m_pCurl, CURLINFO_RESPONSE_CODE, &statusCode );
> + if ( curlRes != 0 || statusCode == 0 )
> + statusCode = curlRequest.getStatusCode();
> +
> + // check header according:
> + // http://tools.ietf.org/html/rfc7231#section-7.4.2
> + // need to do this so we can adjust the protocol accordingly
> + const CurlRequest::Header *server = curlRequest.findResponseHeader( "server" );
> + if ( server != NULL )
> + m_aServerHeaderField = server->value;
> +
> + if ( curlCode != 0 )
> + {
> + m_aLogger.log( LogLevel::WARNING, "Curl request failed with CURLcode $1$", (sal_Int64)curlCode );
> + throw DAVException( DAVException::DAV_HTTP_LOOKUP,
> + CurlUri::makeConnectionEndPointString( getHostName(),
> + getPort() ) );
> + }
> +
> + rtl::OUString reasonPhrase = rtl::OStringToOUString( curlRequest.getReasonPhrase(), RTL_TEXTENCODING_UTF8 );
> + if ( statusCode != 0 && statusCode / 100 != 2 )
> + {
> + switch (statusCode)
> + {
> + case SC_MOVED_PERMANENTLY: // 301
> + case SC_MOVED_TEMPORARILY: // 302
> + case SC_SEE_OTHER: // 303
> + case SC_TEMPORARY_REDIRECT: // 307
> + {
> + // new location for certain redirections
> +
> + const CurlRequest::Header *location = curlRequest.findResponseHeader( "location" );
> + if ( location != NULL )
> + {
> + m_aLogger.log( LogLevel::FINE, "HTTP $1$ response with new location = $2$",
> + statusCode, location->value );
> + throw DAVException( DAVException::DAV_HTTP_REDIRECT,
> + rtl::OStringToOUString( location->value, RTL_TEXTENCODING_UTF8 ) );
> + }
> + break;
> + }
> + case SC_UNAUTHORIZED: // 401
> + case SC_PROXY_AUTHENTICATION_REQUIRED: // 407
> + {
> + throw DAVException( DAVException::DAV_HTTP_ERROR,
> + reasonPhrase,
> + statusCode );
> + break;
> + }
> + case SC_REQUEST_ENTITY_TOO_LARGE: // 413
> + {
> + if ( m_bTransferEncodingSwitched )
> + throw DAVException( DAVException::DAV_HTTP_ERROR,
> + reasonPhrase,
> + statusCode );
> + m_bTransferEncodingSwitched = true;
> + curlRequest.setChunkedEncoding( !curlRequest.isChunkedEncoding() );
> + break;
> + }
> + case SC_LOCKED: // 423
> + throw DAVException( DAVException::DAV_LOCKED,
> + reasonPhrase,
> + statusCode );
> + default:
> + throw DAVException( DAVException::DAV_HTTP_ERROR,
> + reasonPhrase,
> + statusCode );
> + }
> + }
> +}
> +
> +static void responseHeadersToDAVResource( const std::vector< CurlRequest::Header> &responseHeaders,
> + const std::vector< ::rtl::OUString > &inHeaderNames,
> + DAVResource &ioResource )
> +{
> + std::vector< CurlRequest::Header >::const_iterator it( responseHeaders.begin() );
> + const std::vector< CurlRequest::Header >::const_iterator end( responseHeaders.end() );
> + while ( it != end )
> + {
> + bool storeHeader = false;
> + if ( inHeaderNames.size() == 0 )
> + storeHeader = true;
> + else
> + {
> + std::vector< ::rtl::OUString >::const_iterator reqIt( inHeaderNames.begin() );
> + const std::vector< ::rtl::OUString >::const_iterator reqEnd( inHeaderNames.end() );
> + while ( reqIt != reqEnd )
> + {
> + // header names are case insensitive
> + if ( (*reqIt).equalsIgnoreAsciiCase( rtl::OStringToOUString( (*it).name, RTL_TEXTENCODING_UTF8 ) ) )
> + {
> + storeHeader = true;
> + break;
> + }
> + else
> + {
> + ++reqIt;
> + }
> + }
> + }
> +
> + if ( storeHeader )
> + {
> + DAVPropertyValue thePropertyValue;
> + thePropertyValue.IsCaseSensitive = false;
> + thePropertyValue.Name = rtl::OStringToOUString( (*it).name, RTL_TEXTENCODING_UTF8 );
> + thePropertyValue.Value <<= rtl::OStringToOUString( (*it).value, RTL_TEXTENCODING_UTF8 );
> + ioResource.properties.push_back( thePropertyValue );
> + }
> +
> + it++;
> + }
> +}
> +
> +// -------------------------------------------------------------------
> +// PROPFIND - allprop & named
> +// -------------------------------------------------------------------
> +
> +void CurlSession::propfind( CurlRequest &curlRequest,
> + const rtl::OUString &inPath,
> + const Depth inDepth,
> + const std::vector< ::rtl::OUString > * inPropNames,
> + const bool onlyPropertyNames,
> + const DAVRequestEnvironment & rEnv )
> +{
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + if ( inDepth == DAVZERO )
> + curlRequest.addHeader( "Depth", "0" );
> + else if ( inDepth == DAVONE )
> + curlRequest.addHeader( "Depth", "1" );
> + else if ( inDepth == DAVINFINITY )
> + curlRequest.addHeader( "Depth", "infinity" );
> +
> + rtl::OString xml = PropfindRequest::generatePROPFINDRequestBody( inPropNames, onlyPropertyNames );
> + if ( xml.getLength() > 0 )
> + {
> + curlRequest.addHeader( "Content-Type", "application/xml" );
> + curlRequest.setRequestBody( xml.getStr(), xml.getLength() );
> + }
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + CURLcode rc = curlRequest.propfind( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +}
> +
> +void CurlSession::PROPFIND( const rtl::OUString & inPath,
> + const Depth inDepth,
> + const std::vector< rtl::OUString > & inPropNames,
> + std::vector< DAVResource > & ioResources,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "PROPFIND line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + propfind( curlRequest, inPath, inDepth, &inPropNames, false, rEnv );
> +
> + const std::vector< DAVResource > rResources( parseWebDAVPropFindResponse( curlRequest.getResponseBody().get() ) );
> + std::vector< DAVResource > *pIoResources = &ioResources;
> + *pIoResources = rResources;
> +}
> +
> +// -------------------------------------------------------------------
> +// PROPFIND - propnames
> +// -------------------------------------------------------------------
> +void CurlSession::PROPFIND( const rtl::OUString & inPath,
> + const Depth inDepth,
> + std::vector< DAVResourceInfo > & ioResInfo,
> + const DAVRequestEnvironment & rEnv )
> + throw( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "PROPFIND line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + propfind( curlRequest, inPath, inDepth, NULL, true, rEnv );
> +
> + const std::vector< DAVResourceInfo > rResInfo( parseWebDAVPropNameResponse( curlRequest.getResponseBody().get() ) );
> + std::vector< DAVResourceInfo > *pIoResInfo = &ioResInfo;
> + *pIoResInfo = rResInfo;
> +}
> +
> +// -------------------------------------------------------------------
> +// PROPPATCH
> +// -------------------------------------------------------------------
> +void CurlSession::PROPPATCH( const rtl::OUString & inPath,
> + const std::vector< ProppatchValue > & inValues,
> + const DAVRequestEnvironment & rEnv )
> + throw( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "PROPPATCH line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + // check whether a lock on this resource is already owned
> + rtl::OUString aUri( composeCurrentUri( inPath ) );
> + ucb::Lock inLock;
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> + inLock = pLock->getLock();
> + }
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + rtl::OString xml = ProppatchRequest::generatePROPPATCHRequestBody( inValues );
> + if ( xml.getLength() > 0 )
> + {
> + curlRequest.addHeader( "Content-Type", "application/xml" );
> + curlRequest.setRequestBody( xml.getStr(), xml.getLength() );
> + }
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + CURLcode rc = curlRequest.proppatch( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +// HEAD
> +// -------------------------------------------------------------------
> +void CurlSession::HEAD( const ::rtl::OUString & inPath,
> + const std::vector< ::rtl::OUString > & inHeaderNames,
> + DAVResource & ioResource,
> + const DAVRequestEnvironment & rEnv )
> + throw( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "HEAD line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init(rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + ioResource.uri = inPath;
> + ioResource.properties.clear();
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + CURLcode rc = curlRequest.head( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> + responseHeadersToDAVResource( curlRequest.getResponseHeaders(), inHeaderNames, ioResource );
> +}
> +
> +// -------------------------------------------------------------------
> +// GET
> +// -------------------------------------------------------------------
> +uno::Reference< io::XInputStream >
> +CurlSession::GET( const rtl::OUString & inPath,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "GET line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + CURLcode rc = curlRequest.get( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +
> + return uno::Reference< io::XInputStream >( curlRequest.getResponseBody().get() );
> +}
> +
> +// -------------------------------------------------------------------
> +// GET
> +// -------------------------------------------------------------------
> +void CurlSession::GET( const rtl::OUString & inPath,
> + uno::Reference< io::XOutputStream > & ioOutputStream,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "GET line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + curlRequest.saveResponseBodyTo( ioOutputStream );
> + CURLcode rc = curlRequest.get( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +// GET
> +// -------------------------------------------------------------------
> +uno::Reference< io::XInputStream >
> +CurlSession::GET( const rtl::OUString & inPath,
> + const std::vector< ::rtl::OUString > & inHeaderNames,
> + DAVResource & ioResource,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "GET line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + CURLcode rc = curlRequest.get( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> + responseHeadersToDAVResource( curlRequest.getResponseHeaders(), inHeaderNames, ioResource );
> +
> + return uno::Reference< io::XInputStream >( curlRequest.getResponseBody().get() );
> +}
> +
> +
> +// -------------------------------------------------------------------
> +// GET
> +// -------------------------------------------------------------------
> +void CurlSession::GET( const rtl::OUString & inPath,
> + uno::Reference< io::XOutputStream > & ioOutputStream,
> + const std::vector< ::rtl::OUString > & inHeaderNames,
> + DAVResource & ioResource,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "GET line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + curlRequest.saveResponseBodyTo( ioOutputStream );
> + CURLcode rc = curlRequest.get( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> + responseHeadersToDAVResource( curlRequest.getResponseHeaders(), inHeaderNames, ioResource );
> +}
> +
> +// -------------------------------------------------------------------
> +// PUT
> +// -------------------------------------------------------------------
> +void CurlSession::PUT( const rtl::OUString & inPath,
> + const uno::Reference< io::XInputStream > & inInputStream,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "PUT line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + uno::Sequence< sal_Int8 > aDataToSend;
> + if ( !getDataFromInputStream( inInputStream, aDataToSend, false ) )
> + throw DAVException( DAVException::DAV_INVALID_ARG );
> + curlRequest.setRequestBody( reinterpret_cast< const char * >( aDataToSend.getConstArray() ),
> + aDataToSend.getLength() );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + // check whether a lock on this resource is already owned
> + rtl::OUString aUri( composeCurrentUri( inPath ) );
> + ucb::Lock inLock;
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> + inLock = pLock->getLock();
> + }
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + CURLcode rc = curlRequest.put( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +// POST
> +// -------------------------------------------------------------------
> +uno::Reference< io::XInputStream >
> +CurlSession::POST( const rtl::OUString & inPath,
> + const rtl::OUString & rContentType,
> + const rtl::OUString & rReferer,
> + const uno::Reference< io::XInputStream > & inInputStream,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "POST line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + uno::Sequence< sal_Int8 > aDataToSend;
> + if ( !getDataFromInputStream( inInputStream, aDataToSend, false ) )
> + throw DAVException( DAVException::DAV_INVALID_ARG );
> + curlRequest.setRequestBody( reinterpret_cast< const char * >( aDataToSend.getConstArray() ),
> + aDataToSend.getLength() );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + if ( !rContentType.isEmpty() )
> + curlRequest.addHeader( "Content-Type", rtl::OUStringToOString( rContentType, RTL_TEXTENCODING_UTF8 ).getStr() );
> + if ( !rReferer.isEmpty() )
> + curlRequest.addHeader( "Referer", rtl::OUStringToOString( rReferer, RTL_TEXTENCODING_UTF8 ).getStr() );
> +
> + // check whether a lock on this resource is already owned
> + rtl::OUString aUri( composeCurrentUri( inPath ) );
> + ucb::Lock inLock;
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> + inLock = pLock->getLock();
> + }
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + CURLcode rc = curlRequest.post( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> + return uno::Reference< io::XInputStream >( curlRequest.getResponseBody().get() );
> +}
> +
> +// -------------------------------------------------------------------
> +// POST
> +// -------------------------------------------------------------------
> +void CurlSession::POST( const rtl::OUString & inPath,
> + const rtl::OUString & rContentType,
> + const rtl::OUString & rReferer,
> + const uno::Reference< io::XInputStream > & inInputStream,
> + uno::Reference< io::XOutputStream > & oOutputStream,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "POST line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + uno::Sequence< sal_Int8 > aDataToSend;
> + if ( !getDataFromInputStream( inInputStream, aDataToSend, false ) )
> + throw DAVException( DAVException::DAV_INVALID_ARG );
> + curlRequest.setRequestBody( reinterpret_cast< const char * >( aDataToSend.getConstArray() ),
> + aDataToSend.getLength() );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + if ( !rContentType.isEmpty() )
> + curlRequest.addHeader( "Content-Type", rtl::OUStringToOString( rContentType, RTL_TEXTENCODING_UTF8 ).getStr() );
> + if ( !rReferer.isEmpty() )
> + curlRequest.addHeader( "Referer", rtl::OUStringToOString( rReferer, RTL_TEXTENCODING_UTF8 ).getStr() );
> +
> + // check whether a lock on this resource is already owned
> + rtl::OUString aUri( composeCurrentUri( inPath ) );
> + ucb::Lock inLock;
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> + inLock = pLock->getLock();
> + }
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + curlRequest.saveResponseBodyTo( oOutputStream );
> + CURLcode rc = curlRequest.post( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +// MKCOL
> +// -------------------------------------------------------------------
> +void CurlSession::MKCOL( const rtl::OUString & inPath,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "MKCOL line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + // check whether a lock on this resource is already owned
> + rtl::OUString aUri( composeCurrentUri( inPath ) );
> + ucb::Lock inLock;
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> + inLock = pLock->getLock();
> + }
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + CURLcode rc = curlRequest.mkcol( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +// COPY
> +// -------------------------------------------------------------------
> +void CurlSession::COPY( const rtl::OUString & inSourceURL,
> + const rtl::OUString & inDestinationURL,
> + const DAVRequestEnvironment & rEnv,
> + sal_Bool inOverWrite )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "COPY line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + curlRequest.addHeader( "Destination", rtl::OUStringToOString( inDestinationURL, RTL_TEXTENCODING_UTF8 ).getStr() );
> + curlRequest.addHeader( "Overwrite", inOverWrite? "T" : "F" );
> +
> + // check whether a lock on the destination resource is already owned
> + rtl::OUString aUri( composeCurrentUri( inDestinationURL ) );
> + ucb::Lock inLock;
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> + inLock = pLock->getLock();
> + }
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + CURLcode rc = curlRequest.copy( m_aUri, CurlUri( inSourceURL ).GetPath() );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +// MOVE
> +// -------------------------------------------------------------------
> +void CurlSession::MOVE( const rtl::OUString & inSourceURL,
> + const rtl::OUString & inDestinationURL,
> + const DAVRequestEnvironment & rEnv,
> + sal_Bool inOverWrite )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "MOVE line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + curlRequest.addHeader( "Destination", rtl::OUStringToOString( inDestinationURL, RTL_TEXTENCODING_UTF8 ).getStr() );
> + curlRequest.addHeader( "Overwrite", inOverWrite? "T" : "F" );
> +
> + // check whether a lock on the destination resource is already owned
> + rtl::OUString aUri( composeCurrentUri( inDestinationURL ) );
> + ucb::Lock inLock;
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> + inLock = pLock->getLock();
> + }
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + CURLcode rc = curlRequest.copy( m_aUri, CurlUri( inSourceURL ).GetPath() );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +// DESTROY
> +// -------------------------------------------------------------------
> +void CurlSession::DESTROY( const rtl::OUString & inPath,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "DESTROY line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + // check whether a lock on this resource is already owned
> + rtl::OUString aUri( composeCurrentUri( inPath ) );
> + ucb::Lock inLock;
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> + inLock = pLock->getLock();
> + }
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + CURLcode rc = curlRequest.delete_( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +
> +namespace
> +{
> + sal_Int32 lastChanceToSendRefreshRequest( TimeValue const & rStart,
> + sal_Int32 timeout )
> + {
> + TimeValue aEnd;
> + osl_getSystemTime( &aEnd );
> +
> + // Try to estimate a safe absolute time for sending the
> + // lock refresh request.
> + sal_Int32 lastChanceToSendRefreshRequest = DAVINFINITY;
> + if ( timeout != DAVINFINITY )
> + {
> + sal_Int32 calltime = aEnd.Seconds - rStart.Seconds;
> + if ( calltime <= timeout )
> + {
> + lastChanceToSendRefreshRequest
> + = aEnd.Seconds + timeout - calltime;
> + }
> + else
> + {
> + OSL_TRACE( "No chance to refresh lock before timeout!" );
> + }
> + }
> + return lastChanceToSendRefreshRequest;
> + }
> +
> +} // namespace
> +
> +// -------------------------------------------------------------------
> +// LOCK (set new lock)
> +// -------------------------------------------------------------------
> +void CurlSession::LOCK( const ::rtl::OUString & inPath,
> + ucb::Lock & inLock,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "LOCK line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + // before locking, search in the lock store if we already own a lock for this resource
> + // if present, return with exception DAV_LOCKED_SELF
> + rtl::OUString aUri( composeCurrentUri( inPath ) );
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( pLock )
> + {
> +// already present, meaning already locked by the same AOO session and already in the lockstore
> +// just return, nothing to do
> + return;
> + }
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + if ( inLock.Timeout == -1 )
> + curlRequest.addHeader( "Timeout", "Infinite" );
> + else
> + curlRequest.addHeader( "Timeout", "Second-" + rtl::OString::valueOf( inLock.Timeout ) );
> +
> + switch ( inLock.Depth )
> + {
> + //i126305 TODO investigate on this case...
> + case ucb::LockDepth_MAKE_FIXED_SIZE:
> +
> + case ucb::LockDepth_ZERO:
> + curlRequest.addHeader( "Depth", "0" );
> + break;
> + case ucb::LockDepth_ONE:
> + curlRequest.addHeader( "Depth", "1" );
> + break;
> + case ucb::LockDepth_INFINITY:
> + curlRequest.addHeader( "Depth", "infinity" );
> + break;
> + }
> +
> + rtl::OString xml = LockRequest::generateRequestBody( inLock );
> + curlRequest.addHeader( "Content-Type", "application/xml" );
> + curlRequest.setRequestBody( xml.getStr(), xml.getLength() );
> +
> + TimeValue startCall;
> + osl_getSystemTime( &startCall );
> +
> + CURLcode rc = curlRequest.lock( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +
> + // the returned property, a sequence of locks
> + // only the first is used
> + const DAVPropertyValue outLock( parseWebDAVLockResponse( curlRequest.getResponseBody().get() ) );
> + if(outLock.Name.compareToAscii(RTL_CONSTASCII_STRINGPARAM( "DAV:lockdiscovery" )) == 0 )
> + {
> + // got a lock, use only the first returned
> + uno::Sequence< ucb::Lock > aLocks;
> + outLock.Value >>= aLocks;
> + ucb::Lock aLock = aLocks[0];
> +
> + CurlLock* aNewLock = new CurlLock( aLock, aUri, inPath );
> + // add the store the new lock
> + m_aCurlLockStore.addLock(aNewLock,this,
> + lastChanceToSendRefreshRequest(
> + startCall, static_cast< sal_Int32 >(aLock.Timeout) ) );
> + }
> +}
> +
> +// -------------------------------------------------------------------
> +// LOCK (refresh existing lock from DAVResourceAccess)
> +// -------------------------------------------------------------------
> +sal_Int64 CurlSession::LOCK( const ::rtl::OUString & /*inPath*/,
> + sal_Int64 nTimeout,
> + const DAVRequestEnvironment & /*rEnv*/ )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "LOCK line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + return nTimeout;
> + /*
> + // Try to get the neon lock from lock store
> + CurlLock * theLock
> + = m_aCurlLockStore.findByUri( makeAbsoluteURL( inPath ) );
> + if ( !theLock )
> + throw DAVException( DAVException::DAV_NOT_LOCKED );
> +
> + Init( rEnv );
> +
> + // refresh existing lock.
> + theLock->timeout = static_cast< long >( nTimeout );
> +
> + TimeValue startCall;
> + osl_getSystemTime( &startCall );
> +
> + int theRetVal = ne_lock_refresh( m_pHttpSession, theLock );
> +
> + if ( theRetVal == NE_OK )
> + {
> + m_aCurlLockStore.updateLock( theLock,
> + lastChanceToSendRefreshRequest(
> + startCall, theLock->timeout ) );
> + }
> +
> + HandleError( theRetVal, inPath, rEnv );
> +
> + return theLock->timeout;
> + */
> +}
> +
> +// -------------------------------------------------------------------
> +// LOCK (refresh existing lock from CurlLockStore)
> +// -------------------------------------------------------------------
> +bool CurlSession::LOCK( CurlLock * pLock,
> + sal_Int32 & rlastChanceToSendRefreshRequest )
> +{
> + m_aLogger.log( LogLevel::INFO, "LOCK line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init();
> + CurlRequest curlRequest( m_pCurl );
> +
> + const ucb::Lock & inLock = pLock->getLock();
> + rtl::OUString inPath = pLock->getResourcePath();
> +
> + if ( inLock.Timeout == -1 )
> + curlRequest.addHeader( "Timeout", "Infinite" );
> + else
> + curlRequest.addHeader( "Timeout", "Second-" + rtl::OString::valueOf( inLock.Timeout ) );
> +
> + switch ( inLock.Depth )
> + {
> + //i126305 TODO investigate on this case...
> + case ucb::LockDepth_MAKE_FIXED_SIZE:
> +
> + case ucb::LockDepth_ZERO:
> + curlRequest.addHeader( "Depth", "0" );
> + break;
> + case ucb::LockDepth_ONE:
> + curlRequest.addHeader( "Depth", "1" );
> + break;
> + case ucb::LockDepth_INFINITY:
> + curlRequest.addHeader( "Depth", "infinity" );
> + break;
> + }
> +
> + if ( inLock.LockTokens.getLength() > 0 )
> + {
> + curlRequest.addHeader( "If",
> + ( "(<" + rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">)" ).getStr() );
> + }
> +
> + rtl::OString xml = LockRequest::generateRequestBody( inLock );
> + curlRequest.addHeader( "Content-Type", "application/xml" );
> + curlRequest.setRequestBody( xml.getStr(), xml.getLength() );
> +
> + TimeValue startCall;
> + osl_getSystemTime( &startCall );
> +
> + CURLcode rc = curlRequest.lock( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +
> + // the returned property, a sequence of locks
> + // only the first is used
> + const DAVPropertyValue outLock( parseWebDAVLockResponse( curlRequest.getResponseBody().get() ) );
> + uno::Sequence< ucb::Lock > aLocks;
> + outLock.Value >>= aLocks;
> + ucb::Lock aLock = aLocks[0];
> +
> + // if ok, update the lastchance refresh time in lock
> + rlastChanceToSendRefreshRequest
> + = lastChanceToSendRefreshRequest( startCall, static_cast< sal_Int32 >(aLock.Timeout) );
> +
> + return true;
> +}
> +
> +// -------------------------------------------------------------------
> +// UNLOCK called from external (DAVResourceAccess)
> +// -------------------------------------------------------------------
> +void CurlSession::UNLOCK( const ::rtl::OUString & inPath,
> + const DAVRequestEnvironment & rEnv )
> + throw ( DAVException )
> +{
> + m_aLogger.log( LogLevel::INFO, "UNLOCK line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + rtl::OUString aUri( composeCurrentUri( inPath ) );
> + CurlLock * pLock = m_aCurlLockStore.findByUri( aUri );
> + if ( !pLock )
> + {
> + throw DAVException( DAVException::DAV_NOT_LOCKED );
> + }
> +
> + Init( rEnv );
> + CurlRequest curlRequest( m_pCurl );
> +
> + addEnvironmentRequestHeaders( curlRequest, rEnv );
> +
> + CredentialsData credsData( this, curlRequest, rEnv );
> + curlRequest.setProvideCredentialsCallback( Curl_ProvideCredentials, &credsData );
> +
> + ucb::Lock inLock = pLock->getLock();
> + curlRequest.addHeader( "Lock-Token",
> + ( "<" + rtl::OUStringToOString( inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">" ).getStr() );
> +
> + // remove lock from lockstore
> + // so, if something goes wrong, we don't refresh it anymore
> + m_aCurlLockStore.removeLock( pLock );
> + delete pLock;
> +
> + CURLcode rc = curlRequest.unlock( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> +}
> +
> +// -------------------------------------------------------------------
> +// UNLOCK (called from CurlLockStore)
> +// -------------------------------------------------------------------
> +bool CurlSession::UNLOCK( CurlLock * pLock )
> +{
> + m_aLogger.log( LogLevel::INFO, "UNLOCK line $1$", (sal_Int32)__LINE__ );
> +
> + osl::Guard< osl::Mutex > theGuard( m_aMutex );
> +
> + Init();
> + CurlRequest curlRequest( m_pCurl );
> +
> + rtl::OUString inPath = pLock->getResourcePath();
> + ucb::Lock inLock = pLock->getLock();
> + curlRequest.addHeader( "Lock-Token",
> + ( "<" + rtl::OUStringToOString( inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ) + ">" ).getStr() );
> +
> + CURLcode rc = curlRequest.unlock( m_aUri, inPath );
> + processResponse( curlRequest, rc );
> + return true;
> +}
> +
> +// -------------------------------------------------------------------
> +void CurlSession::abort()
> + throw ( DAVException )
> +{
> + // 11.11.09 (tkr): The following code lines causing crashes if
> + // closing a ongoing connection. It turned out that this existing
> + // solution doesn't work in multi-threading environments.
> + // So I disabled them in 3.2. . Issue #73893# should fix it in OOo 3.3.
> + //if ( m_pHttpSession )
> + // ne_close_connection( m_pHttpSession );
> +}
> +
> +// -------------------------------------------------------------------
> +const ucbhelper::InternetProxyServer & CurlSession::getProxySettings() const
> +{
> + if ( m_aUri.GetScheme().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "http" ) ) ||
> + m_aUri.GetScheme().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "https" ) ) )
> + {
> + return m_rProxyDecider.getProxy( m_aUri.GetScheme(),
> + m_aUri.GetHost(),
> + m_aUri.GetPort() );
> + }
> + else
> + {
> + // TODO: figure out, if this case can occur
> + return m_rProxyDecider.getProxy( m_aUri.GetScheme(),
> + rtl::OUString() /* not used */,
> + -1 /* not used */ );
> + }
> +}
> +
> +/*
> +// -------------------------------------------------------------------
> +namespace {
> +
> +bool containsLocktoken( const uno::Sequence< ucb::Lock > & rLocks,
> + const char * token )
> +{
> + for ( sal_Int32 n = 0; n < rLocks.getLength(); ++n )
> + {
> + const uno::Sequence< rtl::OUString > & rTokens
> + = rLocks[ n ].LockTokens;
> + for ( sal_Int32 m = 0; m < rTokens.getLength(); ++m )
> + {
> + if ( rTokens[ m ].equalsAscii( token ) )
> + return true;
> + }
> + }
> + return false;
> +}
> +
> +} // namespace
> +*/
> +
> +// -------------------------------------------------------------------
> +// This method doesn't seem to be used.
> +// In any case the default behavior is to ask a lock with a life of 3 minutes
> +// it will then be refreshed automatically (see CurlLockStore class)
> +// In case of AOO crash the lock will expire by itself
> +bool CurlSession::removeExpiredLocktoken( const rtl::OUString & /*inURL*/,
> + const DAVRequestEnvironment & /*rEnv*/ )
> +{
> + return true;
> + /*
> + CurlLock * theLock = m_aCurlLockStore.findByUri( inURL );
> + if ( !theLock )
> + return false;
> +
> + // do a lockdiscovery to check whether this lock is still valid.
> + try
> + {
> + // @@@ Alternative: use ne_lock_discover() => less overhead
> +
> + std::vector< DAVResource > aResources;
> + std::vector< rtl::OUString > aPropNames;
> + aPropNames.push_back( DAVProperties::LOCKDISCOVERY );
> +
> + PROPFIND( rEnv.m_aRequestURI, DAVZERO, aPropNames, aResources, rEnv );
> +
> + if ( aResources.size() == 0 )
> + return false;
> +
> + std::vector< DAVPropertyValue >::const_iterator it
> + = aResources[ 0 ].properties.begin();
> + std::vector< DAVPropertyValue >::const_iterator end
> + = aResources[ 0 ].properties.end();
> +
> + while ( it != end )
> + {
> + if ( (*it).Name.equals( DAVProperties::LOCKDISCOVERY ) )
> + {
> + uno::Sequence< ucb::Lock > aLocks;
> + if ( !( (*it).Value >>= aLocks ) )
> + return false;
> +
> + if ( !containsLocktoken( aLocks, theLock->token ) )
> + {
> + // expired!
> + break;
> + }
> +
> + // still valid.
> + return false;
> + }
> + ++it;
> + }
> +
> + // No lockdiscovery prop in propfind result / locktoken not found
> + // in propfind result -> not locked
> + OSL_TRACE( "CurlSession::removeExpiredLocktoken: Removing "
> + " expired lock token for %s. token: %s",
> + rtl::OUStringToOString( inURL,
> + RTL_TEXTENCODING_UTF8 ).getStr(),
> + theLock->token );
> +
> + m_aCurlLockStore.removeLock( theLock );
> + ne_lock_destroy( theLock );
> + return true;
> + }
> + catch ( DAVException const & )
> + {
> + }
> + return false;
> + */
> +}
> +
> +// -------------------------------------------------------------------
> +// static
> +bool
> +CurlSession::getDataFromInputStream(
> + const uno::Reference< io::XInputStream > & xStream,
> + uno::Sequence< sal_Int8 > & rData,
> + bool bAppendTrailingZeroByte )
> +{
> + if ( xStream.is() )
> + {
> + uno::Reference< io::XSeekable > xSeekable( xStream, uno::UNO_QUERY );
> + if ( xSeekable.is() )
> + {
> + try
> + {
> + sal_Int32 nSize
> + = sal::static_int_cast<sal_Int32>(xSeekable->getLength());
> + sal_Int32 nRead
> + = xStream->readBytes( rData, nSize );
> +
> + if ( nRead == nSize )
> + {
> + if ( bAppendTrailingZeroByte )
> + {
> + rData.realloc( nSize + 1 );
> + rData[ nSize ] = sal_Int8( 0 );
> + }
> + return true;
> + }
> + }
> + catch ( io::NotConnectedException const & )
> + {
> + // readBytes
> + }
> + catch ( io::BufferSizeExceededException const & )
> + {
> + // readBytes
> + }
> + catch ( io::IOException const & )
> + {
> + // getLength, readBytes
> + }
> + }
> + else
> + {
> + try
> + {
> + uno::Sequence< sal_Int8 > aBuffer;
> + sal_Int32 nPos = 0;
> +
> + sal_Int32 nRead = xStream->readSomeBytes( aBuffer, 65536 );
> + while ( nRead > 0 )
> + {
> + if ( rData.getLength() < ( nPos + nRead ) )
> + rData.realloc( nPos + nRead );
> +
> + aBuffer.realloc( nRead );
> + rtl_copyMemory( (void*)( rData.getArray() + nPos ),
> + (const void*)aBuffer.getConstArray(),
> + nRead );
> + nPos += nRead;
> +
> + aBuffer.realloc( 0 );
> + nRead = xStream->readSomeBytes( aBuffer, 65536 );
> + }
> +
> + if ( bAppendTrailingZeroByte )
> + {
> + rData.realloc( nPos + 1 );
> + rData[ nPos ] = sal_Int8( 0 );
> + }
> + return true;
> + }
> + catch ( io::NotConnectedException const & )
> + {
> + // readBytes
> + }
> + catch ( io::BufferSizeExceededException const & )
> + {
> + // readBytes
> + }
> + catch ( io::IOException const & )
> + {
> + // readBytes
> + }
> + }
> + }
> + return false;
> +}
> +
> +// ---------------------------------------------------------------------
> +sal_Bool
> +CurlSession::isDomainMatch( rtl::OUString certHostName )
> +{
> + rtl::OUString hostName = getHostName();
> +
> + if (hostName.equalsIgnoreAsciiCase( certHostName ) )
> + return sal_True;
> +
> + if ( 0 == certHostName.indexOf( rtl::OUString::createFromAscii( "*" ) ) &&
> + hostName.getLength() >= certHostName.getLength() )
> + {
> + rtl::OUString cmpStr = certHostName.copy( 1 );
> +
> + if ( hostName.matchIgnoreAsciiCase(
> + cmpStr, hostName.getLength() - cmpStr.getLength() ) )
> + return sal_True;
> + }
> + return sal_False;
> +}
> diff --git a/main/ucb/source/ucp/webdav/SerfSession.hxx b/main/ucb/source/ucp/webdav/CurlSession.hxx
> similarity index 71%
> rename from main/ucb/source/ucp/webdav/SerfSession.hxx
> rename to main/ucb/source/ucp/webdav/CurlSession.hxx
> index 6d4438cb34..091b304324 100644
> --- a/main/ucb/source/ucp/webdav/SerfSession.hxx
> +++ b/main/ucb/source/ucp/webdav/CurlSession.hxx
> @@ -21,103 +21,103 @@
>
>
>
> -#ifndef INCLUDED_SERFSESSION_HXX
> -#define INCLUDED_SERFSESSION_HXX
> +#ifndef INCLUDED_CURLSESSION_HXX
> +#define INCLUDED_CURLSESSION_HXX
>
> #include <vector>
> #include <boost/shared_ptr.hpp>
> #include <osl/mutex.hxx>
> +#include <comphelper/componentcontext.hxx>
> +#include <comphelper/logging.hxx>
> #include "DAVResource.hxx"
> #include "DAVSession.hxx"
> -#include "SerfTypes.hxx"
> -#include "SerfLockStore.hxx"
> -#include "SerfUri.hxx"
> +#include "CurlTypes.hxx"
> +#include "CurlRequest.hxx"
> +#include "CurlLockStore.hxx"
> +#include "CurlUri.hxx"
> +#include "CurlInputStream.hxx"
> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
> +#include <curl/curl.h>
> +#include <openssl/ssl.h>
>
> namespace ucbhelper { class ProxyDecider; }
>
> namespace http_dav_ucp
> {
>
> -class SerfRequestProcessor;
> -
> // -------------------------------------------------------------------
> -// SerfSession
> -// A DAVSession implementation using the neon/expat library
> +// CurlSession
> +// A DAVSession implementation using the Curl library
> // -------------------------------------------------------------------
>
> -class SerfSession : public DAVSession
> +class CurlSession : public DAVSession
> {
> private:
> - osl::Mutex m_aMutex;
> + osl::Mutex m_aMutex;
> + ::comphelper::ComponentContext m_aContext;
> + ::comphelper::EventLogger m_aLogger;
> +
> + CurlUri m_aUri;
>
> - SerfUri m_aUri;
> -
> rtl::OUString m_aProxyName;
> sal_Int32 m_nProxyPort;
> // The server, according RFC7231
> // http://tools.ietf.org/html/rfc7231#section-7.4.2
> - rtl::OUString m_aServerHeaderField;
> -
> - SerfConnection* m_pSerfConnection;
> - serf_context_t* m_pSerfContext;
> - serf_bucket_alloc_t* m_pSerfBucket_Alloc;
> - bool m_bIsHeadRequestInProgress;
> + rtl::OString m_aServerHeaderField;
> +
> + CURL* m_pCurl;
> bool m_bUseChunkedEncoding;
> - sal_Int16 m_bNoOfTransferEncodingSwitches;
> + bool m_bTransferEncodingSwitched;
>
> const ucbhelper::InternetProxyDecider & m_rProxyDecider;
>
> DAVRequestEnvironment m_aEnv;
>
> - static SerfLockStore m_aSerfLockStore;
> + static CurlLockStore m_aCurlLockStore;
>
> - char* getHostinfo();
> bool isSSLNeeded();
>
> - SerfRequestProcessor* createReqProc( const rtl::OUString & inPath );
>
> rtl::OUString composeCurrentUri( const rtl::OUString & inPath );
> + void addEnvironmentRequestHeaders( CurlRequest &curlRequest,
> + const DAVRequestEnvironment &env )
> + throw ( DAVException );
> + void processResponse( CurlRequest &curlRequest,
> + CURLcode curlCode )
> + throw ( DAVException );
> +
> + static CURLcode Curl_SSLContextCallback( CURL *curl,
> + void *ssl_ctx,
> + void *userptr );
> + static int OPENSSL_ValidateServerCertificate( int preverify_ok,
> + X509_STORE_CTX *x509_ctx );
> + int validateServerX509Certificate( X509_STORE_CTX *x509StoreContext,
> + int preverifyOk );
> + int verifyCertificateChain (
> + std::vector< uno::Sequence< sal_Int8 > > &asn1DerCertificates );
> +
> + static int Curl_DebugCallback( CURL *,
> + curl_infotype type,
> + unsigned char *data,
> + size_t size,
> + void* userdata );
> + int curlDebugOutput( curl_infotype type, char *data, int size );
> +
> + static bool Curl_ProvideCredentials( long statusCode,
> + void *userdata ) throw (DAVException);
> + bool provideCredentials( const DAVRequestEnvironment &env,
> + CurlRequest &request,
> + long statusCode ) throw (DAVException);
>
> protected:
> - virtual ~SerfSession();
> + virtual ~CurlSession();
>
> public:
> - SerfSession( const rtl::Reference< DAVSessionFactory > & rSessionFactory,
> + CurlSession( const rtl::Reference< DAVSessionFactory > & rSessionFactory,
> const rtl::OUString& inUri,
> const ucbhelper::InternetProxyDecider & rProxyDecider )
> throw ( DAVException );
>
> - // Serf library callbacks
> - apr_status_t setupSerfConnection( apr_socket_t * inAprSocket,
> - serf_bucket_t **outSerfInputBucket,
> - serf_bucket_t **outSerfOutputBucket,
> - apr_pool_t* inAprPool );
> -
> - apr_status_t provideSerfCredentials( bool bGiveProvidedCredentialsASecondTry,
> - char ** outUsername,
> - char ** outPassword,
> - serf_request_t * inRequest,
> - int inCode,
> - const char *inAuthProtocol,
> - const char *inRealm,
> - apr_pool_t *inAprPool );
> -
> - apr_status_t verifySerfCertificateChain (
> - int nFailures,
> - const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded,
> - int nCertificateChainLength);
> -
> - serf_bucket_t* acceptSerfResponse( serf_request_t * inSerfRequest,
> - serf_bucket_t * inSerfStreamBucket,
> - apr_pool_t* inAprPool );
> -
> - // Serf-related data structures
> - apr_pool_t* getAprPool();
> - serf_bucket_alloc_t* getSerfBktAlloc();
> - serf_context_t* getSerfContext();
> - SerfConnection* getSerfConnection();
> -
> // DAVSession methods
> virtual sal_Bool CanUse( const ::rtl::OUString & inUri );
>
> @@ -156,8 +156,6 @@ public:
> const DAVRequestEnvironment & rEnv )
> throw ( DAVException );
>
> - bool isHeadRequestInProgress();
> -
> virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
> GET( const ::rtl::OUString & inPath,
> const DAVRequestEnvironment & rEnv )
> @@ -264,12 +262,10 @@ public:
>
> sal_Bool isDomainMatch( rtl::OUString certHostName );
>
> - const rtl::OUString & getServerHeaderField() { return m_aServerHeaderField; };
> -
> - void setServerHeaderField( rtl::OUString aServerHeaderField ) { m_aServerHeaderField = aServerHeaderField; };
> + const rtl::OString & getServerHeaderField() { return m_aServerHeaderField; };
>
> private:
> - friend class SerfLockStore;
> + friend class CurlLockStore;
>
> void Init( void )
> throw ( DAVException );
> @@ -277,24 +273,28 @@ private:
> void Init( const DAVRequestEnvironment & rEnv )
> throw ( DAVException );
>
> - void HandleError( boost::shared_ptr<SerfRequestProcessor> rReqProc )
> - throw ( DAVException );
> -
> const ucbhelper::InternetProxyServer & getProxySettings() const;
> +
> + void propfind( CurlRequest &curlRequest,
> + const rtl::OUString &inPath,
> + const Depth inDepth,
> + const std::vector< ::rtl::OUString > * propNames,
> + const bool onlyPropertyNames,
> + const DAVRequestEnvironment & rEnv );
>
> bool removeExpiredLocktoken( const rtl::OUString & inURL,
> const DAVRequestEnvironment & rEnv );
>
> - // refresh lock, called by SerfLockStore::refreshLocks
> - bool LOCK( SerfLock * pLock,
> + // refresh lock, called by CurlLockStore::refreshLocks
> + bool LOCK( CurlLock * pLock,
> sal_Int32 & rlastChanceToSendRefreshRequest );
>
> - // unlock, called by SerfLockStore::~SerfLockStore
> - bool UNLOCK( SerfLock * pLock );
> + // unlock, called by CurlLockStore::~CurlLockStore
> + bool UNLOCK( CurlLock * pLock );
>
> /*
> // low level GET implementation, used by public GET implementations
> - static int GET( SerfConnection * sess,
> + static int GET( CurlConnection * sess,
> const char * uri,
> //ne_block_reader reader,
> bool getheaders,
> @@ -302,14 +302,14 @@ private:
>
> // Buffer-based PUT implementation. Serf only has file descriptor-
> // based API.
> - static int PUT( SerfConnection * sess,
> + static int PUT( CurlConnection * sess,
> const char * uri,
> const char * buffer,
> size_t size );
>
> // Buffer-based POST implementation. Serf only has file descriptor-
> // based API.
> - int POST( SerfConnection * sess,
> + int POST( CurlConnection * sess,
> const char * uri,
> const char * buffer,
> //ne_block_reader reader,
> @@ -332,4 +332,4 @@ private:
>
> } // namespace http_dav_ucp
>
> -#endif // INCLUDED_SERFSESSION_HXX
> +#endif // INCLUDED_CURLSESSION_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfTypes.hxx b/main/ucb/source/ucp/webdav/CurlTypes.hxx
> similarity index 86%
> rename from main/ucb/source/ucp/webdav/SerfTypes.hxx
> rename to main/ucb/source/ucp/webdav/CurlTypes.hxx
> index 7b28225dd0..fb014106c8 100644
> --- a/main/ucb/source/ucp/webdav/SerfTypes.hxx
> +++ b/main/ucb/source/ucp/webdav/CurlTypes.hxx
> @@ -21,10 +21,9 @@
>
>
>
> -#ifndef INCLUDED_SERFTYPES_HXX
> -#define INCLUDED_SERFTYPES_HXX
> +#ifndef INCLUDED_CURLTYPES_HXX
> +#define INCLUDED_CURLTYPES_HXX
>
> -#include <serf.h>
> #include <com/sun/star/ucb/Lock.hpp>
> #include "DAVTypes.hxx"
> #include "DAVRequestEnvironment.hxx"
> @@ -34,9 +33,7 @@ using namespace com::sun::star;
> namespace http_dav_ucp
> {
>
> -typedef serf_connection_t SerfConnection;
> -
> -class SerfLock
> +class CurlLock
> {
> private:
> ucb::Lock mLock;
> @@ -45,7 +42,7 @@ private:
> // const DAVRequestEnvironment& mrRequestEnvironment;
> public:
>
> - SerfLock(const ucb::Lock inLock, rtl::OUString inUri, rtl::OUString inPath)
> + CurlLock(const ucb::Lock inLock, rtl::OUString inUri, rtl::OUString inPath)
> : mLock( inLock )
> , mResourceUri( inUri )
> , mPathStr( inPath )
> @@ -60,7 +57,7 @@ public:
> };
>
> // TODO, check if we need it later on
> -typedef struct { const char *nspace, *name; } SerfPropName;
> +typedef struct { const char *nspace, *name; } CurlPropName;
>
> };
> -#endif // INCLUDED_SERFTYPES_HXX
> +#endif // INCLUDED_CURLTYPES_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfUri.cxx b/main/ucb/source/ucp/webdav/CurlUri.cxx
> similarity index 54%
> rename from main/ucb/source/ucp/webdav/SerfUri.cxx
> rename to main/ucb/source/ucp/webdav/CurlUri.cxx
> index 43a26bd8c4..2d08fa63e7 100644
> --- a/main/ucb/source/ucp/webdav/SerfUri.cxx
> +++ b/main/ucb/source/ucp/webdav/CurlUri.cxx
> @@ -26,9 +26,10 @@
> #include <rtl/uri.hxx>
> #include <rtl/ustring.hxx>
> #include <rtl/ustrbuf.hxx>
> -#include "SerfUri.hxx"
> +#include "CurlUri.hxx"
> #include "DAVException.hxx"
> -#include "AprEnv.hxx"
> +
> +#include <curl/curl.h>
>
> #include "../inc/urihelper.hxx"
>
> @@ -54,43 +55,71 @@ inline bool matchIgnoreAsciiCase(rtl::OString const & rStr1,
> == 0;
> }
>
> +inline rtl::OUString getURLStringPart( const CURLU *curlUrl, CURLUPart part, unsigned int flags )
> +{
> + char *value = NULL;
> + CURLUcode rc = curl_url_get( const_cast<CURLU*>( curlUrl ), part, &value, flags );
> + if ( rc == CURLUE_OK )
> + {
> + rtl::OUString str = rtl::OStringToOUString( value, RTL_TEXTENCODING_UTF8 );
> + curl_free( value );
> + return str;
> + }
> + return rtl::OUString();
> }
>
> -SerfUri::SerfUri( const apr_uri_t * inUri )
> +}
> +
> +CurlUri::CurlUri( const CURLU * inUri )
> throw ( DAVException )
> - : mAprUri( *inUri )
> - , mURI()
> + : mURI()
> , mScheme()
> - , mUserInfo()
> + , mUserName()
> + , mPassword()
> , mHostName()
> , mPort()
> , mPath()
> {
> if ( inUri == 0 )
> throw DAVException( DAVException::DAV_INVALID_ARG );
> -
> - char * uri = apr_uri_unparse( apr_environment::AprEnv::getAprEnv()->getAprPool(), &mAprUri, 0 );
> -
> - if ( uri == 0 )
> + mCurlUri = curl_url_dup( const_cast<CURLU *>(inUri) );
> + if ( mCurlUri == NULL )
> + throw DAVException( DAVException::DAV_HTTP_ERROR,
> + rtl::OUString::createFromAscii( "Out of memory" ),
> + SC_INSUFFICIENT_STORAGE );
> +
> + char * uri;
> + CURLUcode rc = curl_url_get( mCurlUri, CURLUPART_URL, &uri, 0 );
> + if ( rc != CURLUE_OK )
> + {
> + curl_url_cleanup( mCurlUri );
> throw DAVException( DAVException::DAV_INVALID_ARG );
> + }
> + curl_free( uri );
>
> - init( &mAprUri );
> + init( mCurlUri );
>
> calculateURI();
> }
>
> -SerfUri::SerfUri( const rtl::OUString & inUri )
> +CurlUri::CurlUri( const rtl::OUString & inUri )
> throw ( DAVException )
> - : mAprUri()
> + : mCurlUri( 0 )
> , mURI()
> , mScheme()
> - , mUserInfo()
> + , mUserName()
> + , mPassword()
> , mHostName()
> - , mPort()
> + , mPort( 0 )
> , mPath()
> {
> if ( inUri.getLength() <= 0 )
> throw DAVException( DAVException::DAV_INVALID_ARG );
> + mCurlUri = curl_url();
> + if ( mCurlUri == NULL )
> + throw DAVException( DAVException::DAV_HTTP_ERROR,
> + rtl::OUString::createFromAscii( "Out of memory" ),
> + SC_INSUFFICIENT_STORAGE );
>
> // #i77023#
> rtl::OUString aEscapedUri( ucb_impl::urihelper::encodeURI( inUri ) );
> @@ -98,57 +127,112 @@ SerfUri::SerfUri( const rtl::OUString & inUri )
> rtl::OString theInputUri(
> aEscapedUri.getStr(), aEscapedUri.getLength(), RTL_TEXTENCODING_UTF8 );
>
> - if ( apr_uri_parse( apr_environment::AprEnv::getAprEnv()->getAprPool(),
> - theInputUri.getStr(), &mAprUri ) != APR_SUCCESS )
> + if ( curl_url_set( mCurlUri, CURLUPART_URL, theInputUri.getStr(), 0 ) != CURLUE_OK )
> {
> - throw DAVException( DAVException::DAV_INVALID_ARG );
> + // I kid you not:
> + // Sometimes, we are just given a URL's path part,
> + // and CREATING THE URL ABSOLUTELY MUST SUCCEED, even though the resulting URL
> + // of "/path/to/file.txt" will be the terrible "://:0/path/to/file.txt" !!!
> + // (Such input usually comes from the callers of GetPathBaseName() and the like.)
> + if ( !theInputUri.isEmpty() && theInputUri[0] == '/' &&
> + curl_url_set( mCurlUri, CURLUPART_PATH, theInputUri.getStr(), 0 ) != CURLUE_OK )
> + {
> + throw DAVException( DAVException::DAV_INVALID_ARG );
> + }
> }
> - if ( !mAprUri.port )
> +
> + rtl::OUString portString = getURLStringPart( mCurlUri, CURLUPART_PORT, 0 );
> + if ( portString.isEmpty() )
> {
> - mAprUri.port = apr_uri_port_of_scheme( mAprUri.scheme );
> + rtl::OUString defaultPortW = getURLStringPart( mCurlUri, CURLUPART_PORT, CURLU_DEFAULT_PORT );
> + rtl::OString defaultPortA = OUStringToOString( defaultPortW, RTL_TEXTENCODING_UTF8 );
> + if ( !defaultPortA.isEmpty() )
> + curl_url_set( mCurlUri, CURLUPART_PORT, defaultPortA.getStr(), 0 );
> }
> - if ( !mAprUri.path )
> + rtl::OUString path = getURLStringPart( mCurlUri, CURLUPART_PATH, 0 );
> + if ( path.isEmpty() )
> + curl_url_set( mCurlUri, CURLUPART_PATH, "/", 0);
> +
> + init( mCurlUri );
> +
> + calculateURI();
> +}
> +
> +CurlUri::CurlUri( const CurlUri &curlUri )
> + throw ( DAVException )
> + : mURI()
> + , mScheme()
> + , mUserName()
> + , mPassword()
> + , mHostName()
> + , mPort()
> + , mPath()
> +{
> + mCurlUri = curl_url_dup( curlUri.mCurlUri );
> + if ( mCurlUri == NULL )
> + throw DAVException( DAVException::DAV_HTTP_ERROR,
> + rtl::OUString::createFromAscii( "Out of memory" ),
> + SC_INSUFFICIENT_STORAGE );
> +
> + char * uri;
> + CURLUcode rc = curl_url_get( mCurlUri, CURLUPART_URL, &uri, 0 );
> + if ( rc != CURLUE_OK )
> {
> - mAprUri.path = "/";
> + curl_url_cleanup( mCurlUri );
> + throw DAVException( DAVException::DAV_INVALID_ARG );
> }
> + curl_free( uri );
>
> - init( &mAprUri );
> + init( mCurlUri );
>
> calculateURI();
> }
>
> -void SerfUri::init( const apr_uri_t * pUri )
> +void CurlUri::init( const CURLU * pUri )
> {
> - mScheme = rtl::OStringToOUString( pUri->scheme, RTL_TEXTENCODING_UTF8 );
> - mUserInfo = rtl::OStringToOUString( pUri->user, RTL_TEXTENCODING_UTF8 );
> - mHostName = rtl::OStringToOUString( pUri->hostname, RTL_TEXTENCODING_UTF8 );
> - mPort = pUri->port;
> - mPath = rtl::OStringToOUString( pUri->path, RTL_TEXTENCODING_UTF8 );
> -
> - if ( pUri->query )
> + mScheme = getURLStringPart( pUri, CURLUPART_SCHEME, 0 );
> + mUserName = getURLStringPart( pUri, CURLUPART_USER, 0 );
> + mPassword = getURLStringPart( pUri, CURLUPART_PASSWORD, 0 );
> + mHostName = getURLStringPart( pUri, CURLUPART_HOST, 0 );
> + rtl::OUString portString = getURLStringPart( pUri, CURLUPART_PORT, 0);
> + mPort = 0;
> + if ( !portString.isEmpty() )
> + mPort = portString.toInt32();
> + mPath = getURLStringPart( pUri, CURLUPART_PATH, 0 );
> +
> + rtl::OUString query = getURLStringPart( pUri, CURLUPART_QUERY, 0 );
> + if ( !query.isEmpty() )
> {
> mPath += rtl::OUString::createFromAscii( "?" );
> - mPath += rtl::OStringToOUString( pUri->query, RTL_TEXTENCODING_UTF8 );
> + mPath += query;
> }
>
> - if ( pUri->fragment )
> + rtl::OUString fragment = getURLStringPart( pUri, CURLUPART_FRAGMENT, 0 );
> + if ( !fragment.isEmpty() )
> {
> mPath += rtl::OUString::createFromAscii( "#" );
> - mPath += rtl::OStringToOUString( pUri->fragment, RTL_TEXTENCODING_UTF8 );
> + mPath += fragment;
> }
> }
>
> -SerfUri::~SerfUri( )
> +CurlUri::~CurlUri( )
> {
> + if ( mCurlUri )
> + curl_url_cleanup( mCurlUri );
> }
>
> -void SerfUri::calculateURI ()
> +void CurlUri::calculateURI ()
> {
> rtl::OUStringBuffer aBuf( mScheme );
> aBuf.appendAscii( "://" );
> - if ( mUserInfo.getLength() > 0 )
> + if ( mUserName.getLength() > 0 )
> {
> - aBuf.append( mUserInfo );
> + aBuf.append( mUserName );
> + if ( mPassword.getLength() > 0 )
> + {
> + aBuf.appendAscii( ":" );
> + aBuf.append( mPassword );
> + }
> aBuf.appendAscii( "@" );
> }
> // Is host a numeric IPv6 address?
> @@ -186,7 +270,7 @@ void SerfUri::calculateURI ()
> mURI = aBuf.makeStringAndClear();
> }
>
> -::rtl::OUString SerfUri::GetPathBaseName () const
> +::rtl::OUString CurlUri::GetPathBaseName () const
> {
> sal_Int32 nPos = mPath.lastIndexOf ('/');
> sal_Int32 nTrail = 0;
> @@ -215,17 +299,17 @@ void SerfUri::calculateURI ()
> return rtl::OUString::createFromAscii ("/");
> }
>
> -bool SerfUri::operator== ( const SerfUri & rOther ) const
> +bool CurlUri::operator== ( const CurlUri & rOther ) const
> {
> return ( mURI == rOther.mURI );
> }
>
> -::rtl::OUString SerfUri::GetPathBaseNameUnescaped () const
> +::rtl::OUString CurlUri::GetPathBaseNameUnescaped () const
> {
> return unescape( GetPathBaseName() );
> }
>
> -void SerfUri::AppendPath (const rtl::OUString& rPath)
> +void CurlUri::AppendPath (const rtl::OUString& rPath)
> {
> if (mPath.lastIndexOf ('/') != mPath.getLength () - 1)
> mPath += rtl::OUString::createFromAscii ("/");
> @@ -235,7 +319,7 @@ void SerfUri::AppendPath (const rtl::OUString& rPath)
> };
>
> // static
> -rtl::OUString SerfUri::escapeSegment( const rtl::OUString& segment )
> +rtl::OUString CurlUri::escapeSegment( const rtl::OUString& segment )
> {
> return rtl::Uri::encode( segment,
> rtl_UriCharClassPchar,
> @@ -244,7 +328,7 @@ rtl::OUString SerfUri::escapeSegment( const rtl::OUString& segment )
> }
>
> // static
> -rtl::OUString SerfUri::unescape( const rtl::OUString& segment )
> +rtl::OUString CurlUri::unescape( const rtl::OUString& segment )
> {
> return rtl::Uri::decode( segment,
> rtl_UriDecodeWithCharset,
> @@ -252,7 +336,7 @@ rtl::OUString SerfUri::unescape( const rtl::OUString& segment )
> }
>
> // static
> -rtl::OUString SerfUri::makeConnectionEndPointString(
> +rtl::OUString CurlUri::makeConnectionEndPointString(
> const rtl::OUString & rHostName, int nPort )
> {
> rtl::OUStringBuffer aBuf;
> diff --git a/main/ucb/source/ucp/webdav/SerfUri.hxx b/main/ucb/source/ucp/webdav/CurlUri.hxx
> similarity index 76%
> rename from main/ucb/source/ucp/webdav/SerfUri.hxx
> rename to main/ucb/source/ucp/webdav/CurlUri.hxx
> index 1f2eebfe5d..ce0137c110 100644
> --- a/main/ucb/source/ucp/webdav/SerfUri.hxx
> +++ b/main/ucb/source/ucp/webdav/CurlUri.hxx
> @@ -20,10 +20,10 @@
> *************************************************************/
>
>
> -#ifndef INCLUDED_SERFURI_HXX
> -#define INCLUDED_SERFURI_HXX
> +#ifndef INCLUDED_CURLURI_HXX
> +#define INCLUDED_CURLURI_HXX
>
> -#include <apr_uri.h>
> +#include <curl/curl.h>
> #include <rtl/ustring.hxx>
> #include "DAVException.hxx"
>
> @@ -34,42 +34,42 @@ namespace http_dav_ucp
> #define DEFAULT_HTTPS_PORT 443
>
> // -------------------------------------------------------------------
> -// SerfUri
> -// A URI implementation for use with the neon/expat library
> +// CurlUri
> +// A URI implementation for use with the Curl library
> // -------------------------------------------------------------------
> -class SerfUri
> +class CurlUri
> {
> private:
> - apr_uri_t mAprUri;
> + CURLU *mCurlUri;
> ::rtl::OUString mURI;
> ::rtl::OUString mScheme;
> - ::rtl::OUString mUserInfo;
> + ::rtl::OUString mUserName;
> + ::rtl::OUString mPassword;
> ::rtl::OUString mHostName;
> sal_Int32 mPort;
> ::rtl::OUString mPath;
>
> - void init( const apr_uri_t * pUri );
> + void init( const CURLU * pUri );
> void calculateURI ();
>
> public:
> - SerfUri( const ::rtl::OUString & inUri ) throw ( DAVException );
> - SerfUri( const apr_uri_t * inUri ) throw ( DAVException );
> - ~SerfUri( );
> + CurlUri( const ::rtl::OUString & inUri ) throw ( DAVException );
> + CurlUri( const CURLU * inUri ) throw ( DAVException );
> + CurlUri( const CurlUri &curlUri ) throw ( DAVException );
> + ~CurlUri( );
>
> - bool operator== ( const SerfUri & rOther ) const;
> - bool operator!= ( const SerfUri & rOther ) const
> + bool operator== ( const CurlUri & rOther ) const;
> + bool operator!= ( const CurlUri & rOther ) const
> { return !operator==( rOther ); }
>
> - apr_uri_t* getAprUri()
> - {
> - return &mAprUri;
> - }
> const ::rtl::OUString & GetURI( void ) const
> { return mURI; };
> const ::rtl::OUString & GetScheme( void ) const
> { return mScheme; };
> - const ::rtl::OUString & GetUserInfo( void ) const
> - { return mUserInfo; };
> + const ::rtl::OUString & GetUserName( void ) const
> + { return mUserName; };
> + const ::rtl::OUString & GetPassword( void ) const
> + { return mPassword; };
> const ::rtl::OUString & GetHost( void ) const
> { return mHostName; };
> sal_Int32 GetPort( void ) const
> @@ -99,4 +99,4 @@ class SerfUri
>
> } // namespace http_dav_ucp
>
> -#endif // INCLUDED_SERFURI_HXX
> +#endif // INCLUDED_CURLURI_HXX
> diff --git a/main/ucb/source/ucp/webdav/DAVProperties.cxx b/main/ucb/source/ucp/webdav/DAVProperties.cxx
> index 12e131a150..134be44a20 100644
> --- a/main/ucb/source/ucp/webdav/DAVProperties.cxx
> +++ b/main/ucb/source/ucp/webdav/DAVProperties.cxx
> @@ -57,8 +57,8 @@ const ::rtl::OUString DAVProperties::EXECUTABLE =
>
> // -------------------------------------------------------------------
> // static
> -void DAVProperties::createSerfPropName( const rtl::OUString & rFullName,
> - SerfPropName & rName )
> +void DAVProperties::createCurlPropName( const rtl::OUString & rFullName,
> + CurlPropName & rName )
> {
> if ( rFullName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "DAV:" ) ) == 0 )
> {
> @@ -186,7 +186,7 @@ void DAVProperties::createUCBPropName( const char * nspace,
>
> // -------------------------------------------------------------------
> // static
> -bool DAVProperties::isUCBDeadProperty( const SerfPropName & rName )
> +bool DAVProperties::isUCBDeadProperty( const CurlPropName & rName )
> {
> return ( rName.nspace &&
> ( rtl_str_compareIgnoreAsciiCase(
> diff --git a/main/ucb/source/ucp/webdav/DAVProperties.hxx b/main/ucb/source/ucp/webdav/DAVProperties.hxx
> index 2a79d7e8d7..25a681fe95 100644
> --- a/main/ucb/source/ucp/webdav/DAVProperties.hxx
> +++ b/main/ucb/source/ucp/webdav/DAVProperties.hxx
> @@ -24,7 +24,7 @@
> #define _DAVPROPERTIES_HXX_
>
> #include <rtl/ustring.hxx>
> -#include "SerfTypes.hxx"
> +#include "CurlTypes.hxx"
>
> namespace http_dav_ucp
> {
> @@ -43,13 +43,13 @@ struct DAVProperties
> static const ::rtl::OUString SUPPORTEDLOCK;
> static const ::rtl::OUString EXECUTABLE;
>
> - static void createSerfPropName( const rtl::OUString & rFullName,
> - SerfPropName & rName );
> + static void createCurlPropName( const rtl::OUString & rFullName,
> + CurlPropName & rName );
> static void createUCBPropName ( const char * nspace,
> const char * name,
> rtl::OUString & rFullName );
>
> - static bool isUCBDeadProperty( const SerfPropName & rName );
> + static bool isUCBDeadProperty( const CurlPropName & rName );
> static bool isUCBSpecialProperty( const rtl::OUString & rFullName,
> rtl::OUString & rParsedName );
> };
> diff --git a/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx b/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx
> index ba02c36075..a5e1ade152 100644
> --- a/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx
> +++ b/main/ucb/source/ucp/webdav/DAVResourceAccess.cxx
> @@ -1058,7 +1058,7 @@ void DAVResourceAccess::initialize()
> osl::Guard< osl::Mutex > aGuard( m_aMutex );
> if ( m_aPath.getLength() == 0 )
> {
> - SerfUri aURI( m_aURL );
> + CurlUri aURI( m_aURL );
> rtl::OUString aPath( aURI.GetPath() );
>
> /* #134089# - Check URI */
> @@ -1140,10 +1140,10 @@ sal_Bool DAVResourceAccess::detectRedirectCycle(
> {
> osl::Guard< osl::Mutex > aGuard( m_aMutex );
>
> - SerfUri aUri( rRedirectURL );
> + CurlUri aUri( rRedirectURL );
>
> - std::vector< SerfUri >::const_iterator it = m_aRedirectURIs.begin();
> - std::vector< SerfUri >::const_iterator end = m_aRedirectURIs.end();
> + std::vector< CurlUri >::const_iterator it = m_aRedirectURIs.begin();
> + std::vector< CurlUri >::const_iterator end = m_aRedirectURIs.end();
>
> while ( it != end )
> {
> @@ -1162,9 +1162,9 @@ void DAVResourceAccess::resetUri()
> osl::Guard< osl::Mutex > aGuard( m_aMutex );
> if ( m_aRedirectURIs.size() > 0 )
> {
> - std::vector< SerfUri >::const_iterator it = m_aRedirectURIs.begin();
> + std::vector< CurlUri >::const_iterator it = m_aRedirectURIs.begin();
>
> - SerfUri aUri( (*it) );
> + CurlUri aUri( (*it) );
> m_aRedirectURIs.clear();
> setURL ( aUri.GetURI() );
> initialize();
> diff --git a/main/ucb/source/ucp/webdav/DAVResourceAccess.hxx b/main/ucb/source/ucp/webdav/DAVResourceAccess.hxx
> index 4f84afd96f..c690663a79 100644
> --- a/main/ucb/source/ucp/webdav/DAVResourceAccess.hxx
> +++ b/main/ucb/source/ucp/webdav/DAVResourceAccess.hxx
> @@ -38,7 +38,7 @@
> #include "DAVSession.hxx"
> #include "DAVResource.hxx"
> #include "DAVTypes.hxx"
> -#include "SerfUri.hxx"
> +#include "CurlUri.hxx"
>
> namespace http_dav_ucp
> {
> @@ -54,7 +54,7 @@ class DAVResourceAccess
> rtl::Reference< DAVSessionFactory > m_xSessionFactory;
> com::sun::star::uno::Reference<
> com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
> - std::vector< SerfUri > m_aRedirectURIs;
> + std::vector< CurlUri > m_aRedirectURIs;
>
> public:
> DAVResourceAccess() : m_xSessionFactory( 0 ) {}
> diff --git a/main/ucb/source/ucp/webdav/DAVSessionFactory.cxx b/main/ucb/source/ucp/webdav/DAVSessionFactory.cxx
> index c98803e993..97e6711a21 100644
> --- a/main/ucb/source/ucp/webdav/DAVSessionFactory.cxx
> +++ b/main/ucb/source/ucp/webdav/DAVSessionFactory.cxx
> @@ -24,8 +24,8 @@
> // MARKER(update_precomp.py): autogen include statement, do not remove
> #include "precompiled_webdav.hxx"
> #include "DAVSessionFactory.hxx"
> -#include "SerfSession.hxx"
> -#include "SerfUri.hxx"
> +#include "CurlSession.hxx"
> +#include "CurlUri.hxx"
> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
>
> using namespace http_dav_ucp;
> @@ -60,10 +60,10 @@ rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
>
> if ( aIt == aEnd )
> {
> - SerfUri aURI( inUri );
> + CurlUri aURI( inUri );
>
> std::auto_ptr< DAVSession > xElement(
> - new SerfSession( this, inUri, *m_xProxyDecider.get() ) );
> + new CurlSession( this, inUri, *m_xProxyDecider.get() ) );
>
> aIt = m_aMap.insert( Map::value_type( inUri, xElement.get() ) ).first;
> aIt->second->m_aContainerIt = aIt;
> @@ -84,9 +84,9 @@ rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
> // If URL scheme is different from http or https we definitely
> // have to use a proxy and therefore can optimize the getProxy
> // call a little:
> - SerfUri aURI( inUri );
> + CurlUri aURI( inUri );
>
> - aIt->second = new SerfSession( this, inUri, *m_xProxyDecider.get() );
> + aIt->second = new CurlSession( this, inUri, *m_xProxyDecider.get() );
> aIt->second->m_aContainerIt = aIt;
> return aIt->second;
> }
> diff --git a/main/ucb/source/ucp/webdav/LockRequest.cxx b/main/ucb/source/ucp/webdav/LockRequest.cxx
> new file mode 100644
> index 0000000000..86150c5c4c
> --- /dev/null
> +++ b/main/ucb/source/ucp/webdav/LockRequest.cxx
> @@ -0,0 +1,61 @@
> +/**************************************************************
> + *
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *
> + *************************************************************/
> +
> +// MARKER(update_precomp.py): autogen include statement, do not remove
> +#include "precompiled_webdav.hxx"
> +
> +#include <rtl/ustrbuf.hxx>
> +#include "LockRequest.hxx"
> +
> +using namespace http_dav_ucp;
> +
> +#define LOCK_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?><lockinfo xmlns=\"DAV:\">"
> +#define LOCK_TYPE "<locktype><write/></locktype>"
> +#define LOCK_TRAILER "</lockinfo>"
> +
> +rtl::OString LockRequest::generateRequestBody( const ucb::Lock& inLock )
> +{
> + const char *lockScope = NULL;
> + switch ( inLock.Scope )
> + {
> + //i126305 TODO investigate on this case...
> + case ucb::LockScope_MAKE_FIXED_SIZE:
> +
> + case ucb::LockScope_EXCLUSIVE:
> + lockScope = "<lockscope><exclusive/></lockscope>";
> + break;
> + case ucb::LockScope_SHARED:
> + lockScope = "<lockscope><shared/></lockscope>";
> + break;
> + }
> +
> + rtl::OUStringBuffer aBuffer;
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( LOCK_HEADER ));
> + aBuffer.appendAscii( lockScope );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( LOCK_TYPE ));
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<owner>" ));
> + rtl::OUString aStr;
> + inLock.Owner >>= aStr;
> + aBuffer.appendAscii( rtl::OUStringToOString( aStr, RTL_TEXTENCODING_UTF8 ).getStr() );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</owner>" ));
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( LOCK_TRAILER ));
> + return rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
> +}
> diff --git a/main/ucb/source/ucp/webdav/AprEnv.cxx b/main/ucb/source/ucp/webdav/LockRequest.hxx
> similarity index 64%
> rename from main/ucb/source/ucp/webdav/AprEnv.cxx
> rename to main/ucb/source/ucp/webdav/LockRequest.hxx
> index 2fdec85f86..4a4d4162e7 100644
> --- a/main/ucb/source/ucp/webdav/AprEnv.cxx
> +++ b/main/ucb/source/ucp/webdav/LockRequest.hxx
> @@ -19,40 +19,18 @@
> *
> *************************************************************/
>
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> +#ifndef INCLUDED_LOCKREQUEST_HXX
> +#define INCLUDED_LOCKREQUEST_HXX
>
> -#include "AprEnv.hxx"
> +#include "CurlTypes.hxx"
>
> -namespace apr_environment
> +namespace http_dav_ucp
> {
> -
> -AprEnv::AprEnv()
> - : mpAprPool( 0 )
> -{
> - apr_initialize();
> -
> - apr_pool_create(&mpAprPool, NULL);
> -}
> -
> -AprEnv::~AprEnv()
> -{
> - apr_pool_destroy(mpAprPool);
> -
> - apr_terminate();
> -}
> -
> -/* static */
> -AprEnv* AprEnv::getAprEnv()
> -{
> - static AprEnv rAprEnv;
> -
> - return &rAprEnv;
> -}
> -
> -apr_pool_t* AprEnv::getAprPool()
> -{
> - return mpAprPool;
> + class LockRequest
> + {
> + public:
> + static rtl::OString generateRequestBody( const ucb::Lock& inLock );
> + };
> }
>
> -} // namespace apr_environment
> +#endif // INCLUDED_LOCKREQUEST_HXX
> \ No newline at end of file
> diff --git a/main/ucb/source/ucp/webdav/PropfindRequest.cxx b/main/ucb/source/ucp/webdav/PropfindRequest.cxx
> new file mode 100644
> index 0000000000..27e3be5a9e
> --- /dev/null
> +++ b/main/ucb/source/ucp/webdav/PropfindRequest.cxx
> @@ -0,0 +1,81 @@
> +/**************************************************************
> + *
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *
> + *************************************************************/
> +
> +// MARKER(update_precomp.py): autogen include statement, do not remove
> +#include "precompiled_webdav.hxx"
> +
> +#include <rtl/ustrbuf.hxx>
> +#include "DAVProperties.hxx"
> +#include "PropfindRequest.hxx"
> +
> +using namespace http_dav_ucp;
> +
> +rtl::OString PropfindRequest::generatePROPFINDRequestBody(
> + const std::vector< ::rtl::OUString > * propNames,
> + const bool onlyPropertyNames )
> +{
> +#define PROPFIND_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?><propfind xmlns=\"DAV:\">"
> +#define PROPFIND_TRAILER "</propfind>"
> +
> + // TODO is it really needed a Unicode string buffer?
> + // All properties and property names aren't supposed to be ASCII?
> + rtl::OUStringBuffer aBuffer;
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPFIND_HEADER ));
> +
> + // create and fill body with requested properties
> + const int nPropCount = ( !onlyPropertyNames && propNames )
> + ? propNames->size()
> + : 0;
> + if ( nPropCount > 0 )
> + {
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<prop>" ) );
> + CurlPropName thePropName;
> + for ( int theIndex = 0; theIndex < nPropCount; theIndex ++ )
> + {
> + // split fullname into namespace and name!
> + DAVProperties::createCurlPropName( (*propNames)[ theIndex ],
> + thePropName );
> +
> + /* <*propname* xmlns="*propns*" /> */
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<" ));
> + aBuffer.appendAscii( thePropName.name );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " xmlnx=\"" ));
> + aBuffer.appendAscii( thePropName.nspace );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\"/>" ));
> + }
> +
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</prop>" ));
> + }
> + else
> + {
> + if ( onlyPropertyNames )
> + {
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<propname/>" ));
> + }
> + else
> + {
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<allprop/>" ));
> + }
> + }
> +
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPFIND_TRAILER ));
> + return rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
> +}
> diff --git a/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx b/main/ucb/source/ucp/webdav/PropfindRequest.hxx
> similarity index 55%
> rename from main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx
> rename to main/ucb/source/ucp/webdav/PropfindRequest.hxx
> index ade9602b98..505072fda0 100644
> --- a/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.hxx
> +++ b/main/ucb/source/ucp/webdav/PropfindRequest.hxx
> @@ -19,36 +19,21 @@
> *
> *************************************************************/
>
> -#ifndef INCLUDED_SERFMKCOLREQPROCIMPL_HXX
> -#define INCLUDED_SERFMKCOLREQPROCIMPL_HXX
> +#ifndef INCLUDED_PROPFINDREQUEST_HXX
> +#define INCLUDED_PROPFINDREQUEST_HXX
>
> -#include "SerfRequestProcessorImpl.hxx"
> +#include <vector>
> +#include "CurlTypes.hxx"
>
> namespace http_dav_ucp
> {
> -
> -class SerfMkColReqProcImpl : public SerfRequestProcessorImpl
> -{
> -private:
> - const char* mpLockToken;
> -public:
> - SerfMkColReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inLockToken );
> -
> - virtual ~SerfMkColReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFMKCOLREQPROCIMPL_HXX
> + class PropfindRequest
> + {
> + public:
> + static rtl::OString generatePROPFINDRequestBody(
> + const std::vector< ::rtl::OUString > * propNames,
> + const bool onlyPropertyNames);
> + };
> +}
> +
> +#endif // INCLUDED_PROPFINDREQUEST_HXX
> \ No newline at end of file
> diff --git a/main/ucb/source/ucp/webdav/ProppatchRequest.cxx b/main/ucb/source/ucp/webdav/ProppatchRequest.cxx
> new file mode 100644
> index 0000000000..007d354849
> --- /dev/null
> +++ b/main/ucb/source/ucp/webdav/ProppatchRequest.cxx
> @@ -0,0 +1,126 @@
> +/**************************************************************
> + *
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *
> + *************************************************************/
> +
> +// MARKER(update_precomp.py): autogen include statement, do not remove
> +#include "precompiled_webdav.hxx"
> +
> +#include <rtl/ustrbuf.hxx>
> +#include "DAVProperties.hxx"
> +#include "ProppatchRequest.hxx"
> +#include "UCBDeadPropertyValue.hxx"
> +
> +using namespace http_dav_ucp;
> +
> +#define PROPPATCH_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?><propertyupdate xmlns=\"DAV:\">"
> +#define PROPPATCH_TRAILER "</propertyupdate>"
> +
> +rtl::OString ProppatchRequest::generatePROPPATCHRequestBody(
> + const std::vector< ProppatchValue > & inProperties )
> +{
> + rtl::OString aBodyText;
> + static const struct
> + {
> + const char *str;
> + sal_Int32 len;
> + }
> + OpCode [] = {
> + { RTL_CONSTASCII_STRINGPARAM( "set" ) },
> + { RTL_CONSTASCII_STRINGPARAM( "remove" ) }
> + };
> + if ( inProperties.size() > 0 )
> + {
> + rtl::OUStringBuffer aBuffer;
> + // add PropPatch xml header in front
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPPATCH_HEADER ));
> +
> + // <*operation code*><prop>
> +
> + ProppatchOperation lastOp = inProperties[ 0 ].operation;
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<" ));
> + aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><prop>" ));
> +
> + CurlPropName thePropName;
> + for ( unsigned long n = 0; n < inProperties.size(); ++n )
> + {
> + const ProppatchValue & rProperty = inProperties[ n ];
> + // split fullname into namespace and name!
> + DAVProperties::createCurlPropName( rProperty.name,
> + thePropName );
> +
> + if ( rProperty.operation != lastOp )
> + {
> + // </prop></*last operation code*><*operation code><prop>
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</prop></" ));
> + aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><" ));
> + aBuffer.appendAscii( OpCode[rProperty.operation].str, OpCode[rProperty.operation].len );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><prop>" ));
> + }
> +
> + // <*propname* xmlns="*propns*"
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<" ));
> + aBuffer.appendAscii( thePropName.name );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " xmlns=\"" ));
> + aBuffer.appendAscii( thePropName.nspace );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ));
> +
> + if ( rProperty.operation == PROPSET )
> + {
> + // >*property value*</*propname*>
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" ));
> +
> + rtl::OUString aStringValue;
> + if ( DAVProperties::isUCBDeadProperty( thePropName ) )
> + {
> + UCBDeadPropertyValue::toXML( rProperty.value,
> + aStringValue );
> + }
> + else
> + {
> + rProperty.value >>= aStringValue;
> + }
> + aBuffer.append( aStringValue );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</" ));
> + aBuffer.appendAscii( thePropName.name );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" ));
> + }
> + else
> + {
> + // />
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/>" ));
> + }
> +
> + lastOp = rProperty.operation;
> + }
> +
> + // </prop></*last operation code*>
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</prop></" ));
> + aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len );
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" ));
> +
> + // add PropPatch xml trailer at end
> + aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPPATCH_TRAILER ));
> +
> + return rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
> + }
> + return rtl::OString();
> +}
> diff --git a/main/ucb/source/ucp/webdav/AprEnv.hxx b/main/ucb/source/ucp/webdav/ProppatchRequest.hxx
> similarity index 70%
> rename from main/ucb/source/ucp/webdav/AprEnv.hxx
> rename to main/ucb/source/ucp/webdav/ProppatchRequest.hxx
> index c6835b2e41..6fbeef3e52 100644
> --- a/main/ucb/source/ucp/webdav/AprEnv.hxx
> +++ b/main/ucb/source/ucp/webdav/ProppatchRequest.hxx
> @@ -19,32 +19,21 @@
> *
> *************************************************************/
>
> +#ifndef INCLUDED_PROPPATCHREQUEST_HXX
> +#define INCLUDED_PROPPATCHREQUEST_HXX
>
> -#ifndef INCLUDED_APRENV_HXX
> -#define INCLUDED_APRENV_HXX
> +#include <vector>
> +#include "CurlTypes.hxx"
>
> -#include <apr_pools.h>
> -
> -namespace apr_environment
> +namespace http_dav_ucp
> {
>
> -// singleton class providing environment for APR libraries
> -class AprEnv
> -{
> + class ProppatchRequest
> + {
> public:
> - ~AprEnv();
> -
> - static AprEnv* getAprEnv();
> -
> - apr_pool_t* getAprPool();
> -
> - private:
> - apr_pool_t* mpAprPool;
> -
> - AprEnv();
> -
> -};
> -
> -} // namespace apr_environment
> + static rtl::OString generatePROPPATCHRequestBody(
> + const std::vector< ProppatchValue > & inProperties );
> + };
> +}
>
> -#endif // INCLUDED_APRENV_HXX
> +#endif // INCLUDED_PROPPATCHREQUEST_HXX
> \ No newline at end of file
> diff --git a/main/ucb/source/ucp/webdav/SerfCallbacks.cxx b/main/ucb/source/ucp/webdav/SerfCallbacks.cxx
> deleted file mode 100644
> index 20693dab30..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfCallbacks.cxx
> +++ /dev/null
> @@ -1,121 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfCallbacks.hxx"
> -
> -#include "SerfSession.hxx"
> -#include "SerfRequestProcessor.hxx"
> -
> -using namespace http_dav_ucp;
> -
> -extern "C" apr_status_t Serf_ConnectSetup( apr_socket_t *skt,
> - serf_bucket_t **read_bkt,
> - serf_bucket_t **write_bkt,
> - void *setup_baton,
> - apr_pool_t *pool )
> -{
> - SerfSession* pSerfSession = static_cast< SerfSession* >( setup_baton );
> - OSL_TRACE("Serf_ConnectSetup");
> - return pSerfSession->setupSerfConnection( skt,
> - read_bkt,
> - write_bkt,
> - pool );
> -}
> -
> -extern "C" apr_status_t Serf_Credentials( char **username,
> - char **password,
> - serf_request_t *request,
> - void *baton,
> - int code,
> - const char *authn_type,
> - const char *realm,
> - apr_pool_t *pool )
> -{
> - SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( baton );
> - OSL_TRACE("Serf_Credential");
> - return pReqProc->provideSerfCredentials( username,
> - password,
> - request,
> - code,
> - authn_type,
> - realm,
> - pool );
> -}
> -
> -extern "C" apr_status_t Serf_CertificateChainValidation(
> - void* pSerfSession,
> - int nFailures,
> - int nErrorCode,
> - const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded,
> - apr_size_t nCertificateChainLength)
> -{
> - OSL_TRACE("Serf_CertificateChainValidation");
> - return static_cast<SerfSession*>(pSerfSession)
> - ->verifySerfCertificateChain(nFailures, pCertificateChainBase64Encoded, nCertificateChainLength);
> -}
> -
> -extern "C" apr_status_t Serf_SetupRequest( serf_request_t *request,
> - void *setup_baton,
> - serf_bucket_t **req_bkt,
> - serf_response_acceptor_t *acceptor,
> - void **acceptor_baton,
> - serf_response_handler_t *handler,
> - void **handler_baton,
> - apr_pool_t * pool )
> -{
> - SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( setup_baton );
> - OSL_TRACE("Serf_SetupRequest");
> - return pReqProc->setupSerfRequest( request,
> - req_bkt,
> - acceptor,
> - acceptor_baton,
> - handler,
> - handler_baton,
> - pool );
> -}
> -
> -extern "C" serf_bucket_t* Serf_AcceptResponse( serf_request_t *request,
> - serf_bucket_t *stream,
> - void *acceptor_baton,
> - apr_pool_t *pool )
> -{
> - SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( acceptor_baton );
> - OSL_TRACE("Serf_AcceptResponse");
> - return pReqProc->acceptSerfResponse( request,
> - stream,
> - pool );
> -}
> -
> -extern "C" apr_status_t Serf_HandleResponse( serf_request_t *request,
> - serf_bucket_t *response,
> - void *handler_baton,
> - apr_pool_t *pool )
> -{
> - SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( handler_baton );
> - OSL_TRACE("Serf_HandleResponse");
> - return pReqProc->handleSerfResponse( request,
> - response,
> - pool );
> -}
> -
> diff --git a/main/ucb/source/ucp/webdav/SerfCallbacks.hxx b/main/ucb/source/ucp/webdav/SerfCallbacks.hxx
> deleted file mode 100644
> index 85245bb7e4..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfCallbacks.hxx
> +++ /dev/null
> @@ -1,69 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -
> -#ifndef INCLUDED_CALLBACKS_HXX
> -#define INCLUDED_CALLBACKS_HXX
> -
> -#include <serf.h>
> -
> -extern "C" apr_status_t Serf_ConnectSetup( apr_socket_t *skt,
> - serf_bucket_t **read_bkt,
> - serf_bucket_t **write_bkt,
> - void *setup_baton,
> - apr_pool_t *pool );
> -
> -extern "C" apr_status_t Serf_Credentials( char **username,
> - char **password,
> - serf_request_t *request,
> - void *baton,
> - int code,
> - const char *authn_type,
> - const char *realm,
> - apr_pool_t *pool );
> -
> -extern "C" apr_status_t Serf_CertificateChainValidation(
> - void* pSerfSession,
> - int nFailures,
> - 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,
> - serf_bucket_t **req_bkt,
> - serf_response_acceptor_t *acceptor,
> - void **acceptor_baton,
> - serf_response_handler_t *handler,
> - void **handler_baton,
> - apr_pool_t * pool );
> -
> -extern "C" serf_bucket_t* Serf_AcceptResponse( serf_request_t *request,
> - serf_bucket_t *stream,
> - void *acceptor_baton,
> - apr_pool_t *pool );
> -
> -extern "C" apr_status_t Serf_HandleResponse( serf_request_t *request,
> - serf_bucket_t *response,
> - void *handler_baton,
> - apr_pool_t *pool );
> -
> -#endif // INCLUDED_CALLBACKS_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx
> deleted file mode 100644
> index 711cbbe61b..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.cxx
> +++ /dev/null
> @@ -1,91 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfCopyReqProcImpl.hxx"
> -
> -#include <serf.h>
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfCopyReqProcImpl::SerfCopyReqProcImpl( const char* inSourcePath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inDestinationPath,
> - const bool inOverwrite,
> - const char* inLockToken )
> - : SerfRequestProcessorImpl( inSourcePath, inRequestHeaders )
> - , mDestPathStr( inDestinationPath )
> - , mbOverwrite( inOverwrite )
> - , mpLockToken( inLockToken )
> -{
> -}
> -
> -SerfCopyReqProcImpl::~SerfCopyReqProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfCopyReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "COPY",
> - getPathStr(),
> - 0,
> - 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 );
> -
> - // COPY specific header fields
> - serf_bucket_headers_set( hdrs_bkt, "Destination", mDestPathStr );
> - if ( mbOverwrite )
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Overwrite", "T" );
> - }
> - else
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Overwrite", "F" );
> - }
> - if(mpLockToken)
> - {
> - serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
> - }
> -
> - return req_bkt;
> -}
> -
> -void SerfCopyReqProcImpl::processChunkOfResponseData( const char* /*data*/,
> - apr_size_t /*len*/ )
> -{
> - // nothing to do;
> -}
> -
> -void SerfCopyReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - // nothing to do;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx
> deleted file mode 100644
> index 029968e2a7..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfCopyReqProcImpl.hxx
> +++ /dev/null
> @@ -1,59 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFCOPYREQPROCIMPL_HXX
> -#define INCLUDED_SERFCOPYREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfCopyReqProcImpl : public SerfRequestProcessorImpl
> -{
> -public:
> - SerfCopyReqProcImpl( const char* inSourcePath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inDestinationPath,
> - const bool inOverwrite,
> - const char* inLockToken );
> -
> - virtual ~SerfCopyReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -private:
> - const char* mDestPathStr;
> - const bool mbOverwrite;
> - const char* mpLockToken;
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFCOPYREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx
> deleted file mode 100644
> index 123239516c..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.cxx
> +++ /dev/null
> @@ -1,77 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfDeleteReqProcImpl.hxx"
> -
> -#include <serf.h>
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfDeleteReqProcImpl::SerfDeleteReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inLockToken )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , mpLockToken( inLockToken )
> -{
> -}
> -
> -SerfDeleteReqProcImpl::~SerfDeleteReqProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfDeleteReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "DELETE",
> - getPathStr(),
> - 0,
> - 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 );
> - // specific header field
> - if(mpLockToken)
> - {
> - serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
> - }
> -
> - return req_bkt;
> -}
> -
> -void SerfDeleteReqProcImpl::processChunkOfResponseData( const char* /*data*/,
> - apr_size_t /*len*/ )
> -{
> - // nothing to do;
> -}
> -
> -void SerfDeleteReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - // nothing to do;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx
> deleted file mode 100644
> index 9cb4f920ad..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfDeleteReqProcImpl.hxx
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFDELETEREQPROCIMPL_HXX
> -#define INCLUDED_SERFDELETEREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfDeleteReqProcImpl : public SerfRequestProcessorImpl
> -{
> -private:
> - const char* mpLockToken;
> -public:
> - SerfDeleteReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inLockRToken );
> -
> - virtual ~SerfDeleteReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFDELETEREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx
> deleted file mode 100644
> index 315272b4ee..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.cxx
> +++ /dev/null
> @@ -1,187 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfGetReqProcImpl.hxx"
> -
> -using namespace com::sun::star;
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfGetReqProcImpl::SerfGetReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , xInputStream( xioInStrm )
> - , xOutputStream()
> - , mpHeaderNames( 0 )
> - , mpResource( 0 )
> -{
> -}
> -
> -SerfGetReqProcImpl::SerfGetReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , xInputStream( xioInStrm )
> - , xOutputStream()
> - , mpHeaderNames( &inHeaderNames )
> - , mpResource( &ioResource )
> -{
> -}
> -
> -SerfGetReqProcImpl::SerfGetReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , xInputStream()
> - , xOutputStream( xioOutStrm )
> - , mpHeaderNames( 0 )
> - , mpResource( 0 )
> -{
> -}
> -
> -SerfGetReqProcImpl::SerfGetReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , xInputStream()
> - , xOutputStream( xioOutStrm )
> - , mpHeaderNames( &inHeaderNames )
> - , mpResource( &ioResource )
> -{
> -}
> -
> -SerfGetReqProcImpl::~SerfGetReqProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfGetReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "GET",
> - getPathStr(),
> - 0,
> - 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 );
> -
> - return req_bkt;
> -}
> -
> -void SerfGetReqProcImpl::processChunkOfResponseData( const char* data,
> - apr_size_t len )
> -{
> - if ( xInputStream.is() )
> - {
> - xInputStream->AddToStream( data, len );
> - }
> - else if ( xOutputStream.is() )
> - {
> - const uno::Sequence< sal_Int8 > aDataSeq( (sal_Int8 *)data, len );
> - xOutputStream->writeBytes( aDataSeq );
> - }
> -}
> -
> -namespace
> -{
> - apr_status_t Serf_ProcessResponseHeader( void* inUserData,
> - const char* inHeaderName,
> - const char* inHeaderValue )
> - {
> - SerfGetReqProcImpl* pReqProcImpl = static_cast< SerfGetReqProcImpl* >( inUserData );
> - pReqProcImpl->processSingleResponseHeader( inHeaderName,
> - inHeaderValue );
> -
> - return APR_SUCCESS;
> - }
> -} // end of anonymous namespace
> -
> -void SerfGetReqProcImpl::handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket )
> -{
> - // read response header, if requested
> - if ( mpHeaderNames != 0 && mpResource != 0 )
> - {
> - serf_bucket_t* SerfHeaderBucket = serf_bucket_response_get_headers( inSerfResponseBucket );
> - if ( SerfHeaderBucket != 0 )
> - {
> - serf_bucket_headers_do( SerfHeaderBucket,
> - Serf_ProcessResponseHeader,
> - this );
> - }
> - }
> -}
> -
> -void SerfGetReqProcImpl::processSingleResponseHeader( const char* inHeaderName,
> - const char* inHeaderValue )
> -{
> - rtl::OUString aHeaderName( rtl::OUString::createFromAscii( inHeaderName ) );
> -
> - bool bStoreHeaderField = false;
> -
> - if ( mpHeaderNames->size() == 0 )
> - {
> - // store all header fields
> - bStoreHeaderField = true;
> - }
> - else
> - {
> - // store only header fields which are requested
> - std::vector< ::rtl::OUString >::const_iterator it( mpHeaderNames->begin() );
> - const std::vector< ::rtl::OUString >::const_iterator end( mpHeaderNames->end() );
> -
> - while ( it != end )
> - {
> - // header names are case insensitive
> - if ( (*it).equalsIgnoreAsciiCase( aHeaderName ) )
> - {
> - bStoreHeaderField = true;
> - break;
> - }
> - else
> - {
> - ++it;
> - }
> - }
> - }
> -
> - if ( bStoreHeaderField )
> - {
> - DAVPropertyValue thePropertyValue;
> - thePropertyValue.IsCaseSensitive = false;
> - thePropertyValue.Name = aHeaderName;
> - thePropertyValue.Value <<= rtl::OUString::createFromAscii( inHeaderValue );
> - mpResource->properties.push_back( thePropertyValue );
> - }
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx
> deleted file mode 100644
> index 2d853f6bf2..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfGetReqProcImpl.hxx
> +++ /dev/null
> @@ -1,84 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFGETREQPROCIMPL_HXX
> -#define INCLUDED_SERFGETREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -#include <vector>
> -#include <rtl/ustring.hxx>
> -#include "DAVResource.hxx"
> -
> -#include "SerfInputStream.hxx"
> -#include <com/sun/star/io/XOutputStream.hpp>
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfGetReqProcImpl : public SerfRequestProcessorImpl
> -{
> -public:
> - SerfGetReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm );
> -
> - SerfGetReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource );
> -
> - SerfGetReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm );
> -
> - SerfGetReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource );
> -
> - virtual ~SerfGetReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> - void processSingleResponseHeader( const char* inHeaderName,
> - const char* inHeaderValue );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -private:
> - com::sun::star::uno::Reference< SerfInputStream > xInputStream;
> - com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOutputStream;
> - const std::vector< ::rtl::OUString > * mpHeaderNames;
> - DAVResource* mpResource;
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFGETREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx
> deleted file mode 100644
> index 263f255ebd..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.cxx
> +++ /dev/null
> @@ -1,141 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfHeadReqProcImpl.hxx"
> -
> -using namespace com::sun::star;
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfHeadReqProcImpl::SerfHeadReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , mpHeaderNames( &inHeaderNames )
> - , mpResource( &ioResource )
> -{
> -}
> -
> -SerfHeadReqProcImpl::~SerfHeadReqProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfHeadReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "HEAD",
> - getPathStr(),
> - 0,
> - 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 );
> -
> - return req_bkt;
> -}
> -
> -void SerfHeadReqProcImpl::processChunkOfResponseData( const char* /*data*/,
> - apr_size_t /*len*/ )
> -{
> - // nothing to do
> -}
> -
> -namespace
> -{
> - apr_status_t Serf_ProcessResponseHeader( void* inUserData,
> - const char* inHeaderName,
> - const char* inHeaderValue )
> - {
> - SerfHeadReqProcImpl* pReqProcImpl = static_cast< SerfHeadReqProcImpl* >( inUserData );
> - pReqProcImpl->processSingleResponseHeader( inHeaderName,
> - inHeaderValue );
> -
> - return APR_SUCCESS;
> - }
> -} // end of anonymous namespace
> -
> -void SerfHeadReqProcImpl::handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket )
> -{
> - // read response header, if requested
> - if ( mpHeaderNames != 0 && mpResource != 0 )
> - {
> - serf_bucket_t* SerfHeaderBucket = serf_bucket_response_get_headers( inSerfResponseBucket );
> - if ( SerfHeaderBucket != 0 )
> - {
> - serf_bucket_headers_do( SerfHeaderBucket,
> - Serf_ProcessResponseHeader,
> - this );
> - }
> - }
> -}
> -
> -void SerfHeadReqProcImpl::processSingleResponseHeader( const char* inHeaderName,
> - const char* inHeaderValue )
> -{
> - rtl::OUString aHeaderName( rtl::OUString::createFromAscii( inHeaderName ) );
> -
> - bool bStoreHeaderField = false;
> -
> - if ( mpHeaderNames->size() == 0 )
> - {
> - // store all header fields
> - bStoreHeaderField = true;
> - }
> - else
> - {
> - // store only header fields which are requested
> - std::vector< ::rtl::OUString >::const_iterator it( mpHeaderNames->begin() );
> - const std::vector< ::rtl::OUString >::const_iterator end( mpHeaderNames->end() );
> -
> - while ( it != end )
> - {
> - // header names are case insensitive
> - if ( (*it).equalsIgnoreAsciiCase( aHeaderName ) )
> - {
> - bStoreHeaderField = true;
> - break;
> - }
> - else
> - {
> - ++it;
> - }
> - }
> - }
> -
> - if ( bStoreHeaderField )
> - {
> - DAVPropertyValue thePropertyValue;
> - thePropertyValue.IsCaseSensitive = false;
> - thePropertyValue.Name = aHeaderName;
> - thePropertyValue.Value <<= rtl::OUString::createFromAscii( inHeaderValue );
> - mpResource->properties.push_back( thePropertyValue );
> - }
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx
> deleted file mode 100644
> index a6758108d4..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfHeadReqProcImpl.hxx
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFHEADREQPROCIMPL_HXX
> -#define INCLUDED_SERFHEADREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -#include <vector>
> -#include <rtl/ustring.hxx>
> -#include "DAVResource.hxx"
> -
> -#include "SerfInputStream.hxx"
> -#include <com/sun/star/io/XOutputStream.hpp>
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfHeadReqProcImpl : public SerfRequestProcessorImpl
> -{
> -public:
> - SerfHeadReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource );
> -
> - virtual ~SerfHeadReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> - void processSingleResponseHeader( const char* inHeaderName,
> - const char* inHeaderValue );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -private:
> - const std::vector< ::rtl::OUString > * mpHeaderNames;
> - DAVResource* mpResource;
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFHEADREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfLockRefreshProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfLockRefreshProcImpl.cxx
> deleted file mode 100644
> index 871718d3b2..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfLockRefreshProcImpl.cxx
> +++ /dev/null
> @@ -1,80 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfTypes.hxx"
> -#include "SerfLockRefreshProcImpl.hxx"
> -#include "DAVProperties.hxx"
> -
> -#include "webdavresponseparser.hxx"
> -#include <serf.h>
> -#include <rtl/ustrbuf.hxx>
> -#include <apr_strings.h>
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfLockRefreshProcImpl::SerfLockRefreshProcImpl( const char* inSourcePath,
> - const DAVRequestHeaders& inRequestHeaders, // on debug the header look empty
> - const ucb::Lock& inLock,
> - const char* inLockToken,
> - const char* inTimeout,
> - DAVPropertyValue & outLock)
> - : SerfLockReqProcImpl( inSourcePath, inRequestHeaders, inLock, inTimeout, outLock )
> - , mpLockToken( inLockToken )
> -{
> -}
> -
> -SerfLockRefreshProcImpl::~SerfLockRefreshProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfLockRefreshProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "LOCK",
> - getPathStr(),
> - 0,
> - serf_request_get_alloc( inSerfRequest ) );
> - // set request header fields
> - serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
> - if (hdrs_bkt != NULL)
> - {
> - // general header fields provided by caller
> - setRequestHeaders( hdrs_bkt );
> -
> - // request specific header fields
> - if(mTimeout != 0)
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Timeout", mTimeout );
> - }
> - if(mpLockToken != 0)
> - {
> - serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
> - }
> - }
> - return req_bkt;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfLockRefreshProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfLockRefreshProcImpl.hxx
> deleted file mode 100644
> index 9c8a2e71b0..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfLockRefreshProcImpl.hxx
> +++ /dev/null
> @@ -1,51 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFLOCKREFRESHPROCIMPL_HXX
> -#define INCLUDED_SERFLOCKREFRESHPROCIMPL_HXX
> -
> -#include "SerfLockReqProcImpl.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> - class SerfLockRefreshProcImpl : public SerfLockReqProcImpl
> - {
> - protected:
> - const char* mpLockToken;
> -
> - public:
> - SerfLockRefreshProcImpl( const char* inSourcePath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const ucb::Lock& inLock,
> - const char* inLockToken,
> - const char* inTimeout,
> - DAVPropertyValue & outLock);
> -
> - virtual ~SerfLockRefreshProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> - };
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFLOCKREFRESHPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
> deleted file mode 100644
> index 818a88a537..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfLockReqProcImpl.cxx
> +++ /dev/null
> @@ -1,155 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfTypes.hxx"
> -#include "SerfLockReqProcImpl.hxx"
> -#include "DAVProperties.hxx"
> -
> -#include "webdavresponseparser.hxx"
> -#include <serf.h>
> -#include <rtl/ustrbuf.hxx>
> -#include <apr_strings.h>
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfLockReqProcImpl::SerfLockReqProcImpl( const char* inSourcePath,
> - const DAVRequestHeaders& inRequestHeaders, // on debug the header look empty
> - const ucb::Lock& inLock,
> - const char* inTimeout,
> - DAVPropertyValue & outLock)
> - : SerfRequestProcessorImpl( inSourcePath, inRequestHeaders )
> - , mLock( inLock )
> - , mTimeout(inTimeout)
> - , mLockObtained( &outLock )
> - , xInputStream( new SerfInputStream() )
> -{
> - switch ( inLock.Depth )
> - {
> - //i126305 TODO investigate on this case...
> - case ucb::LockDepth_MAKE_FIXED_SIZE:
> -
> - case ucb::LockDepth_ZERO:
> - mDepthStr = "0";
> - break;
> - case ucb::LockDepth_ONE:
> - mDepthStr = "1";
> - break;
> - case ucb::LockDepth_INFINITY:
> - mDepthStr = "infinity";
> - break;
> - }
> -
> - switch ( inLock.Scope )
> - {
> - //i126305 TODO investigate on this case...
> - case ucb::LockScope_MAKE_FIXED_SIZE:
> -
> - case ucb::LockScope_EXCLUSIVE:
> - mLockScope = "<lockscope><exclusive/></lockscope>";
> - break;
> - case ucb::LockScope_SHARED:
> - mLockScope = "<lockscope><shared/></lockscope>";
> - break;
> - }
> -}
> -
> -SerfLockReqProcImpl::~SerfLockReqProcImpl()
> -{
> -}
> -
> -#define LOCK_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?><lockinfo xmlns=\"DAV:\">"
> -#define LOCK_TYPE "<locktype><write/></locktype>"
> -#define LOCK_TRAILER "</lockinfo>"
> -
> -serf_bucket_t * SerfLockReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - //prepare body of request:
> - serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
> - serf_bucket_t* body_bkt = 0;
> - rtl::OString aBodyText;
> - {
> - rtl::OUStringBuffer aBuffer;
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( LOCK_HEADER ));
> - aBuffer.appendAscii( mLockScope );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( LOCK_TYPE ));
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<owner>" ));
> - rtl::OUString aStr;
> - mLock.Owner >>= aStr;
> - aBuffer.appendAscii( rtl::OUStringToOString( aStr, RTL_TEXTENCODING_UTF8 ).getStr() );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</owner>" ));
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( LOCK_TRAILER ));
> - aBodyText = rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
> - body_bkt = serf_bucket_simple_copy_create( aBodyText.getStr(),
> - aBodyText.getLength(),
> - pSerfBucketAlloc );
> - }
> -
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "LOCK",
> - 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 );
> - if (hdrs_bkt != NULL)
> - {
> - // general header fields provided by caller
> - setRequestHeaders( hdrs_bkt );
> -
> - // request specific header fields
> - serf_bucket_headers_set( hdrs_bkt, "Timeout", mTimeout );
> - serf_bucket_headers_set( hdrs_bkt, "Depth", mDepthStr );
> - if (hdrs_bkt!=NULL && body_bkt != 0 && aBodyText.getLength() > 0 )
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
> - }
> - }
> - else
> - {
> - OSL_ASSERT("Headers Bucket missing");
> - }
> -
> - return req_bkt;
> -}
> -
> -void SerfLockReqProcImpl::processChunkOfResponseData( const char* data,
> - apr_size_t len )
> -{
> - if ( xInputStream.is() )
> - {
> - xInputStream->AddToStream( data, len );
> - }
> -}
> -
> -void SerfLockReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - const DAVPropertyValue rLocksValue( parseWebDAVLockResponse( xInputStream.get() ) );
> - *mLockObtained = rLocksValue;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
> deleted file mode 100644
> index 3983db21ec..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfLockReqProcImpl.hxx
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFLOCKREQPROCIMPL_HXX
> -#define INCLUDED_SERFLOCKREQPROCIMPL_HXX
> -
> -#include "SerfTypes.hxx"
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -#include "SerfInputStream.hxx"
> -
> -#include <vector>
> -#include <rtl/ustring.hxx>
> -#include "SerfTypes.hxx"
> -#include "DAVTypes.hxx"
> -#include "DAVResource.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> - class SerfLockReqProcImpl : public SerfRequestProcessorImpl
> - {
> -
> - protected:
> - std::vector< DAVResource > mpResources;
> - const ucb::Lock mLock;
> - const char* mDepthStr;
> - const char* mLockScope;
> - const char* mTimeout;
> - DAVPropertyValue* mLockObtained;
> - com::sun::star::uno::Reference< SerfInputStream > xInputStream;
> -
> - public:
> - SerfLockReqProcImpl( const char* inSourcePath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const ucb::Lock& inLock,
> - const char* inTimeout,
> - DAVPropertyValue & outLock);
> -
> - virtual ~SerfLockReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> - protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> - };
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFLOCKREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx
> deleted file mode 100644
> index cc3140452e..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfMkColReqProcImpl.cxx
> +++ /dev/null
> @@ -1,72 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfMkColReqProcImpl.hxx"
> -
> -#include <serf.h>
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfMkColReqProcImpl::SerfMkColReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inLockToken )
> - : SerfRequestProcessorImpl( inPath,inRequestHeaders )
> - , mpLockToken( inLockToken )
> -{
> -}
> -
> -SerfMkColReqProcImpl::~SerfMkColReqProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfMkColReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "MKCOL",
> - getPathStr(),
> - 0,
> - 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 );
> -
> - return req_bkt;
> -}
> -
> -void SerfMkColReqProcImpl::processChunkOfResponseData( const char* /*data*/,
> - apr_size_t /*len*/ )
> -{
> - // nothing to do;
> -}
> -
> -void SerfMkColReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - // nothing to do;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx
> deleted file mode 100644
> index 662eb0a1f9..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.cxx
> +++ /dev/null
> @@ -1,91 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfMoveReqProcImpl.hxx"
> -
> -#include <serf.h>
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfMoveReqProcImpl::SerfMoveReqProcImpl( const char* inSourcePath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inDestinationPath,
> - const bool inOverwrite,
> - const char* inLockToken)
> - : SerfRequestProcessorImpl( inSourcePath, inRequestHeaders )
> - , mDestPathStr( inDestinationPath )
> - , mbOverwrite( inOverwrite )
> - , mpLockToken( inLockToken )
> -{
> -}
> -
> -SerfMoveReqProcImpl::~SerfMoveReqProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfMoveReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "MOVE",
> - getPathStr(),
> - 0,
> - 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 );
> -
> - // MOVE specific header fields
> - serf_bucket_headers_set( hdrs_bkt, "Destination", mDestPathStr );
> - if ( mbOverwrite )
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Overwrite", "T" );
> - }
> - else
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Overwrite", "F" );
> - }
> - if(mpLockToken)
> - {
> - serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
> - }
> -
> - return req_bkt;
> -}
> -
> -void SerfMoveReqProcImpl::processChunkOfResponseData( const char* /*data*/,
> - apr_size_t /*len*/ )
> -{
> - // nothing to do;
> -}
> -
> -void SerfMoveReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - // nothing to do;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx
> deleted file mode 100644
> index cf49e9983c..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfMoveReqProcImpl.hxx
> +++ /dev/null
> @@ -1,59 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFMOVEREQPROCIMPL_HXX
> -#define INCLUDED_SERFMOVEREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfMoveReqProcImpl : public SerfRequestProcessorImpl
> -{
> -public:
> - SerfMoveReqProcImpl( const char* inSourcePath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inDestinationPath,
> - const bool inOverwrite,
> - const char* inLockToken );
> -
> - virtual ~SerfMoveReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -private:
> - const char* mDestPathStr;
> - const bool mbOverwrite;
> - const char* mpLockToken;
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFMOVEREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
> deleted file mode 100644
> index 20cd38edc2..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.cxx
> +++ /dev/null
> @@ -1,136 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfPostReqProcImpl.hxx"
> -
> -#include <serf.h>
> -
> -using namespace com::sun::star;
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfPostReqProcImpl::SerfPostReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inData,
> - apr_size_t inDataLen,
> - const char* inLockToken,
> - const char* inContentType,
> - const char* inReferer,
> - const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , mpPostData( inData )
> - , mnPostDataLen( inDataLen )
> - , mpLockToken( inLockToken )
> - , mpContentType( inContentType )
> - , mpReferer( inReferer )
> - , xInputStream( xioInStrm )
> - , xOutputStream()
> -{
> -}
> -
> -SerfPostReqProcImpl::SerfPostReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inData,
> - apr_size_t inDataLen,
> - const char* inLockToken,
> - const char* inContentType,
> - const char* inReferer,
> - const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , mpPostData( inData )
> - , mnPostDataLen( inDataLen )
> - , mpLockToken( inLockToken )
> - , mpContentType( inContentType )
> - , mpReferer( inReferer )
> - , xInputStream()
> - , xOutputStream( xioOutStrm )
> -{
> -}
> -
> -SerfPostReqProcImpl::~SerfPostReqProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfPostReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
> -
> - // create body bucket
> - serf_bucket_t* body_bkt = 0;
> - if ( mpPostData != 0 && mnPostDataLen > 0 )
> - {
> - body_bkt = SERF_BUCKET_SIMPLE_STRING_LEN( mpPostData, mnPostDataLen, pSerfBucketAlloc );
> - }
> -
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "POST",
> - 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 );
> - // general header fields provided by caller
> - setRequestHeaders( hdrs_bkt );
> -
> - // request specific header fields
> - if ( mpContentType != 0 )
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Content-Type", mpContentType );
> - }
> - if ( mpReferer != 0 )
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Referer", mpReferer );
> - }
> - if(mpLockToken)
> - {
> - serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
> - }
> -
> - return req_bkt;
> -}
> -
> -void SerfPostReqProcImpl::processChunkOfResponseData( const char* data,
> - apr_size_t len )
> -{
> - if ( xInputStream.is() )
> - {
> - xInputStream->AddToStream( data, len );
> - }
> - else if ( xOutputStream.is() )
> - {
> - const uno::Sequence< sal_Int8 > aDataSeq( (sal_Int8 *)data, len );
> - xOutputStream->writeBytes( aDataSeq );
> - }
> -}
> -
> -void SerfPostReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - // nothing to do;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx
> deleted file mode 100644
> index a0420faf3c..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfPostReqProcImpl.hxx
> +++ /dev/null
> @@ -1,79 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFPOSTREQPROCIMPL_HXX
> -#define INCLUDED_SERFPOSTREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -#include "SerfInputStream.hxx"
> -#include <com/sun/star/io/XOutputStream.hpp>
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfPostReqProcImpl : public SerfRequestProcessorImpl
> -{
> -public:
> - SerfPostReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inData,
> - apr_size_t inDataLen,
> - const char* inLockToken,
> - const char* inContentType,
> - const char* inReferer,
> - const com::sun::star::uno::Reference< SerfInputStream > & xioInStrm );
> -
> - SerfPostReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inData,
> - apr_size_t inDataLen,
> - const char* inLockToken,
> - const char* inContentType,
> - const char* inReferer,
> - const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > & xioOutStrm );
> -
> - virtual ~SerfPostReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -private:
> - const char* mpPostData;
> - apr_size_t mnPostDataLen;
> - const char* mpLockToken;
> - const char* mpContentType;
> - const char* mpReferer;
> - com::sun::star::uno::Reference< SerfInputStream > xInputStream;
> - com::sun::star::uno::Reference< com::sun::star::io::XOutputStream > xOutputStream;
> -
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFPOSTREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx
> deleted file mode 100644
> index 806f50a00b..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.cxx
> +++ /dev/null
> @@ -1,202 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfPropFindReqProcImpl.hxx"
> -#include "SerfTypes.hxx"
> -#include "DAVProperties.hxx"
> -
> -#include "webdavresponseparser.hxx"
> -#include <comphelper/seqstream.hxx>
> -#include <rtl/ustrbuf.hxx>
> -
> -
> -using namespace com::sun::star;
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfPropFindReqProcImpl::SerfPropFindReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const Depth inDepth,
> - const std::vector< ::rtl::OUString > & inPropNames,
> - std::vector< DAVResource > & ioResources )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , mDepthStr( 0 )
> - , mpPropNames( &inPropNames )
> - , mpResources( &ioResources )
> - , mpResInfo( 0 )
> - , mbOnlyPropertyNames( false )
> - , xInputStream( new SerfInputStream() )
> -{
> - init( inDepth );
> -}
> -
> -SerfPropFindReqProcImpl::SerfPropFindReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const Depth inDepth,
> - std::vector< DAVResourceInfo > & ioResInfo )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , mDepthStr( 0 )
> - , mpPropNames( 0 )
> - , mpResources( 0 )
> - , mpResInfo( &ioResInfo )
> - , mbOnlyPropertyNames( true )
> - , xInputStream( new SerfInputStream() )
> -{
> - init( inDepth );
> -}
> -
> -void SerfPropFindReqProcImpl::init( const Depth inDepth )
> -{
> - switch ( inDepth )
> - {
> - case DAVZERO:
> - mDepthStr = "0";
> - break;
> - case DAVONE:
> - mDepthStr = "1";
> - break;
> - case DAVINFINITY:
> - mDepthStr = "infinity";
> - break;
> - }
> -}
> -
> -SerfPropFindReqProcImpl::~SerfPropFindReqProcImpl()
> -{
> -}
> -
> -#define PROPFIND_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?><propfind xmlns=\"DAV:\">"
> -#define PROPFIND_TRAILER "</propfind>"
> -
> -serf_bucket_t * SerfPropFindReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
> -
> - // body bucket - certain properties OR all properties OR only property names
> - serf_bucket_t* body_bkt = 0;
> - rtl::OString aBodyText;
> - {
> - // TODO is it really needed a Unicode string buffer?
> - // All properties and property names aren't supposed to be ASCII?
> - rtl::OUStringBuffer aBuffer;
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPFIND_HEADER ));
> -
> - // create and fill body bucket with requested properties
> - const int nPropCount = ( !mbOnlyPropertyNames && mpPropNames )
> - ? mpPropNames->size()
> - : 0;
> - if ( nPropCount > 0 )
> - {
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<prop>" ) );
> - SerfPropName thePropName;
> - for ( int theIndex = 0; theIndex < nPropCount; theIndex ++ )
> - {
> - // split fullname into namespace and name!
> - DAVProperties::createSerfPropName( (*mpPropNames)[ theIndex ],
> - thePropName );
> -
> - /* <*propname* xmlns="*propns*" /> */
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<" ));
> - aBuffer.appendAscii( thePropName.name );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " xmlnx=\"" ));
> - aBuffer.appendAscii( thePropName.nspace );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\"/>" ));
> - }
> -
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</prop>" ));
> - }
> - else
> - {
> - if ( mbOnlyPropertyNames )
> - {
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<propname/>" ));
> - }
> - else
> - {
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<allprop/>" ));
> - }
> - }
> -
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPFIND_TRAILER ));
> - aBodyText = rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
> - body_bkt = serf_bucket_simple_copy_create( aBodyText.getStr(),
> - aBodyText.getLength(),
> - pSerfBucketAlloc );
> - }
> -
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "PROPFIND",
> - 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 );
> - if (hdrs_bkt != NULL)
> - {
> - // 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, "Content-Type", "application/xml" );
> - }
> - }
> - else
> - {
> - OSL_ASSERT("Headers Bucket missing");
> - }
> -
> - return req_bkt;
> -}
> -
> -void SerfPropFindReqProcImpl::processChunkOfResponseData( const char* data,
> - apr_size_t len )
> -{
> - if ( xInputStream.is() )
> - {
> - xInputStream->AddToStream( data, len );
> - }
> -}
> -
> -void SerfPropFindReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - if ( mbOnlyPropertyNames )
> - {
> - const std::vector< DAVResourceInfo > rResInfo( parseWebDAVPropNameResponse( xInputStream.get() ) );
> - *mpResInfo = rResInfo;
> - }
> - else
> - {
> - const std::vector< DAVResource > rResources( parseWebDAVPropFindResponse( xInputStream.get() ) );
> - *mpResources = rResources;
> - }
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx
> deleted file mode 100644
> index b6870a85ec..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfPropFindReqProcImpl.hxx
> +++ /dev/null
> @@ -1,77 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFPROPFINDREQPROCIMPL_HXX
> -#define INCLUDED_SERFPROPFINDREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -#include <vector>
> -#include <rtl/ustring.hxx>
> -#include "DAVTypes.hxx"
> -#include "DAVResource.hxx"
> -
> -#include "SerfInputStream.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfPropFindReqProcImpl : public SerfRequestProcessorImpl
> -{
> -public:
> - SerfPropFindReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const Depth inDepth,
> - const std::vector< ::rtl::OUString > & inPropNames,
> - std::vector< DAVResource > & ioResources );
> -
> - SerfPropFindReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const Depth inDepth,
> - std::vector< DAVResourceInfo > & ioResInfo );
> -
> - virtual ~SerfPropFindReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -private:
> - void init( const Depth inDepth );
> -
> - const char* mDepthStr;
> - const std::vector< ::rtl::OUString > * mpPropNames;
> - std::vector< DAVResource > * mpResources;
> - std::vector< DAVResourceInfo > * mpResInfo;
> -
> - const bool mbOnlyPropertyNames;
> - com::sun::star::uno::Reference< SerfInputStream > xInputStream;
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFPROPFINDREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx
> deleted file mode 100644
> index 57c7e7350b..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.cxx
> +++ /dev/null
> @@ -1,200 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include <rtl/ustring.hxx>
> -#include <rtl/ustrbuf.hxx>
> -#include "DAVProperties.hxx"
> -#include "UCBDeadPropertyValue.hxx"
> -
> -#include "SerfPropPatchReqProcImpl.hxx"
> -#include "SerfTypes.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfPropPatchReqProcImpl::SerfPropPatchReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const std::vector< ProppatchValue > & inProperties,
> - const char* inLockToken )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , mpProperties( &inProperties )
> - , mpLockToken( inLockToken )
> -{
> -}
> -
> -SerfPropPatchReqProcImpl::~SerfPropPatchReqProcImpl()
> -{
> -}
> -
> -#define PROPPATCH_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?><propertyupdate xmlns=\"DAV:\">"
> -#define PROPPATCH_TRAILER "</propertyupdate>"
> -
> -serf_bucket_t * SerfPropPatchReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
> -
> - // body bucket
> - serf_bucket_t* body_bkt = 0;
> - rtl::OString aBodyText;
> - {
> - // create and fill body bucket with properties to be set or removed
> - static const struct
> - {
> - const char *str;
> - sal_Int32 len;
> - }
> - OpCode [] = {
> - { RTL_CONSTASCII_STRINGPARAM( "set" ) },
> - { RTL_CONSTASCII_STRINGPARAM( "remove" ) }
> - };
> - const int nPropCount = ( mpProperties != 0 )
> - ? mpProperties->size()
> - : 0;
> - if ( nPropCount > 0 )
> - {
> - rtl::OUStringBuffer aBuffer;
> - // add PropPatch xml header in front
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPPATCH_HEADER ));
> -
> - // <*operation code*><prop>
> -
> - ProppatchOperation lastOp = (*mpProperties)[ 0 ].operation;
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<" ));
> - aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><prop>" ));
> -
> - SerfPropName thePropName;
> - for ( int n = 0; n < nPropCount; ++n )
> - {
> - const ProppatchValue & rProperty = (*mpProperties)[ n ];
> - // split fullname into namespace and name!
> - DAVProperties::createSerfPropName( rProperty.name,
> - thePropName );
> -
> - if ( rProperty.operation != lastOp )
> - {
> - // </prop></*last operation code*><*operation code><prop>
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</prop></" ));
> - aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><" ));
> - aBuffer.appendAscii( OpCode[rProperty.operation].str, OpCode[rProperty.operation].len );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "><prop>" ));
> - }
> -
> - // <*propname* xmlns="*propns*"
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "<" ));
> - aBuffer.appendAscii( thePropName.name );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( " xmlns=\"" ));
> - aBuffer.appendAscii( thePropName.nspace );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ));
> -
> - if ( rProperty.operation == PROPSET )
> - {
> - // >*property value*</*propname*>
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" ));
> -
> - rtl::OUString aStringValue;
> - if ( DAVProperties::isUCBDeadProperty( thePropName ) )
> - {
> - UCBDeadPropertyValue::toXML( rProperty.value,
> - aStringValue );
> - }
> - else
> - {
> - rProperty.value >>= aStringValue;
> - }
> - aBuffer.append( aStringValue );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</" ));
> - aBuffer.appendAscii( thePropName.name );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" ));
> - }
> - else
> - {
> - // />
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "/>" ));
> - }
> -
> - lastOp = rProperty.operation;
> - }
> -
> - // </prop></*last operation code*>
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "</prop></" ));
> - aBuffer.appendAscii( OpCode[lastOp].str, OpCode[lastOp].len );
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( ">" ));
> -
> - // add PropPatch xml trailer at end
> - aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( PROPPATCH_TRAILER ));
> -
> - aBodyText = rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
> - body_bkt = serf_bucket_simple_copy_create( aBodyText.getStr(),
> - aBodyText.getLength(),
> - pSerfBucketAlloc );
> - }
> - }
> -
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "PROPPATCH",
> - 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 );
> - if (hdrs_bkt != NULL)
> - {
> - // general header fields provided by caller
> - setRequestHeaders( hdrs_bkt );
> -
> - // request specific header fields
> - if(mpLockToken)
> - {
> - serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
> - }
> - if ( body_bkt != 0 && aBodyText.getLength() > 0 )
> - {
> - serf_bucket_headers_set( hdrs_bkt, "Content-Type", "application/xml" );
> - }
> - }
> - else
> - {
> - OSL_ASSERT("Headers Bucket missing");
> - }
> -
> - return req_bkt;
> -}
> -
> -void SerfPropPatchReqProcImpl::processChunkOfResponseData( const char* /*data*/,
> - apr_size_t /*len*/ )
> -{
> - // nothing to do;
> -}
> -
> -void SerfPropPatchReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - // nothing to do;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx
> deleted file mode 100644
> index 454344d750..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfPropPatchReqProcImpl.hxx
> +++ /dev/null
> @@ -1,60 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFPROPPATCHREQPROCIMPL_HXX
> -#define INCLUDED_SERFPROPPATCHREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -#include <vector>
> -#include "DAVTypes.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfPropPatchReqProcImpl : public SerfRequestProcessorImpl
> -{
> -public:
> - SerfPropPatchReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const std::vector< ProppatchValue > & inProperties,
> - const char* inLockToken );
> -
> - virtual ~SerfPropPatchReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -private:
> - const std::vector< ProppatchValue > * mpProperties;
> - const char *mpLockToken;
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFPROPPATCHREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx b/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
> deleted file mode 100644
> index 2057705458..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.cxx
> +++ /dev/null
> @@ -1,93 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include <rtl/ustring.hxx>
> -
> -#include "SerfPutReqProcImpl.hxx"
> -
> -#include <serf.h>
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfPutReqProcImpl::SerfPutReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inData,
> - const char* inLockToken,
> - apr_size_t inDataLen )
> - : SerfRequestProcessorImpl( inPath, inRequestHeaders )
> - , mpData( inData )
> - , mpLockToken( inLockToken)
> - , mnDataLen( inDataLen )
> -{
> -}
> -
> -SerfPutReqProcImpl::~SerfPutReqProcImpl()
> -{
> -}
> -
> -serf_bucket_t * SerfPutReqProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
> -{
> - serf_bucket_alloc_t* pSerfBucketAlloc = serf_request_get_alloc( inSerfRequest );
> -
> - // create body bucket
> - serf_bucket_t* body_bkt = 0;
> - if ( mpData != 0 && mnDataLen > 0 )
> - {
> - body_bkt = SERF_BUCKET_SIMPLE_STRING_LEN( mpData, mnDataLen, pSerfBucketAlloc );
> - }
> -
> - // create serf request
> - serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
> - "PUT",
> - getPathStr(),
> - body_bkt,
> - serf_request_get_alloc( inSerfRequest ) );
> - handleChunkedEncoding(req_bkt, mnDataLen);
> -
> - // 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 );
> - if(mpLockToken)
> - {
> - // request specific header field
> - serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
> - }
> -
> - return req_bkt;
> -}
> -
> -void SerfPutReqProcImpl::processChunkOfResponseData( const char* /*data*/,
> - apr_size_t /*len*/ )
> -{
> - // nothing to do;
> -}
> -
> -void SerfPutReqProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
> -{
> - // nothing to do;
> -}
> -
> -} // namespace http_dav_ucp
> diff --git a/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx b/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx
> deleted file mode 100644
> index 887e1612d2..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfPutReqProcImpl.hxx
> +++ /dev/null
> @@ -1,61 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -#ifndef INCLUDED_SERFPUTREQPROCIMPL_HXX
> -#define INCLUDED_SERFPUTREQPROCIMPL_HXX
> -
> -#include "SerfRequestProcessorImpl.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfPutReqProcImpl : public SerfRequestProcessorImpl
> -{
> -public:
> - SerfPutReqProcImpl( const char* inPath,
> - const DAVRequestHeaders& inRequestHeaders,
> - const char* inData,
> - const char* inLockToken,
> - apr_size_t inDataLen );
> -
> -
> - virtual ~SerfPutReqProcImpl();
> -
> - virtual
> - serf_bucket_t * createSerfRequestBucket( serf_request_t * inSerfRequest );
> -
> -protected:
> - virtual
> - void processChunkOfResponseData( const char* data, apr_size_t len );
> -
> - virtual
> - void handleEndOfResponseData( serf_bucket_t * inSerfResponseBucket );
> -
> -private:
> - const char* mpData;
> - const char* mpLockToken;
> - apr_size_t mnDataLen;
> -
> -};
> -
> -} // namespace http_dav_ucp
> -
> -#endif // INCLUDED_SERFPUTREQPROCIMPL_HXX
> diff --git a/main/ucb/source/ucp/webdav/SerfRequestProcessor.cxx b/main/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
> deleted file mode 100644
> index e3786301d8..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfRequestProcessor.cxx
> +++ /dev/null
> @@ -1,721 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -// MARKER(update_precomp.py): autogen include statement, do not remove
> -#include "precompiled_webdav.hxx"
> -
> -#include "SerfRequestProcessor.hxx"
> -#include "SerfRequestProcessorImpl.hxx"
> -#include "SerfRequestProcessorImplFac.hxx"
> -#include "SerfCallbacks.hxx"
> -#include "SerfSession.hxx"
> -
> -#include <apr_strings.h>
> -
> -//to examine returned http code
> -#include "DAVException.hxx"
> -
> -namespace http_dav_ucp
> -{
> -
> -SerfRequestProcessor::SerfRequestProcessor( SerfSession& rSerfSession,
> - const rtl::OUString & inPath,
> - const bool bUseChunkedEncoding )
> - : mrSerfSession( rSerfSession )
> - , mPathStr( 0 )
> - , mbUseChunkedEncoding( bUseChunkedEncoding )
> - , mDestPathStr( 0 )
> - , mContentType( 0 )
> - , mReferer( 0 )
> - , mpProcImpl( 0 )
> - , mbProcessingDone( false )
> - , mpDAVException()
> - , mnHTTPStatusCode( SC_NONE )
> - , mHTTPStatusCodeText()
> - , mRedirectLocation()
> - , mnSuccessfulCredentialAttempts( 0 )
> - , mbInputOfCredentialsAborted( false )
> - , mbSetupSerfRequestCalled( false )
> - , mbAcceptSerfResponseCalled( false )
> - , mbHandleSerfResponseCalled( false )
> -{
> - mPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inPath, RTL_TEXTENCODING_UTF8 ).getStr() );
> -}
> -
> -SerfRequestProcessor::~SerfRequestProcessor()
> -{
> - delete mpProcImpl;
> - delete mpDAVException;
> -}
> -
> -void SerfRequestProcessor::prepareProcessor()
> -{
> - delete mpDAVException;
> - mpDAVException = 0;
> - mnHTTPStatusCode = SC_NONE;
> - mHTTPStatusCodeText = rtl::OUString();
> - mRedirectLocation = rtl::OUString();
> -
> - mnSuccessfulCredentialAttempts = 0;
> - mbInputOfCredentialsAborted = false;
> - mbSetupSerfRequestCalled = false;
> - mbAcceptSerfResponseCalled = false;
> - mbHandleSerfResponseCalled = false;
> -}
> -
> -// PROPFIND - allprop & named
> -bool SerfRequestProcessor::processPropFind( const Depth inDepth,
> - const std::vector< ::rtl::OUString > & inPropNames,
> - std::vector< DAVResource > & ioResources,
> - apr_status_t& outSerfStatus )
> -{
> - mpProcImpl = createPropFindReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inDepth,
> - inPropNames,
> - ioResources );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// PROPFIND - property names
> -bool SerfRequestProcessor::processPropFind( const Depth inDepth,
> - std::vector< DAVResourceInfo > & ioResInfo,
> - apr_status_t& outSerfStatus )
> -{
> - mpProcImpl = createPropFindReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inDepth,
> - ioResInfo );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// PROPPATCH
> -bool SerfRequestProcessor::processPropPatch( const std::vector< ProppatchValue > & inProperties,
> - const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus )
> -{
> - char * inLockToken = static_cast<char*>(0);
> - if(inLock.LockTokens.getLength() > 0)
> - {
> - inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> - }
> - mpProcImpl = createPropPatchReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inProperties,
> - inLockToken );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// GET
> -bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
> - apr_status_t& outSerfStatus )
> -{
> - mpProcImpl = createGetReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - xioInStrm );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// GET inclusive header fields
> -bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource,
> - apr_status_t& outSerfStatus )
> -{
> - mpProcImpl = createGetReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - xioInStrm,
> - inHeaderNames,
> - ioResource );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// GET
> -bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
> - apr_status_t& outSerfStatus )
> -{
> - mpProcImpl = createGetReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - xioOutStrm );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// GET inclusive header fields
> -bool SerfRequestProcessor::processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource,
> - apr_status_t& outSerfStatus )
> -{
> - mpProcImpl = createGetReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - xioOutStrm,
> - inHeaderNames,
> - ioResource );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// HEAD
> -bool SerfRequestProcessor::processHead( const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource,
> - apr_status_t& outSerfStatus )
> -{
> - mpProcImpl = createHeadReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inHeaderNames,
> - ioResource );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// PUT
> -bool SerfRequestProcessor::processPut( const char* inData,
> - apr_size_t inDataLen,
> - const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus )
> -{
> - char * inLockToken = static_cast<char*>(0);
> - if(inLock.LockTokens.getLength() > 0)
> - {
> - inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> - }
> - mpProcImpl = createPutReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inData,
> - inLockToken,
> - inDataLen );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// POST
> -bool SerfRequestProcessor::processPost( const char* inData,
> - apr_size_t inDataLen,
> - const rtl::OUString & inContentType,
> - const rtl::OUString & inReferer,
> - const com::sun::star::ucb::Lock inLock,
> - const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
> - apr_status_t& outSerfStatus )
> -{
> - mContentType = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inContentType, RTL_TEXTENCODING_UTF8 ).getStr() );
> - mReferer = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inReferer, RTL_TEXTENCODING_UTF8 ).getStr() );
> - char * inLockToken = static_cast<char*>(0);
> - if(inLock.LockTokens.getLength() > 0)
> - {
> - inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> - }
> - mpProcImpl = createPostReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inData,
> - inDataLen,
> - inLockToken,
> - mContentType,
> - mReferer,
> - xioInStrm );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// POST
> -bool SerfRequestProcessor::processPost( const char* inData,
> - apr_size_t inDataLen,
> - const rtl::OUString & inContentType,
> - const rtl::OUString & inReferer,
> - const com::sun::star::ucb::Lock inLock,
> - const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
> - apr_status_t& outSerfStatus )
> -{
> - mContentType = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inContentType, RTL_TEXTENCODING_UTF8 ).getStr() );
> - mReferer = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inReferer, RTL_TEXTENCODING_UTF8 ).getStr() );
> - char * inLockToken = static_cast<char*>(0);
> - if(inLock.LockTokens.getLength() > 0)
> - {
> - inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> - }
> - mpProcImpl = createPostReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inData,
> - inDataLen,
> - inLockToken,
> - mContentType,
> - mReferer,
> - xioOutStrm );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// DELETE
> -bool SerfRequestProcessor::processDelete( const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus )
> -{
> - char * inLockToken = static_cast<char*>(0);
> - if(inLock.LockTokens.getLength() > 0)
> - {
> - inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> - }
> - mpProcImpl = createDeleteReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inLockToken );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// MKCOL
> -bool SerfRequestProcessor::processMkCol( const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus )
> -{
> - char * inLockToken = static_cast<char*>(0);
> - if(inLock.LockTokens.getLength() > 0)
> - {
> - inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> - }
> - mpProcImpl = createMkColReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inLockToken );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// COPY
> -bool SerfRequestProcessor::processCopy( const rtl::OUString & inDestinationPath,
> - const bool inOverwrite,
> - const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus )
> -{
> - mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
> - char * inLockToken = static_cast<char*>(0);
> - if(inLock.LockTokens.getLength() > 0)
> - {
> - inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> - }
> - mpProcImpl = createCopyReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - mDestPathStr,
> - inOverwrite,
> - inLockToken );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -// MOVE
> -bool SerfRequestProcessor::processMove( const rtl::OUString & inDestinationPath,
> - const bool inOverwrite,
> - const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus )
> -{
> - mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
> - char * inLockToken = static_cast<char*>(0);
> - if(inLock.LockTokens.getLength() > 0)
> - {
> - inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> - }
> - mpProcImpl = createMoveReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - mDestPathStr,
> - inOverwrite,
> - inLockToken );
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -//LOCK creating a new lock
> -bool SerfRequestProcessor::processLock( const rtl::OUString & inDestinationPath,
> - const com::sun::star::ucb::Lock& inLock,
> - DAVPropertyValue & outLock,
> - apr_status_t& outSerfStatus )
> -{
> - mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
> - char * Timeout;
> - if(inLock.Timeout == -1)
> - Timeout = apr_psprintf( mrSerfSession.getAprPool(), "Infinite" );
> - else
> - Timeout = apr_psprintf( mrSerfSession.getAprPool(), "Second-%ld", inLock.Timeout );
> -
> - mpProcImpl = createLockReqProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inLock,
> - Timeout,
> - outLock);
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -//LOCK refresh an existing lock
> -bool SerfRequestProcessor::processLockRefresh( const rtl::OUString & inDestinationPath,
> - const com::sun::star::ucb::Lock& inLock,
> - DAVPropertyValue & outLock,
> - apr_status_t& outSerfStatus )
> -{
> - mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
> - char * Timeout;
> - if(inLock.Timeout == -1)
> - Timeout = apr_psprintf( mrSerfSession.getAprPool(), "Infinite" );
> - else
> - Timeout = apr_psprintf( mrSerfSession.getAprPool(), "Second-%ld", inLock.Timeout );
> -
> - char * inLockToken = apr_psprintf( mrSerfSession.getAprPool(), "(<%s>)",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> -
> - mpProcImpl = createLockRefreshProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inLock,
> - inLockToken,
> - Timeout,
> - outLock);
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -//ULOCK unlock an existing lock
> -bool SerfRequestProcessor::processUnlock( const rtl::OUString & inDestinationPath,
> - const com::sun::star::ucb::Lock& inLock,
> - apr_status_t& outSerfStatus )
> -{
> - mDestPathStr = apr_pstrdup( mrSerfSession.getAprPool(),
> - rtl::OUStringToOString( inDestinationPath, RTL_TEXTENCODING_UTF8 ).getStr() );
> -
> - char * aToken = apr_psprintf( mrSerfSession.getAprPool(), "<%s>",
> - rtl::OUStringToOString(inLock.LockTokens[0], RTL_TEXTENCODING_UTF8 ).getStr() );
> -
> - mpProcImpl = createUnlockProcImpl( mPathStr,
> - mrSerfSession.getRequestEnvironment().m_aRequestHeaders,
> - inLock,
> - aToken );
> -
> - outSerfStatus = runProcessor();
> -
> - return outSerfStatus == APR_SUCCESS;
> -}
> -
> -apr_status_t SerfRequestProcessor::runProcessor()
> -{
> - prepareProcessor();
> -
> - // activate chunked encoding, if requested
> - if ( mbUseChunkedEncoding )
> - {
> - mpProcImpl->activateChunkedEncoding();
> - }
> -
> - // create serf request
> - OSL_ASSERT(mrSerfSession.getSerfConnection() != NULL);
> - serf_connection_request_create( mrSerfSession.getSerfConnection(),
> - Serf_SetupRequest,
> - this );
> -
> - // perform serf request
> - mbProcessingDone = false;
> - apr_status_t status = APR_SUCCESS;
> - serf_context_t* pSerfContext = mrSerfSession.getSerfContext();
> - apr_pool_t* pAprPool = mrSerfSession.getAprPool();
> - while ( true )
> - {
> - status = serf_context_run( pSerfContext,
> - SERF_DURATION_FOREVER,
> - pAprPool );
> - if ( APR_STATUS_IS_TIMEUP( status ) )
> - {
> - continue;
> - }
> - if ( status != APR_SUCCESS )
> - {
> -#if OSL_DEBUG_LEVEL > 0
> - char buff[512];
> - OSL_TRACE("SerfRequestProcessor::runProcessor, status != APR_SUCCESS: %d (%s)",status, apr_strerror(status, buff, 512));
> -#endif
> - break;
> - }
> - if ( mbProcessingDone )
> - {
> - break;
> - }
> - }
> -
> - postprocessProcessor( status );
> -
> - return status;
> -}
> -
> -void SerfRequestProcessor::postprocessProcessor( const apr_status_t inStatus )
> -{
> - if ( inStatus == APR_SUCCESS )
> - {
> - return;
> - }
> -
> - OSL_TRACE("SerfRequestProcessor::postprocessProcessor:%d",__LINE__);
> - switch ( inStatus )
> - {
> - case APR_EGENERAL:
> - case SERF_ERROR_AUTHN_FAILED:
> - // general error; <mnHTTPStatusCode> provides more information
> - {
> - switch ( mnHTTPStatusCode )
> - {
> - case SC_NONE:
> - if ( !mbSetupSerfRequestCalled )
> - {
> - mpDAVException = new DAVException( DAVException::DAV_HTTP_LOOKUP,
> - SerfUri::makeConnectionEndPointString( mrSerfSession.getHostName(),
> - mrSerfSession.getPort() ) );
> - }
> - else if ( mbInputOfCredentialsAborted )
> - {
> - mpDAVException = new DAVException( DAVException::DAV_HTTP_NOAUTH,
> - SerfUri::makeConnectionEndPointString( mrSerfSession.getHostName(),
> - mrSerfSession.getPort() ) );
> - }
> - else
> - {
> - mpDAVException = new DAVException( DAVException::DAV_HTTP_ERROR,
> - mHTTPStatusCodeText,
> - mnHTTPStatusCode );
> - }
> - break;
> - case SC_MOVED_PERMANENTLY:
> - case SC_MOVED_TEMPORARILY:
> - case SC_SEE_OTHER:
> - case SC_TEMPORARY_REDIRECT:
> - mpDAVException = new DAVException( DAVException::DAV_HTTP_REDIRECT,
> - mRedirectLocation );
> - break;
> - case SC_LOCKED:
> - mpDAVException = new DAVException( DAVException::DAV_LOCKED,
> - mHTTPStatusCodeText,
> - mnHTTPStatusCode );
> - break;
> - default:
> - mpDAVException = new DAVException( DAVException::DAV_HTTP_ERROR,
> - mHTTPStatusCodeText,
> - mnHTTPStatusCode );
> - break;
> - }
> - }
> - break;
> -
> - default:
> - mpDAVException = new DAVException( DAVException::DAV_HTTP_ERROR );
> - break;
> - }
> -}
> -
> -apr_status_t SerfRequestProcessor::provideSerfCredentials( char ** outUsername,
> - char ** outPassword,
> - serf_request_t * inRequest,
> - int inCode,
> - const char *inAuthProtocol,
> - const char *inRealm,
> - apr_pool_t *inAprPool )
> -{
> - // as each successful provided credentials are tried twice - see below - the
> - // number of real attempts is half of the value of <mnSuccessfulCredentialAttempts>
> - if ( (mnSuccessfulCredentialAttempts / 2) >= 5 ||
> - mbInputOfCredentialsAborted )
> - {
> - mbInputOfCredentialsAborted = true;
> - return SERF_ERROR_AUTHN_FAILED;
> - }
> -
> - // because serf keeps credentials only for a connection in case of digest authentication
> - // we give each successful provided credentials a second try in order to workaround the
> - // situation that the connection for which the credentials have been provided has been closed
> - // before the provided credentials could be applied for the request.
> - apr_status_t status = mrSerfSession.provideSerfCredentials( (mnSuccessfulCredentialAttempts % 2) == 1,
> - outUsername,
> - outPassword,
> - inRequest,
> - inCode,
> - inAuthProtocol,
> - inRealm,
> - inAprPool );
> - if ( status != APR_SUCCESS )
> - {
> - mbInputOfCredentialsAborted = true;
> - }
> - else
> - {
> - ++mnSuccessfulCredentialAttempts;
> - }
> -
> - return status;
> -}
> -
> -apr_status_t SerfRequestProcessor::setupSerfRequest( serf_request_t * inSerfRequest,
> - serf_bucket_t ** outSerfRequestBucket,
> - serf_response_acceptor_t * outSerfResponseAcceptor,
> - void ** outSerfResponseAcceptorBaton,
> - serf_response_handler_t * outSerfResponseHandler,
> - void ** outSerfResponseHandlerBaton,
> - apr_pool_t * /*inAprPool*/ )
> -{
> - mbSetupSerfRequestCalled = true;
> - *outSerfRequestBucket = mpProcImpl->createSerfRequestBucket( inSerfRequest );
> -
> - // apply callbacks for accepting response and handling response
> - *outSerfResponseAcceptor = Serf_AcceptResponse;
> - *outSerfResponseAcceptorBaton = this;
> - *outSerfResponseHandler = Serf_HandleResponse;
> - *outSerfResponseHandlerBaton = this;
> -
> - return APR_SUCCESS;
> -}
> -
> -serf_bucket_t* SerfRequestProcessor::acceptSerfResponse( serf_request_t * inSerfRequest,
> - serf_bucket_t * inSerfStreamBucket,
> - apr_pool_t * inAprPool )
> -{
> - mbAcceptSerfResponseCalled = true;
> - return mrSerfSession.acceptSerfResponse( inSerfRequest,
> - inSerfStreamBucket,
> - inAprPool );
> -}
> -
> -apr_status_t SerfRequestProcessor::handleSerfResponse( serf_request_t * inSerfRequest,
> - serf_bucket_t * inSerfResponseBucket,
> - apr_pool_t * inAprPool )
> -{
> - mbHandleSerfResponseCalled = true;
> -
> - // some general response handling and error handling
> - {
> - if ( !inSerfResponseBucket )
> - {
> - /* A NULL response can come back if the request failed completely */
> - mbProcessingDone = true;
> - return APR_EGENERAL;
> - }
> -
> - serf_status_line sl;
> - apr_status_t status = serf_bucket_response_status( inSerfResponseBucket, &sl );
> - if ( status )
> - {
> - mbProcessingDone = false; // allow another try in order to get a response
> - return status;
> - }
> - serf_bucket_t *headers = serf_bucket_response_get_headers( inSerfResponseBucket );
> -
> - // check header according:
> - // http://tools.ietf.org/html/rfc7231#section-7.4.2
> - // need to do this so we can adjust the protocol accordingly
> - // serf_bucket_headers_get is case independent
> - const char* server = serf_bucket_headers_get( headers, "server" );
> - if( server )
> - {
> - //update the server type on session
> - mrSerfSession.setServerHeaderField( ::rtl::OUString::createFromAscii( server ) );
> - }
> - //the following extension is MS IIS specific,
> - //see https://msdn.microsoft.com/en-us/library/cc250064.aspx
> - //site last checked on 2015-03-02
> - //TODO i126305 need to be added when serf is updated to a version supporting Windows authentication
> - //const char* msDavExtErr = serf_bucket_headers_get( headers, "X-MSDAVEXT_ERROR" );
> -
> - // TODO - check, if response status code handling is correct
> - mnHTTPStatusCode = ( sl.version != 0 && sl.code >= 0 )
> - ? static_cast< sal_uInt16 >( sl.code )
> - : SC_NONE;
> - if ( sl.reason )
> - {
> - mHTTPStatusCodeText = ::rtl::OUString::createFromAscii( sl.reason );
> - }
> - if ( ( sl.version == 0 || sl.code < 0 ) ||
> - mnHTTPStatusCode >= 300 )
> - {
> - if ( mnHTTPStatusCode == 301 ||
> - mnHTTPStatusCode == 302 ||
> - mnHTTPStatusCode == 303 ||
> - mnHTTPStatusCode == 307 )
> - {
> - // new location for certain redirections
> - const char* location = serf_bucket_headers_get( headers, "Location" );
> - if ( location )
> - {
> - mRedirectLocation = rtl::OUString::createFromAscii( location );
> - }
> - mbProcessingDone = true;
> - return APR_EGENERAL;
> - }
> - else if ( mrSerfSession.isHeadRequestInProgress() &&
> - ( mnHTTPStatusCode == 401 || mnHTTPStatusCode == 407 ) )
> - {
> - // keep going as authentication is not required on HEAD request.
> - // the response already contains header fields.
> - }
> - else
> - {
> - mbProcessingDone = true;
> - return APR_EGENERAL;
> - }
> - }
> - }
> -
> - // request specific processing of the response bucket
> - apr_status_t status = APR_SUCCESS;
> - mbProcessingDone = mpProcImpl->processSerfResponseBucket( inSerfRequest,
> - inSerfResponseBucket,
> - inAprPool,
> - status );
> -
> - return status;
> -}
> -
> -} // namespace http_dav_ucp
> -
> diff --git a/main/ucb/source/ucp/webdav/SerfRequestProcessor.hxx b/main/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
> deleted file mode 100644
> index 36d63f0025..0000000000
> --- a/main/ucb/source/ucp/webdav/SerfRequestProcessor.hxx
> +++ /dev/null
> @@ -1,208 +0,0 @@
> -/**************************************************************
> - *
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing,
> - * software distributed under the License is distributed on an
> - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> - * KIND, either express or implied. See the License for the
> - * specific language governing permissions and limitations
> - * under the License.
> - *
> - *************************************************************/
> -
> -
> -#ifndef INCLUDED_SERFREQUESTPROCESSOR_HXX
> -#define INCLUDED_SERFREQUESTPROCESSOR_HXX
> -
> -#include <apr_errno.h>
> -#include <apr_pools.h>
> -
> -#include <serf.h>
> -
> -#include "DAVTypes.hxx"
> -#include "DAVResource.hxx"
> -#include "DAVException.hxx"
> -
> -#include "SerfTypes.hxx"
> -#include "SerfInputStream.hxx"
> -#include <com/sun/star/io/XOutputStream.hpp>
> -
> -namespace http_dav_ucp
> -{
> -
> -class SerfSession;
> -class SerfRequestProcessorImpl;
> -
> -class SerfRequestProcessor
> -{
> -public:
> - SerfRequestProcessor( SerfSession& rSerfSession,
> - const rtl::OUString & inPath,
> - const bool bUseChunkedEncoding );
> - ~SerfRequestProcessor();
> -
> - // PROPFIND - allprop & named
> - bool processPropFind( const Depth inDepth,
> - const std::vector< ::rtl::OUString > & inPropNames,
> - std::vector< DAVResource > & ioResources,
> - apr_status_t& outSerfStatus );
> -
> - // PROPFIND - property names
> - bool processPropFind( const Depth inDepth,
> - std::vector< DAVResourceInfo > & ioResInfo,
> - apr_status_t& outSerfStatus );
> -
> - // PROPPATCH
> - bool processPropPatch( const std::vector< ProppatchValue > & inProperties,
> - const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus );
> -
> - // GET
> - bool processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
> - apr_status_t& outSerfStatus );
> -
> - // GET inclusive header fields
> - bool processGet( const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource,
> - apr_status_t& outSerfStatus );
> -
> - // GET
> - bool processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
> - apr_status_t& outSerfStatus );
> -
> - // GET inclusive header fields
> - bool processGet( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
> - const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource,
> - apr_status_t& outSerfStatus );
> -
> - // HEAD
> - bool processHead( const std::vector< ::rtl::OUString > & inHeaderNames,
> - DAVResource & ioResource,
> - apr_status_t& outSerfStatus );
> -
> - // PUT
> - bool processPut( const char* inData,
> - apr_size_t inDataLen,
> - const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus );
> -
> - // POST
> - bool processPost( const char* inData,
> - apr_size_t inDataLen,
> - const rtl::OUString & inContentType,
> - const rtl::OUString & inReferer,
> - const com::sun::star::ucb::Lock inLock,
> - const com::sun::star::uno::Reference< SerfInputStream >& xioInStrm,
> - apr_status_t& outSerfStatus );
> -
> - // POST
> - bool processPost( const char* inData,
> - apr_size_t inDataLen,
> - const rtl::OUString & inContentType,
> - const rtl::OUString & inReferer,
> - const com::sun::star::ucb::Lock inLock,
> - const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xioOutStrm,
> - apr_status_t& outSerfStatus );
> -
> - // DELETE
> - bool processDelete( const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus );
> -
> - // MKCOL
> - bool processMkCol( const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus );
> -
> - // COPY
> - bool processCopy( const rtl::OUString & inDestinationPath,
> - const bool inOverwrite,
> - const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus );
> -
> - // MOVE
> - bool processMove( const rtl::OUString & inDestinationPath,
> - const bool inOverwrite,
> - const com::sun::star::ucb::Lock inLock,
> - apr_status_t& outSerfStatus );
> -
> - // LOCK
> - bool processLock( const rtl::OUString & inDestinationPath,
> ... 2846 lines suppressed ...
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org
Re: (openoffice) 01/12: Port our WebDAV content provider from serf/apr/apr-util, to curl.
Posted by Arrigo Marchiori <ar...@apache.org>.
Hello Dave,
On Sat, Apr 27, 2024 at 09:45:46AM -0700, Dave Fisher wrote:
> Hi Arrigo,
>
> With this change do we eliminate all dependencies on Apache APR?
Yes, for AOO42X.
This is a cherry-pick of Damjan's work on trunk, so he may elaborate
further.
Apache APR and Serf remain a requirement of our AOO41X branch.
> > On Apr 27, 2024, at 9:32 AM, ardovm@apache.org wrote:
> >
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > ardovm pushed a commit to branch AOO42X
> > in repository https://gitbox.apache.org/repos/asf/openoffice.git
> >
> > commit 9646dec509b481cb88dbe1130c2f325ed13af748
> > Author: Damjan Jovanovic <da...@apache.org>
> > AuthorDate: Mon Apr 4 03:06:47 2022 +0200
> >
> > Port our WebDAV content provider from serf/apr/apr-util, to curl.
> >
> > Patch by: me
> >
> > (adapted from commit 51ba086bf122dbb5b50fd813e5b9a81c051aa16b by Arrigo
> > Marchiori)
> > ---
> > ext_libraries/apr-util/apr-util-1.6.1.apu.hw.patch | 13 -
> > ext_libraries/apr-util/apr-util-1.6.1.expat.patch | 17 -
> > .../apr-util/apr-util-1.6.1.makewin32.patch | 199 --
> > ext_libraries/apr-util/aprutil_version.mk | 24 -
> > ext_libraries/apr-util/makefile.mk | 139 --
> > ext_libraries/apr-util/prj/build.lst | 5 -
> > ext_libraries/apr-util/prj/d.lst | 15 -
> > ext_libraries/apr/apr-1.6.5-no-devenv.patch | 16 -
> > ext_libraries/apr/apr-1.6.5-windows.patch | 11 -
> > ext_libraries/apr/apr_version.mk | 24 -
> > ext_libraries/apr/makefile.mk | 128 --
> > ext_libraries/apr/prj/build.lst | 3 -
> > ext_libraries/apr/prj/d.lst | 24 -
> > ext_libraries/serf/NULbytes.patch | 313 ----
> > ext_libraries/serf/makefile.mk | 134 --
> > ext_libraries/serf/prj/build.lst | 3 -
> > ext_libraries/serf/prj/d.lst | 12 -
> > ext_libraries/serf/serf-1.2.1.ldl.patch | 11 -
> > ext_libraries/serf/serf-1.2.1.libs.patch | 11 -
> > ext_libraries/serf/serf-1.2.1.logging.patch | 27 -
> > ext_libraries/serf/serf_version.mk | 24 -
> > ext_libraries/serf/win/Library_serf.mk | 89 -
> > ext_libraries/serf/win/Makefile | 30 -
> > ext_libraries/serf/win/Module_serf.mk | 27 -
> > ext_libraries/serf/win/Package_inc.mk | 27 -
[...]
--
Arrigo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org
Re: (openoffice) 01/12: Port our WebDAV content provider from serf/apr/apr-util, to curl.
Posted by Damjan Jovanovic <da...@apache.org>.
On Sat, Apr 27, 2024 at 4:46 PM Dave Fisher <wa...@apache.org> wrote:
> Hi Arrigo,
>
> With this change do we eliminate all dependencies on Apache APR?
>
> Best,
> Dave
>
>
Yes. The ucb WebDAV module was their only user, so using Curl as the
HTTP(S) library, allowed apr, apr-util and serf to be removed as
dependencies. The total size of the AOO binaries decreased by about 0.5%.
Curl has also turned out to be a lovely library, permissively licensed,
easy to build, exceptionally well documented, integrates well with OpenSSL,
and easy to upgrade. In cases where we needed to understand some internal
details, the Curl code was well structured and easy to understand.
Regards
Damjan