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 "SerfUnlockProcImpl.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
SerfUnlockProcImpl(const char * inSourcePath,const DAVRequestHeaders & inRequestHeaders,const ucb::Lock & inLock,const char * inLockToken)373edf6992SAndrea Pescetti SerfUnlockProcImpl::SerfUnlockProcImpl( const char* inSourcePath,
383edf6992SAndrea Pescetti const DAVRequestHeaders& inRequestHeaders,
393edf6992SAndrea Pescetti const ucb::Lock& inLock,
403edf6992SAndrea Pescetti const char* inLockToken )
413edf6992SAndrea Pescetti : SerfRequestProcessorImpl( inSourcePath, inRequestHeaders )
423edf6992SAndrea Pescetti , mLock( inLock )
433edf6992SAndrea Pescetti , mpLockToken( inLockToken )
443edf6992SAndrea Pescetti , xInputStream( new SerfInputStream() )
453edf6992SAndrea Pescetti {
463edf6992SAndrea Pescetti
473edf6992SAndrea Pescetti }
483edf6992SAndrea Pescetti
~SerfUnlockProcImpl()493edf6992SAndrea Pescetti SerfUnlockProcImpl::~SerfUnlockProcImpl()
503edf6992SAndrea Pescetti {
513edf6992SAndrea Pescetti }
523edf6992SAndrea Pescetti
createSerfRequestBucket(serf_request_t * inSerfRequest)533edf6992SAndrea Pescetti serf_bucket_t * SerfUnlockProcImpl::createSerfRequestBucket( serf_request_t * inSerfRequest )
543edf6992SAndrea Pescetti {
553edf6992SAndrea Pescetti // create serf request
563edf6992SAndrea Pescetti serf_bucket_t *req_bkt = serf_request_bucket_request_create( inSerfRequest,
573edf6992SAndrea Pescetti "UNLOCK",
583edf6992SAndrea Pescetti getPathStr(),
593edf6992SAndrea Pescetti 0,
603edf6992SAndrea Pescetti serf_request_get_alloc( inSerfRequest ) );
613edf6992SAndrea Pescetti // set request header fields
623edf6992SAndrea Pescetti serf_bucket_t* hdrs_bkt = serf_bucket_request_get_headers( req_bkt );
633edf6992SAndrea Pescetti if (hdrs_bkt != NULL)
643edf6992SAndrea Pescetti {
653edf6992SAndrea Pescetti // general header fields provided by caller
663edf6992SAndrea Pescetti setRequestHeaders( hdrs_bkt );
673edf6992SAndrea Pescetti
683edf6992SAndrea Pescetti // request specific header fields
693edf6992SAndrea Pescetti serf_bucket_headers_set( hdrs_bkt, "Lock-Token", mpLockToken );
703edf6992SAndrea Pescetti }
713edf6992SAndrea Pescetti else
723edf6992SAndrea Pescetti {
733edf6992SAndrea Pescetti OSL_ASSERT("Headers Bucket missing");
743edf6992SAndrea Pescetti }
753edf6992SAndrea Pescetti
763edf6992SAndrea Pescetti return req_bkt;
773edf6992SAndrea Pescetti }
783edf6992SAndrea Pescetti
processChunkOfResponseData(const char * data,apr_size_t len)793edf6992SAndrea Pescetti void SerfUnlockProcImpl::processChunkOfResponseData( const char* data,
803edf6992SAndrea Pescetti apr_size_t len )
813edf6992SAndrea Pescetti {
823edf6992SAndrea Pescetti if ( xInputStream.is() )
833edf6992SAndrea Pescetti {
843edf6992SAndrea Pescetti xInputStream->AddToStream( data, len );
853edf6992SAndrea Pescetti }
863edf6992SAndrea Pescetti }
873edf6992SAndrea Pescetti
handleEndOfResponseData(serf_bucket_t *)883edf6992SAndrea Pescetti void SerfUnlockProcImpl::handleEndOfResponseData( serf_bucket_t * /*inSerfResponseBucket*/ )
893edf6992SAndrea Pescetti {
903edf6992SAndrea Pescetti }
913edf6992SAndrea Pescetti
923edf6992SAndrea Pescetti } // namespace http_dav_ucp
93