CCHttpClient responseData size limit

CCHttpClient responseData size limit
0.0 0


Hi, everybody, I’m using CCHttpClient to get json, now I have to handle a long long json data ( <2K but > 1.5K), every time, I can only get 1292 bytes when I read ResponseData. And I tried to wait for the callback be called next time, but no found in log. I’m almost sure the code is OK because others json data be handled normally.
Any limited value can be modified in extensions source code?
or any idea about this case?



I don’t know if I’ve understood you correctly, but…
You can check file’s size before actually downloading it using curl. Have a look at my modified HttpClient:


Thanks kuhar’s reply.
This issue is still confused me, I reviewed your code and it’s great idea if you want download data to local files.
But it’s not my case, in fact, below is the code which try to get Json data from server,

void CommandManager::recvResponse(CCHttpClient *sender, CCHttpResponse *response)
    if ( response == NULL || !response->isSucceed())

    std::string command;

    if (strlen(response->getHttpRequest()->getTag()) != 0)
        command = response->getHttpRequest()->getTag();

    std::vector<char> *buffer = response->getResponseData();
    std::string tstr;
    for ( unsigned int i = 0; i < buffer->size(); i++)
        tstr += (*buffer)[i];
    CCLOG("recv json string is %s",tstr.c_str());
    Json* json = Json_create(tstr.c_str());
    dispatch(command, json);

I check the tstr, it’s a not fully and valid Json data, some data lost, just like "{xx xxx[ ", no “] }” in tstr. but when I access the same URL via chrome or firefox, it looks server works good.

Any comments?

thanks all of you.


I have the same problem. Does anyone have a solution?


I’m not very sure what’s the root cause, it’s long time ago and I have no issue list yet, but it’s not caused by Json, maybe like multi thread or so, in another word, app crashed because multi thread in background during App startup.