GDAL
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 */
CPLMimePart * pasMimePart
Definition: cpl_http.h:80
Standard C Covers.
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:352
void CPLHTTPCleanup(void)
Cleanup function to call at application termination.
Definition: cpl_http.cpp:889
char * pszContentType
Definition: cpl_http.h:60
int CPLHTTPParseMultipartMime(CPLHTTPResult *psResult)
Parses a MIME multipart message.
Definition: cpl_http.cpp:960
void CPLHTTPDestroyResult(CPLHTTPResult *psResult)
Clean the memory associated with the return value of CPLHTTPFetch()
Definition: cpl_http.cpp:927
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:207
char ** papszHeaders
Definition: cpl_http.h:74
char * GOA2GetAccessToken(const char *pszRefreshToken, const char *pszScope)
Fetch access token using refresh token.
Definition: cpl_google_oauth2.cpp:283
Various convenience functions for working with strings and string lists.
int CPLHTTPEnabled(void)
Return if CPLHTTP services can be useful.
Definition: cpl_http.cpp:872
int nMimePartCount
Definition: cpl_http.h:77
int nDataAlloc
Definition: cpl_http.h:68
CPLHTTPResult * CPLHTTPFetch(const char *pszURL, char **papszOptions)
Fetch a document from an url and return in a string.
Definition: cpl_http.cpp:246
int nDataLen
Definition: cpl_http.h:66
Various convenience functions for CPL.
Definition: cpl_http.h:55
int nStatus
Definition: cpl_http.h:57
GByte * pabyData
Definition: cpl_http.h:71
Definition: cpl_http.h:47
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:354
char * pszErrBuf
Definition: cpl_http.h:63
char * GOA2GetRefreshToken(const char *pszAuthToken, const char *pszScope)
Turn Auth Token into a Refresh Token.
Definition: cpl_google_oauth2.cpp:160
char * GOA2GetAuthorizationURL(const char *pszScope)
Return authorization url for a given scope.
Definition: cpl_google_oauth2.cpp:123

Generated for GDAL by doxygen 1.8.8.