Merge branch '1.x' of ssh://authdev.it.ohio-state.edu/~scantor/git/cpp-xmltooling...
[shibboleth/cpp-xmltooling.git] / xmltooling / util / CurlURLInputStream.h
index 3adf169..c149951 100644 (file)
@@ -1,18 +1,21 @@
-/*
- * 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
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
+ *
+ * UCAID 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
+ * 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.
+ * 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.
  */
 
 /**
@@ -46,7 +49,7 @@ namespace xmltooling {
          * @param url       the URL of the resource to fetch
          * @param cacheTag  optional pointer to string used for cache management
          */
-        CurlURLInputStream(const char* url, std::string* cacheTag=NULL);
+        CurlURLInputStream(const char* url, std::string* cacheTag=nullptr);
 
         /**
          * Constructor.
@@ -54,7 +57,7 @@ namespace xmltooling {
          * @param url       the URL of the resource to fetch
          * @param cacheTag  optional pointer to string used for cache management
          */
-        CurlURLInputStream(const XMLCh* url, std::string* cacheTag=NULL);
+        CurlURLInputStream(const XMLCh* url, std::string* cacheTag=nullptr);
 
         /**
          * Constructor taking a DOM element supporting the following content:
@@ -71,7 +74,7 @@ namespace xmltooling {
          * @param e         DOM to supply configuration
          * @param cacheTag  optional pointer to string used for cache management
          */
-        CurlURLInputStream(const xercesc::DOMElement* e, std::string* cacheTag=NULL);
+        CurlURLInputStream(const xercesc::DOMElement* e, std::string* cacheTag=nullptr);
 
         ~CurlURLInputStream();
 
@@ -109,7 +112,7 @@ namespace xmltooling {
         static size_t staticWriteCallback(char *buffer, size_t size, size_t nitems, void *outstream);
         size_t writeCallback(char *buffer, size_t size, size_t nitems);
 
-        void init(const xercesc::DOMElement* e=NULL);
+        void init(const xercesc::DOMElement* e=nullptr);
         bool readMore(int *runningHandles);
 
         logging::Category&  fLog;
@@ -130,9 +133,10 @@ namespace xmltooling {
 
         // Overflow buffer for when curl writes more data to us
         // than we've asked for.
-        XMLByte             fBuffer[CURL_MAX_WRITE_SIZE];
+        XMLByte*            fBuffer;
         XMLByte*            fBufferHeadPtr;
         XMLByte*            fBufferTailPtr;
+        size_t              fBufferSize;
 
         XMLCh*              fContentType;
         long                fStatusCode;