cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem posting binary "complex" structure.

From: Daniel C <daniel_anonim_at_yahoo.com.ar>
Date: Wed, 6 Aug 2008 14:48:41 -0700 (PDT)

Sorry for the lack of information.
Windows XP with vs compiler.

Code:

/**************/
int sendRequestFastCgi(byte* pedido,unsigned sizePedido,byte*  respuesta,unsigned  *sizeRespuesta){

    CURLcode res = CURL_LAST;

    if(curlService){
        curl_easy_setopt(curlService, CURLOPT_POSTFIELDS, pedido);       
        curl_easy_setopt(curlService, CURLOPT_POSTFIELDSIZE,sizePedido);               
        curl_easy_setopt(curlService, CURLOPT_WRITEFUNCTION, write_function);
        curl_easy_setopt(curlService, CURLOPT_WRITEDATA, respuesta);
        memset(respuesta,0,*sizeRespuesta);   
        res = curl_easy_perform(curlService);
       
    }
    return (int)res;
};
/**************/

This works perfect, except with the "complex" struct, that I can not show; it uses serveral macros and templates for its definition, but works correct if not using curl sending it.

This code anyway is not the problem cause works ok with other structs.

I explain again that and hex examination show that before curl the struct is ok so the size send and receive, but the receive struct (even with correct size) has all '0' in it!!!.

curls version:  curl-7.18.2

Thanks
Received on 2008-08-06