cURL / Mailing Lists / curl-library / Single Mail

curl-library

Debugging libcurl myself?

From: Theodore H. Smith <delete_at_elfdata.com>
Date: Sun, 2 Nov 2008 12:46:02 +0000

Hi libcurl people,

I've found a bug in libcurl, that means using NTLM proxies, loses all
form-data.

Now... It's important to us to get a quick fix. I don't know how long
I'd have to wait if I just let the libcurl (or their helpers) do it.

So... is there some way I can speed this up myself? Let's say I wanted
to debug libcurl myself. Where would I start?

The bug report is here:

https://sourceforge.net/tracker/index.php?func=detail&aid=2210686&group_id=976&atid=100976

The relevant code snippet is here:

                CURL* curl = curl_easy_init();

                curl_easy_setopt( curl, CURLOPT_DEBUGFUNCTION, my_trace );
                curl_easy_setopt( curl, CURLOPT_DEBUGDATA, &config );
                curl_easy_setopt( curl, CURLOPT_VERBOSE, 1L );

                curl_easy_setopt( curl, CURLOPT_URL, My_URL );
                curl_multi_add_handle( multi_handle, curl );

                if ( UseProxy ) {
                        curl_easy_setopt( curl, CURLOPT_HTTPAUTH, CURLAUTH_NTLM );
                        curl_easy_setopt( curl, CURLOPT_PROXYUSERPWD, My_ProxyUser_Pass );
                        curl_easy_setopt( curl, CURLOPT_PROXY, My_ProxyAddress_Port );
                }

                struct curl_httppost* formpost = 0;
                struct curl_httppost* lastptr = 0;
                curl_formadd( &formpost, &lastptr,
                        CURLFORM_COPYNAME, "lea",
                        CURLFORM_COPYCONTENTS, "le2",
                        CURLFORM_CONTENTTYPE, "application/binary",
                        CURLFORM_END );
                curl_easy_setopt( curl, CURLOPT_HTTPPOST, formpost );

                int still_running = 0;
                do {
                        do {
                                Res = curl_multi_perform( multi_handle, &still_running );
                        } while ( Res == CURLM_CALL_MULTI_PERFORM );
                } while ( Res == CURLE_OK and still_running > 0 );

As you can see... I am not doing anything special with proxies. I
either set them, or not. Setting them causes the form data to not be
sent.

OK... well let's say that it is the case. Is there any information
anyone can give me to help me waste less time in debugging this? I
mean... for a start, what function would the bug most likely be in?
Where should I start looking? This bug more often happens in
curl_multi_perform but can happen without any multi stuff. So I guess
the bug can't be in the curl_multi_perform function.

By the way... I'll be debugging using Xcode for Mac OS X. Of course,
if I find the bug, I'll submit the fix.

On 2 Nov 2008, at 12:13, Daniel Stenberg wrote:

> On Sun, 2 Nov 2008, Wei Weng wrote:
>
>> What is the standard that curl uses to bump the version number?
>>
>> (so.1, so.2...so.4)
>
> We bump the 'current' number basically when we remove functions from
> the lib or otherwise break the existing ABI.
>
> This is actually documented here:
>
> http://curl.haxx.se/lxr/source/docs/libcurl/ABI
>
> --
>
> / daniel.haxx.se

--
http://elfdata.com/plugin/
"String processing, done right"
Received on 2008-11-02