ZOO-Project
Macros | Functions
request_parser.c File Reference
#include "request_parser.h"
#include "service_internal.h"
#include "server_internal.h"
#include "service_callback.h"
#include "response_print.h"
#include "caching.h"
#include "cgic.h"
#include <errno.h>
#include <dirent.h>
#include <string.h>

Macros

#define CWL_FAIL(kind, msg)   do { iErrKind = (kind); pccErrMsg = (msg); goto cleanup; } while (0)
 

Functions

xmlXPathObjectPtr extractFromDoc (xmlDocPtr doc, const char *pccSearch)
 Apply XPath Expression on XML document. More...
 
int appendMapsToMaps (maps **ppmsConf, maps *pmsOutput, maps *pmsInput, elements *peElem)
 Create (or append to) an array valued maps value = "["",""]". More...
 
void ensureDecodedBase64 (maps **ppmsInput)
 Make sure that each value encoded in base64 in a maps is decoded. More...
 
int kvpParseInputs (maps **pmsConf, service *s, map *request_inputs, maps **request_output, HINTERNET *hInternet)
 Parse inputs provided as KVP and store them in a maps. More...
 
int kvpParseOutputs (maps **pmsConf, map *request_inputs, maps **request_output)
 Parse outputs provided as KVP and store them in a maps. More...
 
int defineMissingIdentifier (maps **pmsConf, maps **mymaps)
 Create a "missingIdentifier" maps in case it is NULL. More...
 
int xmlParseInputs (maps **pmsConf, service *s, maps **request_output, xmlDocPtr doc, xmlNodeSet *nodes, HINTERNET *hInternet)
 Parse inputs from XML nodes and store them in a maps. More...
 
int xmlParseBoundingBox (maps **pmsConf, map **current_input, xmlDocPtr doc)
 Parse a BoundingBoxData node. More...
 
int xmlParseOutputs2 (maps **pmsConf, map **request_inputs, maps **request_output, xmlDocPtr doc, xmlNodeSet *nodes)
 Parse outputs from XML nodes and store them in a maps (WPS version 2.0.0). More...
 
int xmlParseOutputs (maps **pmsConf, map **request_inputs, maps **request_output, xmlDocPtr doc, xmlNodePtr cur, bool raw)
 Parse outputs from XML nodes and store them in a maps. More...
 
int xmlParseRequest (maps **pmsConf, const char *post, map **request_inputs, service *s, maps **inputs, maps **outputs, HINTERNET *hInternet)
 Parse XML request and store information in maps. More...
 
int parseRequest (maps **pmsConf, map **request_inputs, service *s, maps **inputs, maps **outputs, HINTERNET *hInternet)
 Parse request and store information in maps. More...
 
int validateRequest (maps **pmsConf, service *s, map *original_request, maps **request_inputs, maps **request_outputs, HINTERNET *hInternet)
 Ensure that each requested arguments are present in the request DataInputs and ResponseDocument / RawDataOutput. More...
 
void checkValidValue (map *request, map **res, const char *toCheck, const char **avalues, int mandatory)
 Verify if a parameter value is valid. More...
 
void parseCookie (maps **conf, const char *cookie)
 Parse cookie contained in request headers. More...
 
int parseInputHttpRequests (maps *conf, maps *inputs, HINTERNET *hInternet)
 Parse all the http requests possibily attached to inputs and, add them to the request queue. More...
 
char * getDirName (const char *pccPath)
 Returns the parent directory of the given path, allocated with malloc. More...
 
static const char * findBytes (const char *pccData, size_t stDataLen, const char *pccNeedle, size_t stNeedleLen)
 Searches for a sequence of bytes (needle) within a larger block of data. More...
 
static const char * findHeaderEnd (const char *pccStart, const char *pccEnd, size_t *pstSepLen)
 Finds the end of the headers in a CWL multipart message. More...
 
static const char * findBoundaryLine (const char *pccBody, const char *pccFrom, const char *pccEnd, const char *pccDelim, size_t stDelimLen, int *piIsFinal, const char **ppcAfterLine)
 Finds the next boundary delimiter LINE in a multipart body. More...
 
static cwlStatus splitHeaderLine (const char *pccLine, size_t stLen, char **ppcField, char **ppcValue)
 Splits a header line into its field and value components. More...
 
