XBinder  Version 2.9.x
Functions
rtxHttp.h File Reference
#include "rtxsrc/rtxArrayList.h"
#include "rtxsrc/rtxNetUtil.h"

Go to the source code of this file.

Functions

EXTERNRT int rtxHttpSendConnectRequest (OSRTNETCONN *pNetConn)
 This function executes a full synchronous HTTP CONNECT request to setup a connection through a proxy. More...
 
EXTERNRT int rtxHttpGetTls (OSCTXT *pctxt, const char *url, OSRTHttpContent *pContent, tlsInit_t *f_tls_init, tlsClose_t *f_tls_close)
 TLS-enabled version of rtxHttpGet. More...
 
EXTERNRT int rtxHttpGet (OSCTXT *pctxt, const char *url, OSRTHttpContent *pContent)
 This function executes a full synchronous HTTP GET request. More...
 
EXTERNRT int rtxHttpSendGetRequest (OSRTNETCONN *pNetConn, const char *url)
 This function sends an HTTP GET request to a network connection. More...
 
EXTERNRT int rtxHttpSendRequest (OSRTNETCONN *pNetConn, const char *method, const char *content, const char *contentType)
 This function sends an HTTP request to a network connection. More...
 
EXTERNRT int rtxHttpRecvRespHdr (OSRTNETCONN *pNetConn, OSRTHttpHeader *pHeader)
 This function receives the initial header returned from an HTTP request. More...
 
EXTERNRT int rtxHttpRecvContent (OSRTNETCONN *pNetConn, OSRTHttpHeader *pHeader, OSRTHttpContent *pContent)
 This function receives HTTP content. More...
 
EXTERNRT int rtxHttpRecvRespContent (OSRTNETCONN *pNetConn, OSRTHttpHeader *pHeader, OSRTHttpContent *pContent)
 This function receives any HTTP content indicated by the response header. More...
 

Function Documentation

◆ rtxHttpGet()

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.

◆ rtxHttpGetTls()

EXTERNRT int rtxHttpGetTls ( OSCTXT pctxt,
const char *  url,
OSRTHttpContent *  pContent,
tlsInit_t *  f_tls_init,
tlsClose_t *  f_tls_close 
)

TLS-enabled version of rtxHttpGet.

For internal use only. This optionally uses TLS.

This exists to avoid making the runtime dependent on TLS code.

Parameters
f_tls_initIf null, the connection does not use TLS. If the url specifies https and f_tls_init is null, this returns an error. If not null and the url specifies https, then this uses f_tls_init to create a TLS stream on top of the socket stram created by this function. If the url does not specify https, this argument is ignored.
f_tls_closeMust be not null if and only if f_tls_init is not null. This is the function for tearing down a TLS connection.

◆ rtxHttpRecvContent()

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.

◆ rtxHttpRecvRespContent()

EXTERNRT int rtxHttpRecvRespContent ( OSRTNETCONN *  pNetConn,
OSRTHttpHeader *  pHeader,
OSRTHttpContent *  pContent 
)

This function receives any HTTP content indicated by the response header.

If the header does not indicate any additional content, the function does nothing.

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.

◆ rtxHttpRecvRespHdr()

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.

◆ rtxHttpSendConnectRequest()

EXTERNRT int rtxHttpSendConnectRequest ( OSRTNETCONN *  pNetConn)

This function executes a full synchronous HTTP CONNECT request to setup a connection through a proxy.

Parameters
pNetConn- Pointer to network connection structure.
Returns
- Operation status: 0 if success, negative code if error.

◆ rtxHttpSendGetRequest()

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.

◆ rtxHttpSendRequest()

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.