cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: server not receiving POST data

From: Anna Gulaev <annagulaev_at_gmail.com>
Date: Thu, 1 Oct 2009 06:25:27 -0400

On Wed, Sep 30, 2009 at 5:29 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> ------------------------------07ac4edfb36c
>>
>
> This looks like a mime separator libcurl uses when sending multipart
> formposts. I'd suggest you use CURLOPT_DEBUGFUNCTION and/or wireshark to get
> to see exactly what libcurl sends and what the server responds.

I've taken two screenshots of wireshark output:

http://www.vengeancestudio.com/forumpics/post.gif
http://www.vengeancestudio.com/forumpics/continue.gif

> // suck in as much data as is ready
>> while( CURLM_CALL_MULTI_PERFORM == curl_multi_perform(
>> CurlMultiHandle, &CurlStillRunning)); //note semicolon
>>
>
> Note that this loop will of course not perform the entire transfer...
>

There is, of course, a periodic check to see if there is more data to
transfer, and that code looks like this:

    if ( CurlStillRunning)
    {
vLogFile << "checkWebserverReturn 1 CurlStillRunning=" << CurlStillRunning
<< endl;
        struct timeval timeout;
        int rc;

        fd_set fdread;
        fd_set fdwrite;
        fd_set fdexcep;
        int maxfd;

        FD_ZERO(&fdread);
        FD_ZERO(&fdwrite);
        FD_ZERO(&fdexcep);

        // set a suitable timeout to play around with
        timeout.tv_sec = 1;
        timeout.tv_usec = 0;

        // get file descriptors from the transfers
        curl_multi_fdset( CurlMultiHandle, &fdread, &fdwrite, &fdexcep,
&maxfd);

        rc = select( maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);

        switch( rc)
        {
            case -1:
                // select error
                break;
            case 0:
                // timeout
            default:
                // timeout or readable/writable sockets
                while ( CURLM_CALL_MULTI_PERFORM == curl_multi_perform(
CurlMultiHandle, &CurlStillRunning));
                break;
        }
vLogFile << "checkWebserverReturn 2 CurlStillRunning=" << CurlStillRunning
<< endl;

        if ( !CurlStillRunning)
            curlCleanup();
    }

For the shown data, this code ran six times before completing the transfer.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-10-01