HttpReadResponseData

Returns HTTP reply body data.

Syntax

    #include <httpexp.h>
    #include <httpclnt.h> 
     
    int HttpReadResponseData (
       HINTERNET   hndl,
       char      **pReplyDataBuffer,
       UINT32     *pPostDataLen,
       void       *pContext,
       void      (*pCallBackRoutine)(
                   void       *pContext,
                   HINTERNET   hndl,
                   int         returnCode,
                   char      **pReplyDataBuffer,
                   UINT32     *pReplyDataLen,
                   void       *reserved)
    );
    

Parameters

hndl
(IN) Specifies the connection handle returned from HttpConnect.
pReplyDataBuffer
(IN/OUT) Points to a pointer to where the block of data is received.
pPostDataLen
(IN/OUT) Points to the length of the block of data received.
pContext
(IN) Points to optional context data, which is passed to your callback function. For a synchronous request, set it to NULL. Currently only synchronous mode is implemented.
pCallBackRoutine
(IN) Points to the callback function that is called when an asynchronous request returns. For a synchronous request, set it to NULL. Currently only synchronous mode is implemented.

The callback function is passed the following parameters:

  • pContext—Points to any optional context data that you passed in when you called HttpReadResponseData.
  • hndl—Specifies the HTTP connection handle received for this request.
  • returnCode—Specifies the error status for the HttpReadResponseData call. Zero indicates no errors; nonzero indicates an error.
  • pReplyDataLen—Points to a pointer to where the block of data is received.
  • pReplyDataLen—Points to the length of the block of data received.
  • reserved—Reserved for future use. Currently returns NULL.

Return Values

If successful, returns 0. Otherwise, returns a nonzero error code.

Decimal

Name

Description

121

ERR_NO_ITEMS_FOUND

Either there is no body data in this reply, or all the data has been retrieved.

168

ERR_ACCESS_DENIED

The reply header is not valid for this request.

255

ERR_BAD_PARAMETER

An invalid parameter was passed to the function.

Remarks

IMPORTANT:Currently this function only works in synchronous mode. Both the pContext and pCallBackRoutine parameters must be set to 0.

The HttpReadResponseData function returns the address and length of the data received in the body of the HTTP rely. If the reply is chunked, this function should be called once for each chunk of the reply until the ERR_NO_ITEMS_FOUND error code is returned.

See Also