cpl_http.h File Reference

#include "cpl_conv.h"
#include "cpl_string.h"
#include "cpl_vsi.h"

Go to the source code of this file.

Classes

struct  CPLMimePart
struct  CPLHTTPResult

Functions

int CPLHTTPEnabled (void)
 Return if CPLHTTP services can be usefull.
CPLHTTPResultCPLHTTPFetch (const char *pszURL, char **papszOptions)
 Fetch a document from an url and return in a string.
void CPLHTTPCleanup (void)
 Cleanup function to call at application termination.
void CPLHTTPDestroyResult (CPLHTTPResult *psResult)
 Clean the memory associated with the return value of CPLHTTPFetch().
int CPLHTTPParseMultipartMime (CPLHTTPResult *psResult)
 Parses a a MIME multipart message.

Detailed Description

Interface for downloading HTTP, FTP documents


Function Documentation

void CPLHTTPDestroyResult ( CPLHTTPResult psResult  ) 
int CPLHTTPEnabled ( void   ) 

Return if CPLHTTP services can be usefull.

Those services depend on GDAL being build with libcurl support.

Returns:
TRUE if libcurl support is enabled
CPLHTTPResult* CPLHTTPFetch ( const char *  pszURL,
char **  papszOptions 
)

Fetch a document from an url and return in a string.

Parameters:
pszURL valid URL recognized by underlying download library (libcurl)
papszOptions option list as a NULL-terminated array of strings. May be NULL. The following options are handled :

  • TIMEOUT=val, where val is in seconds
  • HEADERS=val, where val is an extra header to use when getting a web page. For example "Accept: application/x-ogcwkt"
  • HTTPAUTH=[BASIC/NTLM/GSSNEGOTIATE/ANY] to specify an authentication scheme to use.
  • USERPWD=userid:password to specify a user and password for authentication
  • POSTFIELDS=val, where val is a nul-terminated string to be passed to the server with a POST request.
  • PROXY=val, to make requests go through a proxy server, where val is of the form proxy.server.com:port_number
  • PROXYUSERPWD=val, where val is of the form username:password
  • CUSTOMREQUEST=val, where val is GET, PUT, POST, DELETE, etc.. (GDAL >= 1.9.0)

Alternatively, if not defined in the papszOptions arguments, the PROXY and PROXYUSERPWD values are searched in the configuration options named GDAL_HTTP_PROXY and GDAL_HTTP_PROXYUSERPWD, as proxy configuration belongs to networking setup and makes more sense at the configuration option level than at the connection level.

Returns:
a CPLHTTPResult* structure that must be freed by CPLHTTPDestroyResult(), or NULL if libcurl support is disabled

References CPLHTTPResult::nDataLen, CPLHTTPResult::nStatus, CPLHTTPResult::papszHeaders, CPLHTTPResult::pszContentType, and CPLHTTPResult::pszErrBuf.

int CPLHTTPParseMultipartMime ( CPLHTTPResult psResult  ) 

Parses a a MIME multipart message.

This function will iterate over each part and put it in a separate element of the pasMimePart array of the provided psResult structure.

Parameters:
psResult pointer to the return value of CPLHTTPFetch()
Returns:
TRUE if the message contains MIME multipart message.

References CPLMimePart::nDataLen, CPLHTTPResult::nDataLen, CPLHTTPResult::nMimePartCount, CPLMimePart::pabyData, CPLHTTPResult::pabyData, CPLMimePart::papszHeaders, CPLHTTPResult::pasMimePart, and CPLHTTPResult::pszContentType.


Generated for GDAL by doxygen 1.6.1.