static char * stripAngleBrackets (const char *pccInput)
 Strips angle brackets from a string if they exist. More...
 
static void freeCwlParts (cwlPart *pcpParts, int iNbParts)
 Frees the strings owned by the parts. More...
 
static cwlStatus parsePartHeaders (const char *pccHeaderBlock, size_t stLen, cwlPart *pcpPart)
 Parses the headers of a multipart part and fills the corresponding fields in the cwlPart structure. More...
 
cwlStatus splitMultipartRelated (const char *pccBody, size_t stBodyLen, const char *pccBoundary, cwlPart pcpParts[], int iMaxParts, int *piNbParts)
 Splits a multipart/related body into its constituent parts. More...
 
cwlStatus sanitizeRelativePath (const char *pccRawName, char **ppcOut)
 Sanitize a relative file path. More...
 
int pathStaysUnderWorkDir (const char *pccWorkDir, const char *pccFullPath)
 Verify that the parent directory of fullPath resolves under workDir. More...
 
static int mkdirOne (const char *pccPath)
 Creates one directory; an already existing path is accepted ONLY if it is a real directory (not a file, not a symlink). More...
 
int mkdirRecursive (const char *pccPath)
 Recursively create the specified directory and all its missing parent directories. More...
 
int mkdirRecursiveForFile (const char *pccFilePath)
 Recursively create the parent directory of the specified file path (without creating the file itself). More...
 
static int removeRecursive (const char *pccPath)
 Recursively remove the specified file or directory. More...
 
int cleanupWorkDir (const char *pccWorkDir)
 Clean up the specified work directory by recursively removing all its contents. More...
 
char * createExclusiveWorkDir (maps *pmsConf)
 Create the work directory of a multipart deployment with mkdtemp(): the directory is guaranteed to be new and owned by this request (mode 0700), so it is always safe to remove it on error. More...
 
char * extractMimeParam (const char *pccContentType, const char *pccParamName)
 Extract the value of a parameter from a header such as 'multipart/related; boundary="a;b"; start="<main@cwl>"'. More...
 
int handleInvalidParameterValue (maps *pmsConf, const char *pccMessage)
 Raise an OGC "InvalidParameterValue" exception and return -1. More...
 
int handleInternalError (maps *pmsConf, const char *pccMessage)
 Raise an OGC "NoApplicableCode" exception (server-side failure: disk full, out of memory, ...) and return -1. More...
 
static int writeAll (int iFd, const char *pccData, size_t stLen)
 Write the whole buffer to a file descriptor, handling partial writes and EINTR. More...
 
int handleCwlMultipartDeploy (maps *pmsConf, const char *pccBody, size_t stBodyLen, const char *pccBoundary, const char *pccStartId)
 Handle the deployment of a CWL multipart request. More...
 

Macro Definition Documentation

◆ CWL_FAIL

#define CWL_FAIL (   kind,
  msg 
)    do { iErrKind = (kind); pccErrMsg = (msg); goto cleanup; } while (0)

Function Documentation

◆ appendMapsToMaps()

int appendMapsToMaps ( maps **  ppmsConf,
maps *  pmsOutput,
maps *  pmsInput,
elements *  peElem 
)

Create (or append to) an array valued maps value = "["",""]".

Parameters
ppmsConfthe conf maps containing the main.cfg settings
pmsOutputthe map to update
pmsInputthe map to append
peElemthe elements containing default definitions
Returns
0 on success, -1 on failure

◆ checkValidValue()

void checkValidValue ( map *  request,
map **  res,
const char *  toCheck,
const char **  avalues,
int  mandatory 
)

Verify if a parameter value is valid.

Parameters
requestthe request map
resthe error map potentially generated
toCheckthe parameter to use
avaluesthe acceptable values (or null if testing only for presence)
mandatoryverify the presence of the parameter if mandatory > 0

◆ cleanupWorkDir()

int cleanupWorkDir ( const char *  pccWorkDir)

Clean up the specified work directory by recursively removing all its contents.

Parameters
pccWorkDirThe path to the work directory to clean up.
Returns
0 on success, -1 on failure.

◆ createExclusiveWorkDir()

char* createExclusiveWorkDir ( maps *  pmsConf)

Create the work directory of a multipart deployment with mkdtemp(): the directory is guaranteed to be new and owned by this request (mode 0700), so it is always safe to remove it on error.

Parameters
pmsConfThe configuration maps ("main"/"tmpPath", default "/tmp").
Returns
A malloc'ed path of the created directory, or NULL on error.

◆ defineMissingIdentifier()

int defineMissingIdentifier ( maps **  pmsConf,
maps **  mymaps 
)

Create a "missingIdentifier" maps in case it is NULL.

Parameters
pmsConfthe conf maps containing the main.cfg settings
mymapsthe maps to update
Returns
0 on success, 4 on failure

◆ ensureDecodedBase64()

void ensureDecodedBase64 ( maps **  ppmsInput)

Make sure that each value encoded in base64 in a maps is decoded.

Parameters
ppmsInputthe maps containing the values
See also
readBase64

◆ extractFromDoc()

xmlXPathObjectPtr extractFromDoc ( xmlDocPtr  doc,
const char *  pccSearch 
)

Apply XPath Expression on XML document.

Parameters
docthe XML Document
pccSearchthe XPath expression
Returns
xmlXPathObjectPtr containing the resulting nodes set

◆ extractMimeParam()

char* extractMimeParam ( const char *  pccContentType,
const char *  pccParamName 
)

Extract the value of a parameter from a header such as 'multipart/related; boundary="a;b"; start="<main@cwl>"'.

Handles unquoted values, quoted values containing ';' and backslash-escaped characters inside quoted values. The parameter name is matched exactly (case-insensitively). Angle brackets are NOT removed here.

Parameters
pccContentTypeThe content type header string.
pccParamNameThe name of the parameter to extract.
Returns
A malloc'ed string with the unquoted value, or NULL if the parameter is absent, empty, malformed or if the allocation fails.

◆ findBoundaryLine()

static const char* findBoundaryLine ( const char *  pccBody,
const char *  pccFrom,
const char *  pccEnd,
const char *  pccDelim,
size_t  stDelimLen,
int *  piIsFinal,
const char **  ppcAfterLine 
)
static

Finds the next boundary delimiter LINE in a multipart body.

A delimiter is only accepted if it starts at the beginning of the body or right after a '
', and is followed by either "--" (closing delimiter) or optional blanks and a line break. An occurrence of "--boundary" inside the content of a part (or a longer boundary sharing the same prefix) is ignored.

Parameters
pccBodyStart of the whole body (used to detect "beginning of body").
pccFromWhere to start searching.
pccEndEnd of the body.
pccDelimThe delimiter string ("--" + boundary).
stDelimLenLength of the delimiter string.
piIsFinalSet to 1 if the delimiter is the closing one ("--boundary--").
ppcAfterLineSet to the first byte after the delimiter line.
Returns
Pointer to the start of the delimiter line, or NULL if not found.

◆ findBytes()

static const char* findBytes ( const char *  pccData,
size_t  stDataLen,
const char *  pccNeedle,
size_t  stNeedleLen 
)
static

Searches for a sequence of bytes (needle) within a larger block of data.

Parameters
pccDataPointer to the start of the data block.
stDataLenLength of the data block.
pccNeedlePointer to the sequence of bytes to search for.
stNeedleLenLength of the sequence of bytes to search for.
Returns
Pointer to the first occurrence of the sequence within the data block, or NULL if not found.

◆ findHeaderEnd()

static const char* findHeaderEnd ( const char *  pccStart,
const char *  pccEnd,
size_t *  pstSepLen 
)
static

Finds the end of the headers in a CWL multipart message.

Parameters
pccStartPointer to the start of the buffer containing headers.
pccEndPointer to the end of the buffer.
pstSepLenPointer to a size_t variable where the length of the separator will be stored.
Returns
Pointer to the end of the headers, or NULL if not found.

◆ freeCwlParts()

static void freeCwlParts ( cwlPart *  pcpParts,
int  iNbParts 
)
static

Frees the strings owned by the parts.

'data' is NOT freed: it points into the body buffer provided by the caller.

Parameters
pcpPartsArray of parts.
iNbPartsNumber of valid entries in the array.

◆ getDirName()

char* getDirName ( const char *  pccPath)

Returns the parent directory of the given path, allocated with malloc.

The caller is responsible for freeing the returned string.

Parameters
pccPathFull path to the file for which the parent directory is to be determined.
Returns
Malloc'ed parent directory, or NULL if the allocation fails.

