Response Callback

ResponseCB

Example: Asynchronous ConversationsAsynchronous Functions - C

Called at the end of a conversation.

WEB_ASYNC_CB_RC_ENUM <function name>( IN const char * aResponseHeadersStr,IN int aResponseHeadersLen,IN const char *aResponseBodyStr, IN int aResponseBodyLen, IN int aHttpStatusCode );

Argument Description
aResponseHeadersStr

A pointer to one of:

  • A non-empty string containing the accumulated response headers of the last conversation task, if it received a response.
  • An empty string if the last conversation task has not received a response.
aResponseHeadersLen

The length of the string pointed to by aResponseHeadersStr.

aResponseBodyStr

A pointer to one of:

  • A string containing the accumulated response body of the last conversation task. The data can contain NULL bytes (\0) and may be empty.
  • An empty string if the last conversation task has not received a response.
aResponseBodyLenThe length of the string pointed to by aResponseBodyStr.
aHttpStatusCodeThe HTTP status return code.

Return Values

This function returns a value of WEB_ASYNC_CB_RC_ENUM.

Parameterization

Standard parameterization is not available for this function.

General Information

A response callback is a user-created function. It is invoked once at the end of a conversation. If the last request within the group received a response, the accumulated response headers and the accumulated response body are passed to the callback. Informational response headers (status codes 1xx) are ignored.

If the last TaskClosed A web task consists of an HTTP request and any directly related HTTP responses and requests until the eventual HTTP response to the initial HTTP request. Redirections are not included in an RDR. did not receive any response, empty strings are passed for accumulated headers and accumulated body.

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

  • If "Transfer-Encoding: chunked" was specified for the response, any overhead bytes are removed.
  • If the response was compressed, it is decompressed. This can leave remainders of data to be handled when more data arrive.
  • If required, any decompression remainders from a previous segment are joined to the data of the current segment.
  • If required, data is converted to the locale charset.

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

Concept Link IconSee Also