Whole document tree
    

Whole document tree

nanohttp

nanohttp

Name

nanohttp -- 

Synopsis



void        xmlNanoHTTPInit                 (void);
void        xmlNanoHTTPCleanup              (void);
void        xmlNanoHTTPScanProxy            (const char *URL);
int         xmlNanoHTTPFetch                (const char *URL,
                                             const char *filename,
                                             char **contentType);
void*       xmlNanoHTTPMethod               (const char *URL,
                                             const char *method,
                                             const char *input,
                                             char **contentType,
                                             const char *headers);
void*       xmlNanoHTTPOpen                 (const char *URL,
                                             char **contentType);
int         xmlNanoHTTPReturnCode           (void *ctx);
int         xmlNanoHTTPRead                 (void *ctx,
                                             void *dest,
                                             int len);
int         xmlNanoHTTPSave                 (void *ctxt,
                                             const char *filename);
void        xmlNanoHTTPClose                (void *ctx);

Description

Details

xmlNanoHTTPInit ()

void        xmlNanoHTTPInit                 (void);

Initialize the HTTP protocol layer. Currently it just checks for proxy informations


xmlNanoHTTPCleanup ()

void        xmlNanoHTTPCleanup              (void);


xmlNanoHTTPScanProxy ()

void        xmlNanoHTTPScanProxy            (const char *URL);

(Re)Initialize the HTTP Proxy context by parsing the URL and finding the protocol host port it indicates. Should be like http://myproxy/ or http://myproxy:3128/ A NULL URL cleans up proxy informations.

URL : The proxy URL used to initialize the proxy context


xmlNanoHTTPFetch ()

int         xmlNanoHTTPFetch                (const char *URL,
                                             const char *filename,
                                             char **contentType);

This function try to fetch the indicated resource via HTTP GET and save it's content in the file.

URL : The URL to load
filename : the filename where the content should be saved
contentType : if available the Content-Type information will be returned at that location
Returns :-1 in case of failure, 0 incase of success. The contentType, if provided must be freed by the caller


xmlNanoHTTPMethod ()

void*       xmlNanoHTTPMethod               (const char *URL,
                                             const char *method,
                                             const char *input,
                                             char **contentType,
                                             const char *headers);

This function try to open a connection to the indicated resource via HTTP using the given method, adding the given extra headers and the input buffer for the request content.

URL : The URL to load
method : the HTTP method to use
input : the input string if any
contentType : the Content-Type information IN and OUT
headers : the extra headers


xmlNanoHTTPOpen ()

void*       xmlNanoHTTPOpen                 (const char *URL,
                                             char **contentType);

This function try to open a connection to the indicated resource via HTTP GET.

URL : The URL to load
contentType : if available the Content-Type information will be returned at that location


xmlNanoHTTPReturnCode ()

int         xmlNanoHTTPReturnCode           (void *ctx);

ctx : the HTTP context
Returns :the HTTP return code for the request.


xmlNanoHTTPRead ()

int         xmlNanoHTTPRead                 (void *ctx,
                                             void *dest,
                                             int len);

This function tries to read len bytes from the existing HTTP connection and saves them in dest. This is a blocking call.

ctx : the HTTP context
dest : a buffer
len : the buffer length
Returns :the number of byte read. 0 is an indication of an end of connection. -1 indicates a parameter error.


xmlNanoHTTPSave ()

int         xmlNanoHTTPSave                 (void *ctxt,
                                             const char *filename);

This function saves the output of the HTTP transaction to a file It closes and free the context at the end

ctxt : the HTTP context
filename : the filename where the content should be saved
Returns :-1 in case of failure, 0 incase of success.


xmlNanoHTTPClose ()

void        xmlNanoHTTPClose                (void *ctx);

This function closes an HTTP context, it ends up the connection and free all data related to it.

ctx : the HTTP context