◆ handleCwlMultipartDeploy()

int handleCwlMultipartDeploy ( maps *  pmsConf,
const char *  pccBody,
size_t  stBodyLen,
const char *  pccBoundary,
const char *  pccStartId 
)

Handle the deployment of a CWL multipart request.

Writes every part under an exclusively created work directory and publishes the "cwl-parts" map and "main"/"workDir" in the configuration only once everything has been written successfully. Every error path goes through a single cleanup block.

Root document contract (RFC 2387):

  • if start= is given, it is compared, after removing the optional angle brackets, with the Content-ID of each part (exact match, no "cid:" handling): start="<main@cwl>" selects the part whose header is "Content-ID: <main@cwl>". It must match exactly one part, otherwise the request is rejected;
  • if start= is absent, the root is the FIRST part.

Published in "cwl-parts": name (raw start value, "" if absent), path[i] and file[i] for each part, main (relative name of the root) and mainPath (absolute path of the root). Two parts resolving to the same path, or sharing the same Content-ID, are rejected.

Parameters
pmsConfThe configuration maps.
pccBodyThe body of the multipart request.
stBodyLenThe length of the body.
pccBoundaryThe boundary string for the multipart request.
pccStartIdThe start parameter value (may be NULL).
Returns
0 on success, -1 on failure (an OGC exception has been raised).

◆ handleInternalError()

int handleInternalError ( maps *  pmsConf,
const char *  pccMessage 
)

Raise an OGC "NoApplicableCode" exception (server-side failure: disk full, out of memory, ...) and return -1.

Parameters
pmsConfThe configuration maps.
pccMessageThe error message.
Returns
Always returns -1.

◆ handleInvalidParameterValue()

int handleInvalidParameterValue ( maps *  pmsConf,
const char *  pccMessage 
)

Raise an OGC "InvalidParameterValue" exception and return -1.

Parameters
pmsConfThe configuration maps.
pccMessageThe error message.
Returns
Always returns -1.

◆ kvpParseInputs()

int kvpParseInputs ( maps **  pmsConf,
service *  s,
map *  request_inputs,
maps **  request_output,
HINTERNET *  hInternet 
)

Parse inputs provided as KVP and store them in a maps.

Parameters
pmsConfthe conf maps containing the main.cfg settings
sthe service
request_inputsthe map storing KVP raw value
request_outputthe maps to store the KVP pairs
hInternetthe HINTERNET queue to add potential requests
Returns
0 on success, -1 on failure

◆ kvpParseOutputs()

int kvpParseOutputs ( maps **  pmsConf,
map *  request_inputs,
maps **  request_output 
)

Parse outputs provided as KVP and store them in a maps.

Parameters
pmsConfthe conf maps containing the main.cfg settings
request_inputsthe map storing KVP raw value
request_outputthe maps to store the KVP pairs
Returns
0 on success, -1 on failure

Parsing outputs provided as KVP

Put each Output into the outputs_as_text array

◆ mkdirOne()

static int mkdirOne ( const char *  pccPath)
static

Creates one directory; an already existing path is accepted ONLY if it is a real directory (not a file, not a symlink).

◆ mkdirRecursive()

int mkdirRecursive ( const char *  pccPath)

Recursively create the specified directory and all its missing parent directories.

Equivalent to "mkdir -p".

Parameters
pccPathThe path of the directory to create.
Returns
0 on success (or if the directory already exists), -1 on failure.

◆ mkdirRecursiveForFile()

int mkdirRecursiveForFile ( const char *  pccFilePath)

Recursively create the parent directory of the specified file path (without creating the file itself).

Parameters
pccFilePathThe path of the file whose parent directory is to be created.
Returns
0 on success (or if the parent directory already exists), -1 on failure.

◆ parseCookie()

void parseCookie ( maps **  conf,
const char *  cookie 
)

Parse cookie contained in request headers.

Parameters
confthe conf maps containinfg the main.cfg
cookiethe

◆ parseInputHttpRequests()

int parseInputHttpRequests ( maps *  conf,
maps *  inputs,
HINTERNET *  hInternet 
)

Parse all the http requests possibily attached to inputs and, add them to the request queue.

Add Reference and Order fields to the input's metadata map.

Parameters
confmaps containing the main configuration file
inputsmaps containing all the inputs
hInternetan HTINTERNET connection
Returns
0 in case of success
See also
readCurrentInput

