> On Thu, Apr 30, 2009 at 4:40 AM, Amos Jeffries <squid3@xxxxxxxxxxxxx> > wrote: >> Julien Philibin wrote: >>> >>> On Wed, Apr 29, 2009 at 11:15 PM, Amos Jeffries <squid3@xxxxxxxxxxxxx> >>> 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. >> > > Yep I found it out :) > >> And please do use snscanf instead of scanf. It will save you from many >> security and segfault bugs over your coding time. >> > > You are talking about snscanf, but nor "man snscanf" nor google are > showing me revelant stuff about this function ... Am I missing > something ? I am using sscanf instead, for now ... > It's not common. Some compilers don't have it. Exactly the same semantics as sscanf, but lets you limit the length of buffer scanned so no need to nul-terminate the buffer. >>> >>> 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. >> > > I am using the public IP address to access my proxy. I'll try to > remove the 127.0.0.1 from the hosts file and see how things go on ... > > >> >> Amos >> -- >> Please be using >> Current Stable Squid 2.7.STABLE6 or 3.0.STABLE14 >> Current Beta Squid 3.1.0.7 >> > > Thank you everyone again for your time, and sorry for the delay in > getting back to you, I've been doing some researches and making my > hands dirty with my external helpers all week long! > > Julien >