cURL / Mailing Lists / curl-library / Single Mail

curl-library

error in libcurl.dll?

From: Thomas Reinhardt <threinhardt_at_gmx.de>
Date: Thu, 08 Feb 2007 14:32:44 +0100

Hi Folks,

I was try to send a document and my app crashes.

My sendfunction:

<!--8<--snip---------------->
__declspec(dllexport) int send_xml(char *url, char *filename, char *proxy) {

        struct stat stat_p;
        struct curl_slist *headers=NULL;
        
        CURLcode res = 0;
        int trials=0, i=0;

        FILE *datafile;
        char *xml;
        char datafilename[255], temp[MAX_PATH];

        long length;

        strcpy(datafilename, PathToTemp);
        strcat(datafilename, "\\_temp.xml");

        if ( -1 == stat (filename, &stat_p)) {
                sprintf(temp, "Dateiinformationen von '%s' konnten nicht gelesen werden!\n", filename);
                strcpy(fehlerspeicher, temp);
                sprintf(temp, "\n%s", "Keine Zugriffsrechte oder Datei existiert nicht.");
                strcat(fehlerspeicher, temp);
                return(NoFileInfo);
        }
        length = stat_p.st_size;
        xml = (char *) malloc(length+1);

        if((datafile = fopen(filename,"rb")) != NULL) {
                fread(xml, sizeof(BYTE), length, datafile);
                fclose(datafile);
        }

        xml[length]='\0';

        if(stackmode == 0) {
                res = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);

                datafile = fopen(datafilename,"w");

                if (datafile == NULL) {
                        curl_easy_cleanup(curl);
                        sprintf(temp, "Datei '%s' konnte nicht angelegt werden!", datafilename);
                        strcpy(fehlerspeicher, temp);
                        sprintf(temp, "\n%s", "Bitte überprüfen Sie die Schreibrechte.");
                        strcat(fehlerspeicher, temp);
                        return(CreateTempFailed);
                }

                res = curl_easy_setopt(curl, CURLOPT_WRITEDATA, datafile);

                if(curl) {
                        headers = curl_slist_append(headers, "Content-Type: text/xml");
                        headers = curl_slist_append(headers, "User-Agent: sendxml.dll");
                        res = curl_easy_setopt(curl, CURLOPT_PROXY, proxy);
                        if(strcmp(ProxyKennung, "") != 0) {
                                res = curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
                                res = curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, ProxyKennung);
                        }
                        res = curl_easy_setopt(curl, CURLOPT_POST, TRUE);
                        res = curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long) length);
                        res = curl_easy_setopt(curl, CURLOPT_POSTFIELDS, xml);
                        res = curl_easy_setopt(curl, CURLOPT_URL, url);
                        res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

                        res = -1;
                        while ((res != 0) && (++trials <= max_connects))
                        {
                                res = curl_easy_perform(curl);
                                while(i++<connect_timeout) {
                                        wait(1);
                                }
                                if(verbosity) {
                                        itoa(res, temp, 10);
                                        MessageBox(0, temp, "Connect returns:", MB_OK);
                                }
                        }
                        curl_slist_free_all(headers);
                }
                fclose(datafile);

        } else {
                datafile = fopen(StackFileName,"ab+");
                fprintf(datafile, "%s", xml);
                fclose(datafile);
        }

        free(xml);

        if(res != 0) {
                sprintf(temp, "Es konnte keine Verbindung zum Server hergestellt werden!");
                strcpy(fehlerspeicher, temp);
                sprintf(temp, "\n%s", ebp);
                strcat(fehlerspeicher, temp);
                ebp[0]='\0';
                return(CantConnect);
        }

        return 0;
}
<!-->8--snap---------------->

Microsoft Problemsignature
        AppName: app.exe AppVer: 0.0.0.0 ModName: libcurl.dll
        ModVer, 0.0.0.0 Offset: 00019235

How can I narrow down the function, which this address belongs to.
I can't install any debugger on the errorthrowing machine.

I use:
libcurl.dll 2004/21/01, 13:47:14 188.471 Byte

Thanks

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
Received on 2007-02-08