◆ parsePartHeaders()

static cwlStatus parsePartHeaders ( const char *  pccHeaderBlock,
size_t  stLen,
cwlPart *  pcpPart 
)
static

Parses the headers of a multipart part and fills the corresponding fields in the cwlPart structure.

A repeated Content-ID, Content-Location or Content-Type header is rejected (ambiguous), and an allocation failure is reported instead of silently dropping the header.

Parameters
pccHeaderBlockPointer to the start of the header block.
stLenLength of the header block.
pcpPartPointer to the cwlPart structure to be filled with the parsed headers.
Returns
CWL_OK, CWL_ERR_INVALID or CWL_ERR_NOMEM. On error, the strings already stored in pcpPart stay owned by it (freed by freeCwlParts).

◆ parseRequest()

int parseRequest ( maps **  pmsConf,
map **  request_inputs,
service *  s,
maps **  inputs,
maps **  outputs,
HINTERNET *  hInternet 
)

Parse request and store information in maps.

Parameters
pmsConfthe conf maps containing the main.cfg settings
postthe string containing the XML request
request_inputsthe map storing KVP raw value
sthe service
inputsthe maps to store the KVP pairs
outputsthe maps to store the KVP pairs
hInternetthe HINTERNET queue to add potential requests
Returns
0 on success, -1 on failure
See also
kvpParseOutputs,kvpParseInputs,xmlParseRequest

◆ pathStaysUnderWorkDir()

int pathStaysUnderWorkDir ( const char *  pccWorkDir,
const char *  pccFullPath 
)

Verify that the parent directory of fullPath resolves under workDir.

The final file component is NOT checked here: it is created with O_CREAT | O_EXCL | O_NOFOLLOW by the caller, which refuses an existing file or a symlink.

Parameters
pccWorkDirThe base directory to check against.
pccFullPathThe full path to check.
Returns
1 if the parent of fullPath is under workDir, 0 otherwise.

◆ removeRecursive()

static int removeRecursive ( const char *  pccPath)
static

Recursively remove the specified file or directory.

If the path is a directory, all its contents are removed as well.

Parameters
pccPathThe path to remove.
Returns
0 on success, -1 on failure.

◆ sanitizeRelativePath()

cwlStatus sanitizeRelativePath ( const char *  pccRawName,
char **  ppcOut 
)

Sanitize a relative file path.

Parameters
pccRawNameThe raw relative file path to sanitize.
ppcOutReceives a newly allocated "clean" relative path on CWL_OK, NULL otherwise.
Returns
CWL_OK, CWL_ERR_INVALID (dangerous or invalid path) or CWL_ERR_NOMEM.

◆ splitHeaderLine()

static cwlStatus splitHeaderLine ( const char *  pccLine,
size_t  stLen,
char **  ppcField,
char **  ppcValue 
)
static

Splits a header line into its field and value components.

On CWL_OK, both outputs are either malloc'ed (to be freed by the caller) or both NULL when the line is a folded continuation line, which is ignored.

Parameters
pccLinePointer to the start of the header line.
stLenLength of the header line.
ppcFieldReceives the field name.
ppcValueReceives the field value.
Returns
CWL_OK, CWL_ERR_INVALID (no colon on a non-continuation line) or CWL_ERR_NOMEM.

◆ splitMultipartRelated()

cwlStatus splitMultipartRelated ( const char *  pccBody,
size_t  stBodyLen,
const char *  pccBoundary,
cwlPart  pcpParts[],
int  iMaxParts,
int *  piNbParts 
)

Splits a multipart/related body into its constituent parts.

Delimiters are only recognized as full lines; the closing delimiter ("--boundary--") is required; more than iMaxParts parts is an error (no silent truncation). On failure, everything allocated here is released.

Parameters
pccBodyPointer to the start of the body.
stBodyLenLength of the body.
pccBoundaryBoundary string used to separate parts.
pcpPartsArray of cwlPart structures to be filled.
iMaxPartsMaximum number of parts that can be stored in the parts array.
piNbPartsPointer to an integer where the number of parts found will be stored (0 on failure).
Returns
CWL_OK, CWL_ERR_INVALID or CWL_ERR_NOMEM.

◆ stripAngleBrackets()

static char* stripAngleBrackets ( const char *  pccInput)
static

