cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1930028 ] HTTP POST hangs on zero-sized file upload.

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Mon, 31 Mar 2008 02:55:08 -0700

Bugs item #1930028, was opened at 2008-03-31 15:25
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1930028&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: libcurl
Group: hang
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Balakrishnan (balakrishnan84)
Assigned to: Daniel Stenberg (bagder)
Summary: HTTP POST hangs on zero-sized file upload.

Initial Comment:
Hello All,

      The following is the function which I am using to uplaod a file to my web server. If I try to upload a zero-sized file, it hangs. So, I manually verified the file size then it works. Please check.

Thanks and Regards,
Bala

void upload_file (char *filename)
{
        CURL *curl;
        CURLcode res;
        struct curl_httppost *formpost=NULL;
        struct curl_httppost *lastptr=NULL;
        struct curl_slist *headerlist=NULL;
        static const char buf[] = "Expect:";
// struct stat buffer;
// stat(filename, &buffer);
// if(buffer.st_size>0)
        {
                curl_global_init(CURL_GLOBAL_ALL);
                curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "filename", CURLFORM_FILE, filename, CURLFORM_END);
                curl = curl_easy_init();
                headerlist = curl_slist_append(headerlist, buf);
                if(curl) {
                        curl_easy_setopt(curl, CURLOPT_URL, "http://10.40.10.217/racs/upload.cgi");
                        curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
                        res = curl_easy_perform(curl);
                        curl_easy_cleanup(curl);
                        curl_formfree(formpost);
                        curl_slist_free_all (headerlist);
                }
        }
}

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1930028&group_id=976
Received on 2008-03-31

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET