Blame doc/devhelp/libxml2-nanohttp.html

Packit 423ecb
Packit 423ecb
<html>
Packit 423ecb
  <head>
Packit 423ecb
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
Packit 423ecb
    <title>nanohttp: minimal HTTP implementation</title>
Packit 423ecb
    <meta name="generator" content="Libxml2 devhelp stylesheet"/>
Packit 423ecb
    <link rel="start" href="index.html" title="libxml2 Reference Manual"/>
Packit 423ecb
    <link rel="up" href="general.html" title="API"/>
Packit 423ecb
    <link rel="stylesheet" href="style.css" type="text/css"/>
Packit 423ecb
    <link rel="chapter" href="general.html" title="API"/>
Packit 423ecb
  </head>
Packit 423ecb
  <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit 423ecb
    
Packit 423ecb
      
Packit 423ecb
        
Packit 423ecb
          
Packit 423ecb
            Prev
Packit 423ecb
          
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb
          
Packit 423ecb
            Up
Packit 423ecb
          
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb
          
Packit 423ecb
            Home
Packit 423ecb
          
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb
          
Packit 423ecb
            Next
Packit 423ecb
          
Packit 423ecb
        
Packit 423ecb
        libxml2 Reference Manual
Packit 423ecb
      
Packit 423ecb
    
Packit 423ecb
    

Packit 423ecb
      nanohttp
Packit 423ecb
    
Packit 423ecb
    

nanohttp - minimal HTTP implementation

Packit 423ecb
    

minimal HTTP implementation allowing to fetch resources like external subset.

Packit 423ecb
    

Author(s): Daniel Veillard

Packit 423ecb
    
Packit 423ecb
      

Synopsis

Packit 423ecb
      
int	xmlNanoHTTPRead			(void * ctx, 
void * dest,
int len);
Packit 423ecb
int	xmlNanoHTTPSave			(void * ctxt, 
const char * filename);
Packit 423ecb
const char *	xmlNanoHTTPRedir	(void * ctx);
Packit 423ecb
const char *	xmlNanoHTTPAuthHeader	(void * ctx);
Packit 423ecb
int	xmlNanoHTTPFetch		(const char * URL, 
const char * filename,
char ** contentType);
Packit 423ecb
int	xmlNanoHTTPContentLength	(void * ctx);
Packit 423ecb
const char *	xmlNanoHTTPMimeType	(void * ctx);
Packit 423ecb
void	xmlNanoHTTPClose		(void * ctx);
Packit 423ecb
void	xmlNanoHTTPCleanup		(void);
Packit 423ecb
void *	xmlNanoHTTPMethod		(const char * URL, 
const char * method,
const char * input,
char ** contentType,
const char * headers,
int ilen);
Packit 423ecb
void	xmlNanoHTTPInit			(void);
Packit 423ecb
void *	xmlNanoHTTPOpen			(const char * URL, 
char ** contentType);
Packit 423ecb
void *	xmlNanoHTTPOpenRedir		(const char * URL, 
char ** contentType,
char ** redir);
Packit 423ecb
void *	xmlNanoHTTPMethodRedir		(const char * URL, 
const char * method,
const char * input,
char ** contentType,
char ** redir,
const char * headers,
int ilen);
Packit 423ecb
void	xmlNanoHTTPScanProxy		(const char * URL);
Packit 423ecb
const char *	xmlNanoHTTPEncoding	(void * ctx);
Packit 423ecb
int	xmlNanoHTTPReturnCode		(void * ctx);
Packit 423ecb
Packit 423ecb
    
Packit 423ecb
    
Packit 423ecb
      

Description

Packit 423ecb
    
Packit 423ecb
    
Packit 423ecb
      

Details

Packit 423ecb
      
Packit 423ecb
        
Packit 423ecb

Get the authentication header of an HTTP context

Packit 423ecb
<tt>ctx</tt>:the HTTP context
<tt>Returns</tt>:the stashed value of the WWW-Authenticate or Proxy-Authenticate header.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Cleanup the HTTP protocol layer.

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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

Packit 423ecb
<tt>ctx</tt>:the HTTP context
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Provides the specified content length from the HTTP header.

Packit 423ecb
<tt>ctx</tt>:the HTTP context
<tt>Returns</tt>:the specified content length from the HTTP header. Note that a value of -1 indicates that the content length element was not included in the response header.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Provides the specified encoding if specified in the HTTP headers.

Packit 423ecb
<tt>ctx</tt>:the HTTP context
<tt>Returns</tt>:the specified encoding or NULL if not available
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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

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

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

Packit 423ecb
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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.

Packit 423ecb
<tt>URL</tt>:The URL to load
<tt>method</tt>:the HTTP method to use
<tt>input</tt>:the input string if any
<tt>contentType</tt>:the Content-Type information IN and OUT
<tt>headers</tt>:the extra headers
<tt>ilen</tt>:input length
<tt>Returns</tt>:NULL in case of failure, otherwise a request handler. The contentType, if provided must be freed by the caller
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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.

Packit 423ecb
<tt>URL</tt>:The URL to load
<tt>method</tt>:the HTTP method to use
<tt>input</tt>:the input string if any
<tt>contentType</tt>:the Content-Type information IN and OUT
<tt>redir</tt>:the redirected URL OUT
<tt>headers</tt>:the extra headers
<tt>ilen</tt>:input length
<tt>Returns</tt>:NULL in case of failure, otherwise a request handler. The contentType, or redir, if provided must be freed by the caller
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Provides the specified Mime-Type if specified in the HTTP headers.

Packit 423ecb
<tt>ctx</tt>:the HTTP context
<tt>Returns</tt>:the specified Mime-Type or NULL if not available
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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

Packit 423ecb
<tt>URL</tt>:The URL to load
<tt>contentType</tt>:if available the Content-Type information will be returned at that location
<tt>Returns</tt>:NULL in case of failure, otherwise a request handler. The contentType, if provided must be freed by the caller
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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

Packit 423ecb
<tt>URL</tt>:The URL to load
<tt>contentType</tt>:if available the Content-Type information will be returned at that location
<tt>redir</tt>:if available the redirected URL will be returned
<tt>Returns</tt>:NULL in case of failure, otherwise a request handler. The contentType, if provided must be freed by the caller
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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

Packit 423ecb
<tt>ctx</tt>:the HTTP context
<tt>dest</tt>:a buffer
<tt>len</tt>:the buffer length
<tt>Returns</tt>:the number of byte read. 0 is an indication of an end of connection. -1 indicates a parameter error.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Provides the specified redirection URL if available from the HTTP header.

Packit 423ecb
<tt>ctx</tt>:the HTTP context
<tt>Returns</tt>:the specified redirection URL or NULL if not redirected.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

Get the latest HTTP return code received

Packit 423ecb
<tt>ctx</tt>:the HTTP context
<tt>Returns</tt>:the HTTP return code for the request.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

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

Packit 423ecb
<tt>ctxt</tt>:the HTTP context
<tt>filename</tt>:the filename where the content should be saved
<tt>Returns</tt>:-1 in case of failure, 0 incase of success.
Packit 423ecb
        
Packit 423ecb
        
Packit 423ecb

(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.

Packit 423ecb
<tt>URL</tt>:The proxy URL used to initialize the proxy context
Packit 423ecb
        
Packit 423ecb
      
Packit 423ecb
    
Packit 423ecb
  </body>
Packit 423ecb
</html>