gwenhywfar  4.99.8beta
HTTP Session

Contructor/Destructor

GWENHYWFAR_API GWEN_HTTP_SESSIONGWEN_HttpSession_new (const char *url, const char *defaultProto, int defaultPort)
 
GWENHYWFAR_API void GWEN_HttpSession_Attach (GWEN_HTTP_SESSION *sess)
 
GWENHYWFAR_API void GWEN_HttpSession_free (GWEN_HTTP_SESSION *sess)
 

HTTP Setup Functions

Functions of this groups should be called before GWEN_HttpSession_Init because the information conveyed via these functions is needed upon initialisation.

GWENHYWFAR_API uint32_t GWEN_HttpSession_GetFlags (const GWEN_HTTP_SESSION *sess)
 
GWENHYWFAR_API void GWEN_HttpSession_SetFlags (GWEN_HTTP_SESSION *sess, uint32_t fl)
 
GWENHYWFAR_API void GWEN_HttpSession_AddFlags (GWEN_HTTP_SESSION *sess, uint32_t fl)
 
GWENHYWFAR_API void GWEN_HttpSession_SubFlags (GWEN_HTTP_SESSION *sess, uint32_t fl)
 
GWENHYWFAR_API const char * GWEN_HttpSession_GetHttpUserAgent (const GWEN_HTTP_SESSION *sess)
 
GWENHYWFAR_API void GWEN_HttpSession_SetHttpUserAgent (GWEN_HTTP_SESSION *sess, const char *s)
 
GWENHYWFAR_API const char * GWEN_HttpSession_GetHttpContentType (const GWEN_HTTP_SESSION *sess)
 
GWENHYWFAR_API void GWEN_HttpSession_SetHttpContentType (GWEN_HTTP_SESSION *sess, const char *s)
 
GWENHYWFAR_API int GWEN_HttpSession_GetHttpVMajor (const GWEN_HTTP_SESSION *sess)
 
GWENHYWFAR_API void GWEN_HttpSession_SetHttpVMajor (GWEN_HTTP_SESSION *sess, int i)
 
GWENHYWFAR_API int GWEN_HttpSession_GetHttpVMinor (const GWEN_HTTP_SESSION *sess)
 
GWENHYWFAR_API void GWEN_HttpSession_SetHttpVMinor (GWEN_HTTP_SESSION *sess, int i)
 

Initialisation and Deinitialisation

GWENHYWFAR_API int GWEN_HttpSession_Init (GWEN_HTTP_SESSION *sess)
 
GWENHYWFAR_API int GWEN_HttpSession_Fini (GWEN_HTTP_SESSION *sess)
 

Sending and Receiving

GWENHYWFAR_API int GWEN_HttpSession_SendPacket (GWEN_HTTP_SESSION *sess, const char *httpCommand, const uint8_t *buf, uint32_t blen)
 
GWENHYWFAR_API int GWEN_HttpSession_RecvPacket (GWEN_HTTP_SESSION *sess, GWEN_BUFFER *buf)
 
GWENHYWFAR_API int GWEN_HttpSession_RecvPacketToFile (GWEN_HTTP_SESSION *sess, const char *fname)
 
GWENHYWFAR_API int GWEN_HttpSession_ConnectionTest (GWEN_HTTP_SESSION *sess)
 

SyncIO Initialisation

