bump product version to 7.2.5.1
[LibreOffice.git] / ucb / source / ucp / webdav / SerfRequestProcessor.hxx
blobf0750bd01faf0549ff030a3e30189389b436e813
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #pragma once
23 #include <apr_errno.h>
24 #include <apr_pools.h>
26 #include <serf.h>
28 #include "DAVTypes.hxx"
29 #include "DAVResource.hxx"
30 #include "DAVException.hxx"
32 #include "SerfInputStream.hxx"
33 #include <com/sun/star/io/XOutputStream.hpp>
34 #include <com/sun/star/ucb/Lock.hpp>
36 #include <rtl/ref.hxx>
38 namespace http_dav_ucp
41 class SerfSession;
42 class SerfRequestProcessorImpl;
44 class SerfRequestProcessor
46 public:
47 SerfRequestProcessor( SerfSession& rSerfSession,
48 const OUString & inPath,
49 const bool bUseChunkedEncoding );
50 ~SerfRequestProcessor();
52 // PROPFIND - allprop & named
53 bool processPropFind( const Depth inDepth,
54 const std::vector< OUString > & inPropNames,
55 std::vector< DAVResource > & ioResources,
56 apr_status_t& outSerfStatus );
58 // PROPFIND - property names
59 bool processPropFind( const Depth inDepth,
60 std::vector< DAVResourceInfo > & ioResInfo,
61 apr_status_t& outSerfStatus );
63 // PROPPATCH
64 bool processPropPatch( const std::vector< ProppatchValue > & inProperties,
65 apr_status_t& outSerfStatus );
67 // GET
68 bool processGet( const rtl::Reference< SerfInputStream >& xioInStrm,
69 apr_status_t& outSerfStatus );
71 // GET inclusive header fields
72 bool processGet( const rtl::Reference< SerfInputStream >& xioInStrm,
73 const std::vector< OUString > & inHeaderNames,
74 DAVResource & ioResource,
75 apr_status_t& outSerfStatus );
77 // GET
78 bool processGet( const css::uno::Reference< css::io::XOutputStream >& xioOutStrm,
79 apr_status_t& outSerfStatus );
81 // GET inclusive header fields
82 bool processGet( const css::uno::Reference< css::io::XOutputStream >& xioOutStrm,
83 const std::vector< OUString > & inHeaderNames,
84 DAVResource & ioResource,
85 apr_status_t& outSerfStatus );
87 // HEAD
88 bool processHead( const std::vector< OUString > & inHeaderNames,
89 DAVResource & ioResource,
90 apr_status_t& outSerfStatus );
92 // PUT
93 bool processPut( const char* inData,
94 apr_size_t inDataLen,
95 apr_status_t& outSerfStatus );
97 // POST
98 bool processPost( const char* inData,
99 apr_size_t inDataLen,
100 const OUString & inContentType,
101 const OUString & inReferer,
102 const rtl::Reference< SerfInputStream >& xioInStrm,
103 apr_status_t& outSerfStatus );
105 // POST
106 bool processPost( const char* inData,
107 apr_size_t inDataLen,
108 const OUString & inContentType,
109 const OUString & inReferer,
110 const css::uno::Reference< css::io::XOutputStream >& xioOutStrm,
111 apr_status_t& outSerfStatus );
113 // DELETE
114 bool processDelete( apr_status_t& outSerfStatus );
116 // MKCOL
117 bool processMkCol( apr_status_t& outSerfStatus );
119 // COPY
120 bool processCopy( const OUString & inDestinationPath,
121 const bool inOverwrite,
122 apr_status_t& outSerfStatus );
124 // MOVE
125 bool processMove( const OUString & inDestinationPath,
126 const bool inOverwrite,
127 apr_status_t& outSerfStatus );
129 //LOCK
130 bool processLock( const css::ucb::Lock & rLock, sal_Int32 *plastChanceToSendRefreshRequest = nullptr );
132 //UNLOCK
133 bool processUnlock();
135 apr_status_t provideSerfCredentials( char ** outUsername,
136 char ** outPassword,
137 serf_request_t * inRequest,
138 int inCode,
139 const char *inAuthProtocol,
140 const char *inRealm,
141 apr_pool_t *inAprPool );
143 apr_status_t setupSerfRequest( serf_request_t * inSerfRequest,
144 serf_bucket_t ** outSerfRequestBucket,
145 serf_response_acceptor_t * outSerfResponseAcceptor,
146 void ** outSerfResponseAcceptorBaton,
147 serf_response_handler_t * outSerfResponseHandler,
148 void ** outSerfResponseHandlerBaton,
149 apr_pool_t * inAprPool );
151 serf_bucket_t* acceptSerfResponse( serf_request_t * inSerfRequest,
152 serf_bucket_t * inSerfStreamBucket,
153 apr_pool_t* inAprPool );
155 apr_status_t handleSerfResponse( serf_request_t * inSerfRequest,
156 serf_bucket_t * inSerfResponseBucket,
157 apr_pool_t * inAprPool );
159 //private:
160 void prepareProcessor();
161 apr_status_t runProcessor();
162 void postprocessProcessor( const apr_status_t inStatus );
164 SerfSession& mrSerfSession;
165 const char* mPathStr;
166 const bool mbUseChunkedEncoding;
167 const char* mDestPathStr;
168 const char* mContentType;
169 const char* mReferer;
170 SerfRequestProcessorImpl* mpProcImpl;
172 bool mbProcessingDone;
174 DAVException* mpDAVException;
175 sal_uInt16 mnHTTPStatusCode;
176 OUString mHTTPStatusCodeText;
177 OUString mRedirectLocation;
179 sal_uInt8 mnSuccessfulCredentialAttempts;
180 bool mbInputOfCredentialsAborted;
181 bool mbSetupSerfRequestCalled;
182 bool mbAcceptSerfResponseCalled;
183 bool mbHandleSerfResponseCalled;
186 } // namespace http_dav_ucp
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */