13edf6992SAndrea Pescetti /**************************************************************
23edf6992SAndrea Pescetti *
33edf6992SAndrea Pescetti * Licensed to the Apache Software Foundation (ASF) under one
43edf6992SAndrea Pescetti * or more contributor license agreements. See the NOTICE file
53edf6992SAndrea Pescetti * distributed with this work for additional information
63edf6992SAndrea Pescetti * regarding copyright ownership. The ASF licenses this file
73edf6992SAndrea Pescetti * to you under the Apache License, Version 2.0 (the
83edf6992SAndrea Pescetti * "License"); you may not use this file except in compliance
93edf6992SAndrea Pescetti * with the License. You may obtain a copy of the License at
103edf6992SAndrea Pescetti *
113edf6992SAndrea Pescetti * http://www.apache.org/licenses/LICENSE-2.0
123edf6992SAndrea Pescetti *
133edf6992SAndrea Pescetti * Unless required by applicable law or agreed to in writing,
143edf6992SAndrea Pescetti * software distributed under the License is distributed on an
153edf6992SAndrea Pescetti * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
163edf6992SAndrea Pescetti * KIND, either express or implied. See the License for the
173edf6992SAndrea Pescetti * specific language governing permissions and limitations
183edf6992SAndrea Pescetti * under the License.
193edf6992SAndrea Pescetti *
203edf6992SAndrea Pescetti *************************************************************/
213edf6992SAndrea Pescetti
223edf6992SAndrea Pescetti // MARKER(update_precomp.py): autogen include statement, do not remove
233edf6992SAndrea Pescetti #include "precompiled_ucb.hxx"
243edf6992SAndrea Pescetti
253edf6992SAndrea Pescetti #include "SerfTypes.hxx"
263edf6992SAndrea Pescetti #include "SerfLockRefreshProcImpl.hxx"
273edf6992SAndrea Pescetti #include "DAVProperties.hxx"
283edf6992SAndrea Pescetti
293edf6992SAndrea Pescetti #include "webdavresponseparser.hxx"
30*726e2269SPedro Giffuni #include <serf.h>
313edf6992SAndrea Pescetti #include <rtl/ustrbuf.hxx>
32*726e2269SPedro Giffuni #include <apr_strings.h>
333edf6992SAndrea Pescetti
343edf6992SAndrea Pescetti namespace http_dav_ucp
353edf6992SAndrea Pescetti {
363edf6992SAndrea Pescetti
SerfLockRefreshProcImpl(const char * inSourcePath,const DAVRequestHeaders & inRequestHeaders,const ucb::Lock & inLock,const char * inLockToken,const char * inTimeout,DAVPropertyValue & outLock)373edf6992SAndrea Pescetti SerfLockRefreshProcImpl::SerfLockRefreshProcImpl( const char* inSourcePath,
383edf6992SAndrea Pescetti const DAVRequestHeaders& inRequestHeaders, // on debug the header look empty
393edf6992SAndrea Pescetti const ucb::Lock& inLock,
403edf6992SAndrea Pescetti const char* inLockToken,
413edf6992SAndrea Pescetti const char* inTimeout,
423edf6992SAndrea Pescetti DAVPropertyValue & outLock)
433edf6992SAndrea Pescetti : SerfLockReqProcImpl( inSourcePath, inRequestHeaders, inLock, inTimeout, outLock )
443edf6992SAndrea Pescetti , mpLockToken( inLockToken )
453edf6992SAndrea Pescetti {
463edf6992SAndrea Pescetti }
473edf6992SAndrea Pescetti
~SerfLockRefreshProcImpl()483edf6992SAndrea Pescetti SerfLockRefreshProcImpl::~SerfLockRefreshProcImpl()
493edf6992SAndrea Pescetti {
503edf6992SAndrea Pescetti }
513edf6992SAndrea Pescetti
createSerfRequestBucket(serf_request_t * inSerfRequest)523edf6992SAndrea Pescetti serf_bucket_t * SerfLockRefreshProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
533edf6992SAndrea Pescetti {
543edf6992SAndrea Pescetti // create serf request
553edf6992SAndrea Pescetti serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
563edf6992SAndrea Pescetti "LOCK",
573edf6992SAndrea Pescetti getPathStr(),
583edf6992SAndrea Pescetti 0,
593edf6992SAndrea Pescetti serf_request_get_alloc( inSerfRequest ) );
603edf6992SAndrea Pescetti // set request header fields
613edf6992SAndrea Pescetti serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
623edf6992SAndrea Pescetti if (hdrs_bkt != NULL)
633edf6992SAndrea Pescetti {
643edf6992SAndrea Pescetti // general header fields provided by caller
653edf6992SAndrea Pescetti setRequestHeaders( hdrs_bkt );
663edf6992SAndrea Pescetti
673edf6992SAndrea Pescetti // request specific header fields
683edf6992SAndrea Pescetti if(mTimeout != 0)
693edf6992SAndrea Pescetti {
703edf6992SAndrea Pescetti serf_bucket_headers_set( hdrs_bkt, "Timeout", mTimeout );
713edf6992SAndrea Pescetti }
723edf6992SAndrea Pescetti if(mpLockToken != 0)
733edf6992SAndrea Pescetti {
743edf6992SAndrea Pescetti serf_bucket_headers_set( hdrs_bkt, "if", mpLockToken );
753edf6992SAndrea Pescetti }
763edf6992SAndrea Pescetti }
773edf6992SAndrea Pescetti return req_bkt;
783edf6992SAndrea Pescetti }
793edf6992SAndrea Pescetti
803edf6992SAndrea Pescetti } // namespace http_dav_ucp
81