Strips angle brackets from a string if they exist.

Parameters
pccInputThe input string.
Returns
A newly allocated string without angle brackets, or NULL if the input is NULL or the allocation fails.

◆ validateRequest()

int validateRequest ( maps **  pmsConf,
service *  s,
map *  original_request,
maps **  request_inputs,
maps **  request_outputs,
HINTERNET *  hInternet 
)

Ensure that each requested arguments are present in the request DataInputs and ResponseDocument / RawDataOutput.

Potentially run http requests from the queue in parallel. For optional inputs add default values defined in the ZCFG file.

Parameters
pmsConf
s
original_request
request_inputs
request_outputs
hInternet
See also
runHttpRequests

◆ writeAll()

static int writeAll ( int  iFd,
const char *  pccData,
size_t  stLen 
)
static

Write the whole buffer to a file descriptor, handling partial writes and EINTR.

Uses write(2) directly, so FCGI's stdio wrappers are not involved.

Returns
0 on success, -1 on error.

◆ xmlParseBoundingBox()

int xmlParseBoundingBox ( maps **  pmsConf,
map **  current_input,
xmlDocPtr  doc 
)

Parse a BoundingBoxData node.

http://schemas.opengis.net/ows/1.1.0/owsCommon.xsd: BoundingBoxType

A map to store boundingbox information will contain:

  • LowerCorner : double double (minimum within this bounding box)
  • UpperCorner : double double (maximum within this bounding box)
  • crs : URI (Reference to definition of the CRS)
  • dimensions : int
Parameters
pmsConfthe conf maps containing the main.cfg settings
request_inputsthe map storing KVP raw value
docthe xmlDocPtr containing the BoudingoxData node
Returns
a map containing all the bounding box keys

◆ xmlParseInputs()

int xmlParseInputs ( maps **  pmsConf,
service *  s,
maps **  request_output,
xmlDocPtr  doc,
xmlNodeSet *  nodes,
HINTERNET *  hInternet 
)

Parse inputs from XML nodes and store them in a maps.

Parameters
pmsConfthe conf maps containing the main.cfg settings
sthe service
request_outputthe maps to store the KVP pairs
docthe xmlDocPtr containing the original request
nodesthe input nodes array
hInternetthe HINTERNET queue to add potential requests
Returns
0 on success, -1 on failure

◆ xmlParseOutputs()

int xmlParseOutputs ( maps **  pmsConf,
map **  request_inputs,
maps **  request_output,
xmlDocPtr  doc,
xmlNodePtr  cur,
bool  raw 
)

Parse outputs from XML nodes and store them in a maps.

Parameters
pmsConfthe conf maps containing the main.cfg settings
request_inputsthe map storing KVP raw value
request_outputthe maps to store the KVP pairs
docthe xmlDocPtr containing the original request
curthe xmlNodePtr corresponding to the ResponseDocument or RawDataOutput XML node
rawtrue if the node is RawDataOutput, false in case of ResponseDocument
Returns
0 on success, -1 on failure

◆ xmlParseOutputs2()

int xmlParseOutputs2 ( maps **  pmsConf,
map **  request_inputs,
maps **  request_output,
xmlDocPtr  doc,
xmlNodeSet *  nodes 
)

Parse outputs from XML nodes and store them in a maps (WPS version 2.0.0).

Parameters
pmsConfthe conf maps containing the main.cfg settings
request_inputsthe map storing KVP raw value
request_outputthe maps to store the KVP pairs
docthe xmlDocPtr containing the original request
curthe xmlNodePtr corresponding to the ResponseDocument or RawDataOutput XML node
rawtrue if the node is RawDataOutput, false in case of ResponseDocument
Returns
0 on success, -1 on failure

◆ xmlParseRequest()

int xmlParseRequest ( maps **  pmsConf,
const char *  post,
map **  request_inputs,
service *  s,
maps **  inputs,
maps **  outputs,
HINTERNET *  hInternet 
)

Parse XML request and store information in maps.

Parameters
pmsConfthe conf maps containing the main.cfg settings
postthe string containing the XML request
request_inputsthe map storing KVP raw value
sthe service
inputsthe maps to store the KVP pairs
outputsthe maps to store the KVP pairs
hInternetthe HINTERNET queue to add potential requests
Returns
0 on success, -1 on failure

Extract Input nodes from the XML Request.