Re: libCurl not sending basic authentication in 1 out of 300 systems...
Date: Fri, 28 Nov 2008 22:47:32 -0800
On Fri, Nov 28, 2008 at 05:31:29PM -0800, Paul Bergen wrote:
> I wrote c/c++ software that uses libCurl 7.17.1 and runs on a Linux computer
> for periodically archiving images from Panasonic cameras. It's really simple,
> we just retrieve a given url passing in the username/password for basic
> authentication. I've sold 300 systems, and it has run fine on all of them,
> until now. On one system, which is otherwise identical to the all the others,
> it appears that libCurl is *not* sending the basic authentication username/
> password for no apparent reason. The command line utility works fine, though.
> I even created a sample app with hardcoded values to be 100% sure everything is
> correct. So I'm totally baffled.
My first reaction is to say "upgrade" since we've done lots of bug fixes
in the year since that release, but that may be hard to do while remotely
debugging like you're doing. Still, if you can ssh into the unit and
run the app, you can probably also upload a newer libcurl.so.4 and use
LD_LIBRARY_PATH to point to it while running the app. Since the problem
seems to be very repeatable, that would tell you quickly if it's an already-
solved problem in libcurl. I can't think of any problem in that area that's
been fixed recently, though. This is a pretty simple usage.
> curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
One thing to keep in mind is that you can't pass integers into
curl_easy_setopt, only longs. That line should be
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
and similarly with the others. It doesn't make much of a difference on some
architectures, but might on MIPS.
> I was trying to find a way to get curl and libcurl to report the complete set
> of data on the http socket for debug purposes. But it seems neither the -v on
> the command line or CURLOPT_DEBUGFUNCTION for libCurl show you everything
> because even when it's working from the command line, I can see that nowhere in
> the debug output does it show where curl is sending the username/password for
> authentication. The term 'dceuser' doesn't even appear in the output when I
> run curl -v. So it's not showing me everything that it's sending.
That will show you everything. The username/password for Basic authentication
is sent base64 encoded on the Authorization line, so just decode that to
see the raw username/password. You should be able to tell very quickly
if libcurl is actually sending that line during the failure cases.
Could the problem actually be in the remote server? You know how poor how
embedded software can be :^)
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has movedReceived on 2008-11-29