SerfRequestProcessorImpl.cxx (e9ff7e89) SerfRequestProcessorImpl.cxx (10e20387)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 7 unchanged lines hidden (view full) ---

16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22#include <SerfRequestProcessorImpl.hxx>
23
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 7 unchanged lines hidden (view full) ---

16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22#include <SerfRequestProcessorImpl.hxx>
23
24namespace
25{
26// Define a magic value that is used by serf to reset chunked
27// encoding. The value definition is not supported by serf, hence the
28// definition here.
29static const apr_int64_t SERF_UNKNOWN_LENGTH (-1);
30}
31
24namespace http_dav_ucp
25{
26
27SerfRequestProcessorImpl::SerfRequestProcessorImpl( const char* inPath,
28 const DAVRequestHeaders& inRequestHeaders )
29 : mPathStr( inPath )
30 , mrRequestHeaders( inRequestHeaders )
31 , mbUseChunkedEncoding( false )

--- 14 unchanged lines hidden (view full) ---

46 mbUseChunkedEncoding = true;
47}
48
49const bool SerfRequestProcessorImpl::useChunkedEncoding() const
50{
51 return mbUseChunkedEncoding;
52}
53
32namespace http_dav_ucp
33{
34
35SerfRequestProcessorImpl::SerfRequestProcessorImpl( const char* inPath,
36 const DAVRequestHeaders& inRequestHeaders )
37 : mPathStr( inPath )
38 , mrRequestHeaders( inRequestHeaders )
39 , mbUseChunkedEncoding( false )

--- 14 unchanged lines hidden (view full) ---

54 mbUseChunkedEncoding = true;
55}
56
57const bool SerfRequestProcessorImpl::useChunkedEncoding() const
58{
59 return mbUseChunkedEncoding;
60}
61
62
63void SerfRequestProcessorImpl::handleChunkedEncoding (
64 serf_bucket_t* pRequestBucket,
65 apr_int64_t nLength) const
66{
67 if (pRequestBucket != NULL)
68 {
69 if (useChunkedEncoding())
70 {
71 // Activate chunked encoding.
72 serf_bucket_request_set_CL(pRequestBucket, SERF_UNKNOWN_LENGTH);
73 }
74 else
75 {
76 // Deactivate chunked encoding by setting the length.
77 serf_bucket_request_set_CL(pRequestBucket, nLength);
78 }
79 }
80}
81
82
54void SerfRequestProcessorImpl::setRequestHeaders( serf_bucket_t* inoutSerfHeaderBucket )
55{
56 DAVRequestHeaders::const_iterator aHeaderIter( mrRequestHeaders.begin() );
57 const DAVRequestHeaders::const_iterator aEnd( mrRequestHeaders.end() );
58
59 while ( aHeaderIter != aEnd )
60 {
61 const rtl::OString aHeader = rtl::OUStringToOString( (*aHeaderIter).first,

--- 56 unchanged lines hidden ---
83void SerfRequestProcessorImpl::setRequestHeaders( serf_bucket_t* inoutSerfHeaderBucket )
84{
85 DAVRequestHeaders::const_iterator aHeaderIter( mrRequestHeaders.begin() );
86 const DAVRequestHeaders::const_iterator aEnd( mrRequestHeaders.end() );
87
88 while ( aHeaderIter != aEnd )
89 {
90 const rtl::OString aHeader = rtl::OUStringToOString( (*aHeaderIter).first,

--- 56 unchanged lines hidden ---