1
/******************************************************************************
2
* $Id: maphttp.h 11503 2011-04-07 19:56:16Z dmorissette $
5
* Purpose: http requests related functions
6
* Author: MapServer team.
8
******************************************************************************
9
* Copyright (c) 1996-2005 Regents of the University of Minnesota.
11
* Permission is hereby granted, free of charge, to any person obtaining a
12
* copy of this software and associated documentation files (the "Software"),
13
* to deal in the Software without restriction, including without limitation
14
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
15
* and/or sell copies of the Software, and to permit persons to whom the
16
* Software is furnished to do so, subject to the following conditions:
18
* The above copyright notice and this permission notice shall be included in
19
* all copies of this Software or works derived from this Software.
21
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27
* DEALINGS IN THE SOFTWARE.
28
****************************************************************************/
35
#include "mapprimitive.h"
42
#define MS_HTTP_SUCCESS(status) (status == 200 || status == 242)
44
enum MS_HTTP_PROXY_TYPE
50
enum MS_HTTP_AUTH_TYPE
59
typedef struct http_request_info
68
int nStatus; /* 200=success, value < 0 if request failed */
69
char *pszContentType; /* Content-Type of the response */
70
char *pszErrBuf; /* Buffer where curl can write errors */
71
char *pszPostRequest; /* post request content (NULL for GET) */
72
char *pszPostContentType;/* post request MIME type */
73
char *pszUserAgent; /* User-Agent, auto-generated if not set */
74
char *pszHTTPCookieData; /* HTTP Cookie data */
76
char *pszProxyAddress; /* The address (IP or hostname) of proxy svr */
77
long nProxyPort; /* The proxy's port */
78
enum MS_HTTP_PROXY_TYPE eProxyType; /* The type of proxy */
79
enum MS_HTTP_AUTH_TYPE eProxyAuthType; /* Auth method against proxy */
80
char *pszProxyUsername; /* Proxy authentication username */
81
char *pszProxyPassword; /* Proxy authentication password */
83
enum MS_HTTP_AUTH_TYPE eHttpAuthType; /* HTTP Authentication type */
84
char *pszHttpUsername; /* HTTP Authentication username */
85
char *pszHttpPassword; /* HTTP Authentication password */
87
/* For debugging/profiling */
88
int debug; /* Debug mode? MS_TRUE/MS_FALSE */
91
void * curl_handle; /* CURLM * handle */
92
FILE * fp; /* FILE * used during download */
94
char * result_data; /* output if pszOutputFile is NULL */
102
int msHTTPInit(void);
103
void msHTTPCleanup(void);
105
void msHTTPInitRequestObj(httpRequestObj *pasReqInfo, int numRequests);
106
void msHTTPFreeRequestObj(httpRequestObj *pasReqInfo, int numRequests);
107
int msHTTPExecuteRequests(httpRequestObj *pasReqInfo, int numRequests,
108
int bCheckLocalCache);
109
int msHTTPGetFile(const char *pszGetUrl, const char *pszOutputFile,
110
int *pnHTTPStatus, int nTimeout, int bCheckLocalCache,
122
#endif /* MAPHTTP_H */