OGR
cpl_http.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: cpl_http.h 37645 2017-03-08 00:15:33Z rouault $
3  *
4  * Project: Common Portability Library
5  * Purpose: Function wrapper for libcurl HTTP access.
6  * Author: Frank Warmerdam, warmerdam@pobox.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2006, Frank Warmerdam
10  * Copyright (c) 2009, Even Rouault <even dot rouault at mines-paris dot org>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  ****************************************************************************/
30 
31 #ifndef CPL_HTTP_H_INCLUDED
32 #define CPL_HTTP_H_INCLUDED
33 
34 #include "cpl_conv.h"
35 #include "cpl_string.h"
36 #include "cpl_vsi.h"
37 
45 
47 typedef struct { char **papszHeaders;
49  GByte *pabyData; int nDataLen;
52 } CPLMimePart;
53 
55 typedef struct {
57  int nStatus;
58 
61 
63  char *pszErrBuf;
64 
66  int nDataLen;
69 
72 
74  char **papszHeaders;
75 
78 
81 
83 
84 int CPL_DLL CPLHTTPEnabled( void );
85 CPLHTTPResult CPL_DLL *CPLHTTPFetch( const char *pszURL, char **papszOptions);
86 void CPL_DLL CPLHTTPCleanup( void );
87 void CPL_DLL CPLHTTPDestroyResult( CPLHTTPResult *psResult );
88 int CPL_DLL CPLHTTPParseMultipartMime( CPLHTTPResult *psResult );
89 
90 /* -------------------------------------------------------------------- */
91 /* The following is related to OAuth2 authorization around */
92 /* google services like fusion tables, and potentially others */
93 /* in the future. Code in cpl_google_oauth2.cpp. */
94 /* */
95 /* These services are built on CPL HTTP services. */
96 /* -------------------------------------------------------------------- */
97 
98 char CPL_DLL *GOA2GetAuthorizationURL( const char *pszScope );
99 char CPL_DLL *GOA2GetRefreshToken( const char *pszAuthToken,
100  const char *pszScope );
101 char CPL_DLL *GOA2GetAccessToken( const char *pszRefreshToken,
102  const char *pszScope );
103 
104 CPL_C_END
105 
106 #ifdef __cplusplus
107 
108 // Not sure if this belong here, used in cpl_http.cpp, cpl_vsil_curl.cpp and frmts/wms/gdalhttp.cpp
109 void* CPLHTTPSetOptions(void *pcurl, const char * const* papszOptions);
110 char** CPLHTTPGetOptionsFromEnv();
112 #endif // __cplusplus
113 
114 #endif /* ndef CPL_HTTP_H_INCLUDED */
CPLHTTPResultWithLimit
Definition: cpl_http.cpp:71
CPLMimePart::nDataLen
int nDataLen
Definition: cpl_http.h:51
CPLReadLineL
const char * CPLReadLineL(VSILFILE *)
Definition: cpl_conv.cpp:623
CPLMimePart::pabyData
GByte * pabyData
Definition: cpl_http.h:50
CSLTokenizeString2
char ** CSLTokenizeString2(const char *pszString, const char *pszDelimiter, int nCSLTFlags)
Definition: cpl_string.cpp:834
GByte
unsigned char GByte
Definition: cpl_port.h:207
GOA2GetAuthorizationURL
char * GOA2GetAuthorizationURL(const char *pszScope)
Definition: cpl_google_oauth2.cpp:123
VSIGetMemFileBuffer
GByte * VSIGetMemFileBuffer(const char *pszFilename, vsi_l_offset *pnDataLength, int bUnlinkAndSeize)
Fetch buffer underlying memory file.
Definition: cpl_vsi_mem.cpp:992
cpl_error.h
CPLHTTPParseMultipartMime
int CPLHTTPParseMultipartMime(CPLHTTPResult *psResult)
Parses a MIME multipart message.
Definition: cpl_http.cpp:960
CPLHTTPDestroyResult
void CPLHTTPDestroyResult(CPLHTTPResult *psResult)
Clean the memory associated with the return value of CPLHTTPFetch()
Definition: cpl_http.cpp:927
CPLHTTPCleanup
void CPLHTTPCleanup(void)
Cleanup function to call at application termination.
Definition: cpl_http.cpp:889
CPLCalloc
void * CPLCalloc(size_t, size_t)
Definition: cpl_conv.cpp:128
VSIRealloc
void * VSIRealloc(void *, size_t)
Definition: cpl_vsisimple.cpp:671
cpl_vsi.h
CSLSetNameValue
char ** CSLSetNameValue(char **papszStrList, const char *pszName, const char *pszValue)
Definition: cpl_string.cpp:1873
CPLHTTPResult::pszContentType
char * pszContentType
Definition: cpl_http.h:60
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:338
CPLRealloc
void * CPLRealloc(void *, size_t)
Definition: cpl_conv.cpp:215
EQUAL
#define EQUAL(a, b)
Definition: cpl_port.h:622
VSIFCloseL
int VSIFCloseL(VSILFILE *) EXPERIMENTAL_CPL_WARN_UNUSED_RESULT
Close file.
Definition: cpl_vsil.cpp:712
cpl_http.h
CPL_C_START
#define CPL_C_START
Definition: cpl_port.h:352
CPLTestBool
bool CPLTestBool(const char *pszValue)
Definition: cpl_string.cpp:1522
CPLHTTPResult::nMimePartCount
int nMimePartCount
Definition: cpl_http.h:77
CSLCount
int CSLCount(const char *const *papszStrList)
Definition: cpl_string.cpp:147
CPLHTTPResult
Definition: cpl_http.h:55
CPLHTTPResult::pabyData
GByte * pabyData
Definition: cpl_http.h:71
CSLFetchNameValue
const char * CSLFetchNameValue(const char *const *papszStrList, const char *pszName)
Definition: cpl_string.cpp:1670
CPL_C_END
#define CPL_C_END
Definition: cpl_port.h:354
CPLPrintString
int CPLPrintString(char *, const char *, int)
Definition: cpl_conv.cpp:1178
CPLDebug
void CPLDebug(const char *, const char *,...)
Definition: cpl_error.cpp:492
STARTS_WITH
#define STARTS_WITH(a, b)
Definition: cpl_port.h:631
CPLMalloc
void * CPLMalloc(size_t)
Definition: cpl_conv.cpp:158
CPLHTTPResult::papszHeaders
char ** papszHeaders
Definition: cpl_http.h:74
cpl_conv.h
cpl_string.h
CPLHTTPEnabled
int CPLHTTPEnabled(void)
Return if CPLHTTP services can be useful.
Definition: cpl_http.cpp:872
CPLSPrintf
const char * CPLSPrintf(const char *fmt,...)
Definition: cpl_string.cpp:975
CPLMimePart::papszHeaders
char ** papszHeaders
Definition: cpl_http.h:48
CPLMimePart
Definition: cpl_http.h:47
CPLMutexHolder
Definition: cpl_multiproc.h:139
CPLError
void CPLError(CPLErr eErrClass, CPLErrorNum err_no, const char *fmt,...)
Definition: cpl_error.cpp:215
CPLParseNameValue
const char * CPLParseNameValue(const char *pszNameValue, char **ppszKey)
Definition: cpl_string.cpp:1750
TupleEnvVarOptionName
Definition: cpl_http.cpp:146
vsi_l_offset
GUIntBig vsi_l_offset
Definition: cpl_vsi.h:138
VSIFree
void VSIFree(void *)
Definition: cpl_vsisimple.cpp:817
CSLTokenizeStringComplex
char ** CSLTokenizeStringComplex(const char *pszString, const char *pszDelimiter, int bHonourStrings, int bAllowEmptyTokens)
Definition: cpl_string.cpp:767
CPLE_NotSupported
#define CPLE_NotSupported
Definition: cpl_error.h:110
CPLSetConfigOption
void CPLSetConfigOption(const char *, const char *)
Definition: cpl_conv.cpp:1765
CPL_ARRAYSIZE
#define CPL_ARRAYSIZE(array)
Definition: cpl_port.h:1134
GOA2GetAccessToken
char * GOA2GetAccessToken(const char *pszRefreshToken, const char *pszScope)
Definition: cpl_google_oauth2.cpp:283
CPLHTTPResult::pszErrBuf
char * pszErrBuf
Definition: cpl_http.h:63
CPLHTTPResult::nStatus
int nStatus
Definition: cpl_http.h:57
CSLDestroy
void CSLDestroy(char **papszStrList)
Definition: cpl_string.cpp:200
CPLHTTPResult::nDataLen
int nDataLen
Definition: cpl_http.h:66
cpl_port.h
VSIFOpenL
VSILFILE * VSIFOpenL(const char *, const char *)
Open file.
Definition: cpl_vsil.cpp:608
GOA2GetRefreshToken
char * GOA2GetRefreshToken(const char *pszAuthToken, const char *pszScope)
Definition: cpl_google_oauth2.cpp:160
CSLAddString
char ** CSLAddString(char **papszStrList, const char *pszNewString)
Definition: cpl_string.cpp:83
CPLStrdup
char * CPLStrdup(const char *)
Definition: cpl_conv.cpp:284
CPLAtof
double CPLAtof(const char *)
Definition: cpl_strtod.cpp:117
CPLHTTPResult::nDataAlloc
int nDataAlloc
Definition: cpl_http.h:68
CPLHTTPResult::pasMimePart
CPLMimePart * pasMimePart
Definition: cpl_http.h:80
CPLE_FileIO
#define CPLE_FileIO
Definition: cpl_error.h:104
CPLFree
#define CPLFree
Definition: cpl_conv.h:81
CPLHTTPFetch
CPLHTTPResult * CPLHTTPFetch(const char *pszURL, char **papszOptions)
Fetch a document from an url and return in a string.
Definition: cpl_http.cpp:246
CPLGetConfigOption
const char * CPLGetConfigOption(const char *, const char *)
Definition: cpl_conv.cpp:1625
VSILFILE
FILE VSILFILE
Definition: cpl_vsi.h:154
CPLE_AppDefined
#define CPLE_AppDefined
Definition: cpl_error.h:100

Generated for GDAL by doxygen 1.8.17.