/usr/include/OTB-5.8/otbCurlHelper.h is in libotb-dev 5.8.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | /*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef otbCurlHelper_h
#define otbCurlHelper_h
#include "otbCurlHelperInterface.h"
namespace otb
{
/**
* \class CurlHelper
* \brief Class to use the curl capabilities from OTB
*
* This class is responsible for behaving properly when curl is
* not available, i.e. the compilation should pass, the runtime should
* not segfault but of course, the behavior will be different.
*
*
* \ingroup OTBCurlAdapters
*/
class OTBCurlAdapters_EXPORT CurlHelper : public CurlHelperInterface
{
public:
/** Standard class typedefs. */
typedef CurlHelper Self;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef CurlHelperInterface Superclass;
itkTypeMacro(CurlHelper, CurlHelperInterface);
itkNewMacro(Self);
bool TestUrlAvailability(const std::string& url) const ITK_OVERRIDE;
bool IsCurlReturnHttpError(const std::string& url) const;
int RetrieveFile(const std::ostringstream& urlStream, std::string filename) const ITK_OVERRIDE;
int RetrieveFile(const std::string& urlString, std::string filename) const ITK_OVERRIDE;
int RetrieveUrlInMemory(const std::string& urlString, std::string& output) const ITK_OVERRIDE;
int RetrieveFileMulti(const std::vector<std::string>& listURLs,
const std::vector<std::string>& listFiles,
int maxConnect) const ITK_OVERRIDE;
itkGetMacro(Timeout,long int);
itkSetMacro(Timeout,long int);
protected:
CurlHelper() :
m_Browser("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.11) "
"Gecko/20071127 Firefox/2.0.0.11"),
m_Timeout(10) {}
~CurlHelper() ITK_OVERRIDE {}
private:
CurlHelper(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
// Need to use our writing function to handle windows segfaults
// Need to be static cause the CURL_OPT is expecting a pure C
// function or a static c++ method.
static size_t CallbackWriteDataToFile(void* ptr, size_t size, size_t nmemb, void* data);
static size_t CallbackWriteDataToStringStream(void* ptr, size_t size, size_t nmemb, void* data);
static size_t CallbackWriteDataDummy(void* ptr, size_t size, size_t nmemb, void* data);
// Browser Agent used
std::string m_Browser;
long int m_Timeout;
};
}
#endif
|