cURL / Mailing Lists / curl-library / Single Mail

curl-library

receive partial file when POSTing

From: Blue Hawk <bluehawk204_at_hotmail.com>
Date: Sun, 10 Aug 2008 23:03:06 -0400

The server likes file request with POST ids. When i request files (other sites) with my fopen/eof/read/close code (based on the fopen example) i have no problems DLing files. however i only get a partial file when i request them on this site with POST data.

The first file i tried i recieved about 600kb, 2nd file i recieved roughly 500kb. The data i do recieve is correct and not an error page, so i am unsure what is happening.

/* from, fopen code*/

        curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
        curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
        curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0);
        curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
        curl_easy_setopt(file->handle.curl, CURLOPT_FOLLOWLOCATION, 1);
/* what i set */
    curl_easy_setopt(login, CURLOPT_COOKIEJAR, cookieFile);
    curl_easy_setopt(login, CURLOPT_COOKIEFILE, cookieFile);
    curl_easy_setopt(login, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
    curl_easy_setopt(login, CURLOPT_TIMEOUT, 40);

    curl_easy_setopt(login, CURLOPT_URL, url);
    curl_easy_setopt(login, CURLOPT_HEADER, 0);
    curl_easy_setopt(login, CURLOPT_FOLLOWLOCATION, 1);
    curl_easy_setopt(login, CURLOPT_POST, 1);
    curl_easy_setopt(login, CURLOPT_POSTFIELDS, data);

/* from my fopen code */
        if(!multi_handle)
            multi_handle = curl_multi_init();

        curl_multi_add_handle(multi_handle, file->handle.curl);

        /* lets start the fetch */
        while(curl_multi_perform(multi_handle, &file->still_running) ==
              CURLM_CALL_MULTI_PERFORM );

....

_________________________________________________________________
Received on 2008-08-11