curl-library
Potential issue when using the new PRIMARY_IP metric
Date: Wed, 24 Sep 2008 09:40:13 -0700
I'm attempting to use the new PRIMARY_IP metric that was added in the latest
release, and I seem to have run into a pretty obscure issue I'd like to see
if you guys could help with.
Basically, I use libcurl through perl, using WWW::Curl::Easy. I developed an
app we use here prior the Perl library's support for the multi interface
well, so I ended up creating my own threads to handle simultaneous
downloads. I have two threads, each with their own curl handle,
simultaneously downloading pages/images. The problem I've run into is that
the IP addresses being reported are not accurate. The same IP is reported
for two different domains. The verbose output shows the correct IP when the
items are downloaded, but when I get i get the PRIMARY_IP metric out of the
response, it's something else.
Attached is a perl file that is a stripped down version of my app. It
basically creates two threads, and runs through a list of urls to download
in parallel. If you run it like this:
./test.pl | grep "# "
...you'll see that in a few cases, consistently, it reports the same IP for
multiple domains.
I have a feeling the root causes has more to do with the Perl implementation
of the library then the library itself, but I'm honestly not sure why this
would happen. One interesting thing I discovered though is that if you
comment in line 98, and comment out lines 120-122, the IP address is all of
a sudden reported correctly every time. What happens though is this aborts
the downloads as soon as they start (since the callback is supposed to
return the size of the chunk it receives), so somewhere along the lines the
IP address gets overwritten.
Any help on this would be TREMENDOUSLY appreciated.
Received on 2008-09-24