[sldev] [VIEWER] curl trouble

Anna Gulaev annagulaev at gmail.com
Tue Sep 29 19:37:43 PDT 2009


Yes, that's *curl* trouble. This post probably won't contain TMI :-)

I used to be able to send data to a web server from the viewer using curl.
Now all that's being received is thirty dashes followed by six hexidecimal
numbers, like this:

------------------------------07ac4edfb36c

The number is different each time. Doesn't matter what I send; this is
what's received.

Does anyone recognize this? It almost looks like the content separators on
the response. When I say "used to be able to..." I mean a couple days ago.
Not sure what I broke...

Here's the curl code:

    if ( CurlMultiHandle == NULL)
        CurlMultiHandle = curl_multi_init();

    if ( CurlMultiHandle)
    {
        CurlInfo *curl = (CurlInfo *) malloc( sizeof( CurlInfo));
        curl->EasyHandle = curl_easy_init();

        if ( curl->EasyHandle)
        {
            curl->formpost = NULL;
            curl->lastptr = NULL;

            serverLocData = serverLocData + "!\n" + AgentFirstName + " " +
AgentLastName + "\n!\n"; // exclamation ends data block

            curl_formadd( &(curl->formpost), &(curl->lastptr),
                CURLFORM_COPYNAME, "CopyNameGoesHere",
                CURLFORM_COPYCONTENTS, serverLocData.c_str(),
                CURLFORM_END);
vAddChatHistory( "viewer", "sending:"+serverLocData);
vLogFile << "LOC_SERVER_SENDING >" << serverLocData << "<" << endl << flush;
            curl_formadd( &(curl->formpost), &(curl->lastptr),
                CURLFORM_COPYNAME, "submit",
                CURLFORM_COPYCONTENTS, "send",
                CURLFORM_END);

            curl->chunk.memory = NULL;
            curl->chunk.size = 0;

            curl_easy_setopt( curl->EasyHandle, CURLOPT_URL,
LOC_SERVER_UPDATE_URL);
            //curl_easy_setopt( curl->EasyHandle, CURLOPT_VERBOSE, 1);
            curl_easy_setopt( curl->EasyHandle, CURLOPT_WRITEFUNCTION,
ReadWebpageCallback);
            curl_easy_setopt( curl->EasyHandle, CURLOPT_WRITEDATA, (void
*)&(curl->chunk));
            curl_easy_setopt( curl->EasyHandle, CURLOPT_USERAGENT,
"SLCustomViewer");
            curl_easy_setopt( curl->EasyHandle, CURLOPT_HTTPPOST,
curl->formpost);

            curl_multi_add_handle( CurlMultiHandle, curl->EasyHandle);

            CurlEasy.push_back( curl);

            // suck in as much data as is ready
            while( CURLM_CALL_MULTI_PERFORM == curl_multi_perform(
CurlMultiHandle, &CurlStillRunning)); //note semicolon

            if ( !CurlStillRunning)
                curlCleanup();
        }
        else
        {
            vLogFile << "LOC_SERVER_UPDATE_ERROR unable to send data to
server - unable to obtain curl handle" << endl << flush;
        }
    }
    else
    {
        vLogFile << "LOC_SERVER_UPDATE_ERROR unable to send data to server -
unable to obtain curl multihandle" << endl << flush;
    }

Thanks,
Anna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.secondlife.com/pipermail/sldev/attachments/20090929/40dcef3b/attachment-0001.htm 


More information about the SLDev mailing list