~ubuntu-branches/ubuntu/saucy/mapserver/saucy-security

« back to all changes in this revision

Viewing changes to maphttp.h

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-12-23 14:02:06 UTC
  • mfrom: (26.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20111223140206-n3h9t2hsa8hyslmu
Tags: 6.0.1-2
Added missed stuff for libmapscript-perl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 * $Id: maphttp.h 11503 2011-04-07 19:56:16Z dmorissette $
 
3
 *
 
4
 * Project:  MapServer
 
5
 * Purpose:  http requests related functions
 
6
 * Author:   MapServer team.
 
7
 *
 
8
 ******************************************************************************
 
9
 * Copyright (c) 1996-2005 Regents of the University of Minnesota.
 
10
 *
 
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:
 
17
 *
 
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.
 
20
 *
 
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
 ****************************************************************************/
 
29
 
 
30
#ifndef MAPHTTP_H
 
31
#define MAPHTTP_H
 
32
 
 
33
 
 
34
 
 
35
#include "mapprimitive.h"
 
36
#include <stdio.h>
 
37
 
 
38
#ifdef __cplusplus
 
39
extern "C" {
 
40
#endif
 
41
 
 
42
#define MS_HTTP_SUCCESS(status)  (status == 200 || status == 242)
 
43
 
 
44
enum MS_HTTP_PROXY_TYPE
 
45
{
 
46
    MS_HTTP,
 
47
    MS_SOCKS5
 
48
};
 
49
 
 
50
enum MS_HTTP_AUTH_TYPE
 
51
{
 
52
    MS_BASIC,
 
53
    MS_DIGEST,
 
54
    MS_NTLM,
 
55
    MS_ANY,
 
56
    MS_ANYSAFE
 
57
};
 
58
 
 
59
typedef struct http_request_info
 
60
{
 
61
    int     nLayerId;
 
62
    char    *pszGetUrl;
 
63
    char    *pszOutputFile;
 
64
    int     nTimeout;
 
65
    rectObj bbox;
 
66
    int     width;
 
67
    int     height;
 
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 */
 
75
    
 
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             */
 
82
    
 
83
    enum MS_HTTP_AUTH_TYPE eHttpAuthType; /* HTTP Authentication type        */
 
84
    char    *pszHttpUsername;   /* HTTP Authentication username              */
 
85
    char    *pszHttpPassword;   /* HTTP Authentication password              */
 
86
 
 
87
    /* For debugging/profiling */
 
88
    int         debug;         /* Debug mode?  MS_TRUE/MS_FALSE */
 
89
 
 
90
    /* Private members */
 
91
    void      * curl_handle;   /* CURLM * handle */
 
92
    FILE      * fp;            /* FILE * used during download */
 
93
    
 
94
    char      * result_data;   /* output if pszOutputFile is NULL */
 
95
    int       result_size;
 
96
    int       result_buf_size;
 
97
 
 
98
} httpRequestObj;
 
99
 
 
100
#ifdef USE_CURL
 
101
 
 
102
int msHTTPInit(void);
 
103
void msHTTPCleanup(void);
 
104
 
 
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,
 
111
                   int bDebug);
 
112
 
 
113
#endif /*USE_CURL*/
 
114
 
 
115
#ifdef __cplusplus
 
116
}
 
117
#endif
 
118
 
 
119
 
 
120
 
 
121
 
 
122
#endif /* MAPHTTP_H */