After creating a connection layer (consisting of a chain of GWEN_SYNCIO's) this callback is called. AqBanking uses it to set the TLS-cert-checking callback for the TLS syncio part (GWEN_SyncIo_Tls_SetCheckCertFn), so whenever a TLS connection is established and a certificate received, that function is called.

typedef int GWENHYWFAR_CB(* GWEN_HTTPSESSION_INITSYNCIO_FN )(GWEN_HTTP_SESSION *sess, GWEN_SYNCIO *sio)
 
GWENHYWFAR_API
GWEN_HTTPSESSION_INITSYNCIO_FN 
GWEN_HttpSession_SetInitSyncIoFn (GWEN_HTTP_SESSION *sess, GWEN_HTTPSESSION_INITSYNCIO_FN f)
 

Detailed Description

This module provides support for exchanging a HTTP(s) request.

Typedef Documentation

typedef int GWENHYWFAR_CB(* GWEN_HTTPSESSION_INITSYNCIO_FN)(GWEN_HTTP_SESSION *sess, GWEN_SYNCIO *sio)

Definition at line 189 of file httpsession.h.

Function Documentation

GWENHYWFAR_API void GWEN_HttpSession_AddFlags ( GWEN_HTTP_SESSION sess,
uint32_t  fl 
)

Definition at line 113 of file httpsession.c.

GWENHYWFAR_API void GWEN_HttpSession_Attach ( GWEN_HTTP_SESSION sess)

Definition at line 57 of file httpsession.c.

GWENHYWFAR_API int GWEN_HttpSession_ConnectionTest ( GWEN_HTTP_SESSION sess)

Test-connect to the server. This function can be used to retrieve the SSL certificate from a server as the cert exchange is part of the establishing of a connection. This function connects to the server and immediately disconnects.

Definition at line 629 of file httpsession.c.

References DBG_INFO, DBG_NOTICE, GWEN_ERROR_SSL, GWEN_Gui_ProgressLog(), GWEN_LOGDOMAIN, GWEN_LoggerLevel_Error, GWEN_LoggerLevel_Notice, GWEN_SyncIo_Connect(), GWEN_SyncIo_Disconnect(), and I18N.

Here is the call graph for this function:

GWENHYWFAR_API int GWEN_HttpSession_Fini ( GWEN_HTTP_SESSION sess)

Definition at line 282 of file httpsession.c.

References GWEN_SyncIo_Disconnect(), GWEN_SyncIo_free(), and NULL.

Here is the call graph for this function:

GWENHYWFAR_API void GWEN_HttpSession_free ( GWEN_HTTP_SESSION sess)

Definition at line 65 of file httpsession.c.

References GWEN_FREE_OBJECT, GWEN_INHERIT_FINI, and GWEN_SyncIo_free().

Here is the call graph for this function:

GWENHYWFAR_API uint32_t GWEN_HttpSession_GetFlags ( const GWEN_HTTP_SESSION sess)

Definition at line 95 of file httpsession.c.

GWENHYWFAR_API const char* GWEN_HttpSession_GetHttpContentType ( const GWEN_HTTP_SESSION sess)

Definition at line 153 of file httpsession.c.

GWENHYWFAR_API const char* GWEN_HttpSession_GetHttpUserAgent ( const GWEN_HTTP_SESSION sess)

Definition at line 131 of file httpsession.c.

GWENHYWFAR_API int GWEN_HttpSession_GetHttpVMajor ( const GWEN_HTTP_SESSION sess)

Definition at line 175 of file httpsession.c.

GWENHYWFAR_API int GWEN_HttpSession_GetHttpVMinor ( const GWEN_HTTP_SESSION sess)

Definition at line 193 of file httpsession.c.

GWENHYWFAR_API int GWEN_HttpSession_Init ( GWEN_HTTP_SESSION sess)
GWENHYWFAR_API GWEN_HTTP_SESSION* GWEN_HttpSession_new ( const char *  url,
const char *  defaultProto,
int  defaultPort 
)

Definition at line 39 of file httpsession.c.

References GWEN_INHERIT_INIT, and GWEN_NEW_OBJECT.

GWENHYWFAR_API int GWEN_HttpSession_RecvPacket ( GWEN_HTTP_SESSION sess,
GWEN_BUFFER buf 
)

This function receives a response packet from the server and closes the connection. It expects the connection to be established by GWEN_HttpSession_SendPacket().

Definition at line 455 of file httpsession.c.

References DBG_INFO, GWEN_Buffer_Crop(), GWEN_Buffer_GetPos(), GWEN_Gui_ProgressLog(), GWEN_HttpSession__RecvPacket(), GWEN_LOGDOMAIN, GWEN_LoggerLevel_Debug, GWEN_SyncIo_Disconnect(), and I18N.

Here is the call graph for this function:

GWENHYWFAR_API int GWEN_HttpSession_RecvPacketToFile ( GWEN_HTTP_SESSION sess,
const char *  fname 
)
GWENHYWFAR_API int GWEN_HttpSession_SendPacket ( GWEN_HTTP_SESSION sess,
const char *  httpCommand,
const uint8_t *  buf,
uint32_t  blen 
)

This function connects to the server and then sends the given message. The buffer given as argument to this function must only contain the raw data (i.e. the HTTP body, no header).

Parameters
sesshttp session object
httpCommandHTTP command to send (e.g. "GET", "POST")
bufpointer to the http body data to send
blensize of the http body data to send (might be 0)

Definition at line 297 of file httpsession.c.

References DBG_INFO, DBG_NOTICE, GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_SetCharValue(), GWEN_DB_SetIntValue(), GWEN_ERROR_SSL, GWEN_Gui_ProgressLog(), GWEN_Gui_ProgressLog2(), GWEN_LOGDOMAIN, GWEN_LoggerLevel_Debug, GWEN_LoggerLevel_Error, GWEN_SyncIo_Connect(), GWEN_SyncIo_Disconnect(), GWEN_SyncIo_Http_GetDbCommandOut(), GWEN_SyncIo_Http_GetDbHeaderOut(), GWEN_SyncIo_WriteForced(), and I18N.

Here is the call graph for this function:

GWENHYWFAR_API void GWEN_HttpSession_SetFlags ( GWEN_HTTP_SESSION sess,
uint32_t  fl 
)

Definition at line 104 of file httpsession.c.

GWENHYWFAR_API void GWEN_HttpSession_SetHttpContentType ( GWEN_HTTP_SESSION sess,
const char *  s 
)

Definition at line 162 of file httpsession.c.

References NULL.

GWENHYWFAR_API void GWEN_HttpSession_SetHttpUserAgent ( GWEN_HTTP_SESSION sess,
const char *  s 
)

Definition at line 140 of file httpsession.c.

References NULL.

GWENHYWFAR_API void GWEN_HttpSession_SetHttpVMajor ( GWEN_HTTP_SESSION sess,
int  i 
)

Definition at line 184 of file httpsession.c.

GWENHYWFAR_API void GWEN_HttpSession_SetHttpVMinor ( GWEN_HTTP_SESSION sess,
int  i 
)

Definition at line 202 of file httpsession.c.

Definition at line 85 of file httpsession.c.

GWENHYWFAR_API void GWEN_HttpSession_SubFlags ( GWEN_HTTP_SESSION sess,
uint32_t  fl 
)

Definition at line 122 of file httpsession.c.