Response body buffer Callback

ResponsebodybufferCB

Example: Asynchronous Conversations Asynchonous Functions

Called when there is content in the response body buffer and at the end of the response body.

int <function name> ( IN const char *aLastbufferStr, 
		IN int aLastbufferLen, 
		IN const char *aAccumulatedStr, 
		IN int aAccumulatedLen, 
		IN int aHttpStatuscode );
Argument Description
aLastbufferStr

A pointer to one of:

  • A non-empty string containing the pre-processed data from the last-received response buffer. The data can contain NULL bytes (\0).
  • An empty string to denote the end of the response body.
aLastbufferLen

The length of the string pointed-to by aLastbufferStr or zero to denote the end of the response data.

aAccumulatedStr

A pointer to one of:

  • A non-empty string containing the accumulated pre-processed data from the response buffers received to this point. The data can contain NULL bytes (\0).
  • An empty string to denote the end of the response body.
aAccumulatedLen

The length of the string pointed-to by aAccumulatedStr, or zero to denote the end of the response data

aHttpStatuscode The HTTP status return code.

 

Return Values

Returns a value of WEB_ASYNC_CB_RC_ENUM

General Information

A response body buffer callback is a user-created C-language function. It is invoked zero or more times for each response body buffer received for the ConversationAn Asynchronous Conversation is a series of related web tasks, including tasks caused by redirection. An Asynchronous Conversation starts with the request for the desired response, includes all the requests and responses that are caused by this request (authentication, redirection, and so on) and ends when the desired response is received or when the series of interactions is canceled.. After all of the response body data has been passed to the callback, it is invoked once more with an empty last-buffer string. An empty last-buffer string marks the end of the response body for the current conversation. When the response body is empty, the callback is invoked once to mark the end.

The callback is passed the data extracted from the last read buffer and all response body accumulated to this point.

The response data is processed as follows before being passed to the callback:

Chunking overhead or decompression remainders can cause a non-empty received response buffer to yield no data after the processing described above. The callback is not invoked for such buffers.

Decompression can cause the callback to be called multiple times for a single received buffer.

This callback can invoke the utility function Request Callback and any of the general utility functions. See Utility Functions: JavaScript Language (lr.).