Julien Philibin wrote:
> On Wed, Apr 29, 2009 at 11:15 PM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
>>> Very interesting Bharath !!!
>>>
>> Yes thank you. You have identified the issue and we can now tell Julien
>> exactly what he has to do.
>>
>>> What would be your advice to get my program working ?!
>>>
>> Use fgets(). The scan() family apparently do not handle EOF in the way
>> needed.
>>
>> Thus to work your code must be:
>>
>>  char line[8196];
>>  char ip[45];
>>  char url[8196];
>>
>>  ip[0] = '\0';
>>  url[0] = '\0';
>>
>>  while( fgets(line, 8196, stdin) != NULL ) {
>>      snscanf(sbuf, 8196, "%s %s" ip, url);
>>      // happy joy ....
>>  }
>>
>> Amos
>>
> 
> Hey that's smart! :)
> 
> I'm going to go for that and if things go wrong, I'll let you know ...
It is slightly wrong. The sbuf there should be 'line'.
I hope your compiler catches that also.
And please do use snscanf instead of scanf. It will save you from many 
security and segfault bugs over your coding time.
> 
> Thank you everyone!
> 
> btw: Amos, any idea why I get a randomly 127.0.0.1 instead of my real
> Ip in the logs ?
> 
As someone said earlier 127.0.0.1 is one of the IPs assigned to your 
machine. It is a special IPv4 address assigned as "localhost". Every 
machine with networking has that same IP for private non-Internet 
traffic use.
Most machines will have two of these; 127.0.0.1 for IPv4 and ::1 for 
IPv6. They are identical in use and purpose for their own IP protocols.
Why you get it randomly I don't know. I expect it to show up 
consistently for requests the OS identifies as local-machine only. And 
never for requests the OS thinks are remote global.
If your testing uses localhost:3128 as the proxy it will connect to 
127.0.0.1 privately. If it uses the public IP or name resolving to the 
public IP it will use a global public connections.
Amos
-- Please be using Current Stable Squid 2.7.STABLE6 or 3.0.STABLE14 Current Beta Squid 3.1.0.7Received on Thu Apr 30 2009 - 11:40:11 MDT
This archive was generated by hypermail 2.2.0 : Thu Apr 30 2009 - 12:00:03 MDT