cURL / Mailing Lists / curl-library / Single Mail

curl-library

info about connection (ip/port)

From: Frank Meier <frank.meier_at_ergon.ch>
Date: Wed, 12 May 2010 12:14:58 +0200

Hi all,

I was asked to modify an application using libcurl, to log the used
src/dest-ip/port combination, after http/https transactions. So I had a
look at the API and I found only the possibility to get the socket with
curl_easy_getinfo CURLINFO_LASTSOCKET. The Problem there is, the socket
is only available if the connection is still up (of course), and If the
connection has been closed at the end of curl_perform (eg.
CURLOPT_FORBID_REUSE is set) the information is lost. So I have to get
the socket while the connection is active, maybe inside a callback...
Does anyone have a different/better idea to achieve this?

Another way I see, would be to include the information to the info, that
could be retrieved by curl_easy_getinfo(). For example
CURLINFO_PRIMARY_IP already exists there, so we would only need the
fields LOCAL_IP, LOCAL_PORT, REMOTE_PORT. The advantage would be the
information stays persistent until the curlHandle is used again. If
there is no other (nice) way way to solve my problem I'd ask if this
addition could be beneficial for other people and if so, I'd write a patch.

cheers, Frank

Frank Meier
Senior Software Engineer

-- 
frank.meier_at_ergon.ch, Phone: +41 44 366 88 35 
Ergon Informatik AG, Ottikerstrasse 59, CH-8006 Zürich 
http://www.ergon.ch 
______________________________________________________________ 
e r g o n smart people - smart software 
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-12