rtxHttp.h File Reference

#include "rtxsrc/rtxArrayList.h"
#include "rtxsrc/rtxNetUtil.h"

Go to the source code of this file.

Functions

EXTERNRT int rtxHttpGet (OSCTXT *pctxt, const char *url, OSRTHttpContent *pContent)
 This function executes a full synchronous HTTP GET request.
EXTERNRT int rtxHttpSendGetRequest (OSRTNETCONN *pNetConn, const char *url)
 This function sends an HTTP GET request to a network connection.
EXTERNRT int rtxHttpSendRequest (OSRTNETCONN *pNetConn, const char *method, const char *content, const char *contentType)
 This function sends an HTTP request to a network connection.
EXTERNRT int rtxHttpRecvRespHdr (OSRTNETCONN *pNetConn, OSRTHttpHeader *pHeader)
 This function receives the initial header returned from an HTTP request.
EXTERNRT int rtxHttpRecvContent (OSRTNETCONN *pNetConn, OSRTHttpHeader *pHeader, OSRTHttpContent *pContent)
 This function receives HTTP content.

Detailed Description

Definition in file rtxHttp.h.


Function Documentation

EXTERNRT int rtxHttpGet ( OSCTXT pctxt,
const char *  url,
OSRTHttpContent *  pContent 
)

This function executes a full synchronous HTTP GET request.

A network connection is opened and a GET request sent to the given URL. The response is then read and returned, after which the network connection is closed.

Parameters:
pctxt - Pointer to context structure.
url - Full URL of get request.
pContent - Pointer to content buffer to receive response.
Returns:
- Operation status: 0 if success, negative code if error.
EXTERNRT int rtxHttpRecvContent ( OSRTNETCONN *  pNetConn,
OSRTHttpHeader *  pHeader,
OSRTHttpContent *  pContent 
)

This function receives HTTP content.

All content associated with the response header is stored in the given memory buffer.

Parameters:
pNetConn - Pointer to network connection structure.
pHeader - Pointer to response header structure describing content.
pContent - Buffer to receive content. Dynamic memory is allocated for the content using the rtxMemAlloc function.
Returns:
- Operation status: 0 if success, negative code if error.
EXTERNRT int rtxHttpRecvRespHdr ( OSRTNETCONN *  pNetConn,
OSRTHttpHeader *  pHeader 
)

This function receives the initial header returned from an HTTP request.

The header response information is returned in the header structure.

Parameters:
pNetConn - Pointer to network connection structure.
pHeader - Pointer to header structure to receive returned data.
Returns:
- Operation status: 0 if success, negative code if error.
EXTERNRT int rtxHttpSendGetRequest ( OSRTNETCONN *  pNetConn,
const char *  url 
)

This function sends an HTTP GET request to a network connection.

Parameters:
pNetConn - Pointer to network connection structure.
url - Full URL of get request. May be set to NULL if URL was provided earlier in rtxNetInitConn function call.
Returns:
- Operation status: 0 if success, negative code if error.
EXTERNRT int rtxHttpSendRequest ( OSRTNETCONN *  pNetConn,
const char *  method,
const char *  content,
const char *  contentType 
)

This function sends an HTTP request to a network connection.

Parameters:
pNetConn - Pointer to network connection structure.
method - HTTP method to be used for request (GET or POST)
content - Content to be sent after header.
contentType - Type of content.
Returns:
- Operation status: 0 if success, negative code if error.