Re: [squid-users] External C program

From: Bharath Raghavendran <rbharath25_at_gmail.com>
Date: Thu, 30 Apr 2009 10:30:42 +0530

My replies inline ...

2009/4/30 Julien Philibin <julien_at_philibin.fr>:
> On Wed, Apr 29, 2009 at 9:30 PM, Bharath Raghavendran
> <rbharath25_at_gmail.com> wrote:
>> 2009/4/30 Julien Philibin <julien_at_philibin.fr>:
>>> Very interesting Bharath !!!
>>>
>>> What would be your advice to get my program working ?!
>>>
>>> Thanks
>>
>> Unfortunately, I have no advice. I have made external ACLs using C++
>> and know how to handle this using the "cin" stream. With my knowledge
>> of C, the only thing I can think of is using file handling for stdin.
>> I am sure file handling should have ways to detect EOF (I need to
>> search net if you need more details :P )
>>
>
> Could you please show me your skeleton of your C++ Program ? I
> developed mine in C, because I use to develop a lot in C many years
> ago. But I don't mind developing it in C++ as it is not a very
> complicated program (Basically just using the SQL Lib) ...

Here is the code:

#include<iostream>
using namespace std;

int main()
{
    char a[50],b[50];
    cin>>a>>b;
    while(cin)
    {
        // do whatever
        if( condition )
            cout<<"OK\n";
        else
            cout<<"ERR\n";
        cin>>a>>b;
    }
}

You may alternatively use cin.getline(a,49); to get the entire line
into a variable and manually split the different components.

>
>> 127.0.0.1 or "localhost" is a connection to loopback interface which
>> is used to make connections to your own computer. If you have entered
>> the proxy address (assuming you are using squid as a proxy server) as
>> any of these two,
>
> Yes I am using it as proxy server. And it is directly set up in my
> browser's config.
>
>>your computer connects to squid using loopback
>> interface and hence your ip is shown up as 127.0.0.1.
>>
>> You can avoid this by putting your actual IP in the proxy address.
>
> What do you mean ? I checked in my documentation books and I wasn't
> able to find anything about the proxy's address.

I was referring to the proxy address setting in your browser's
configuration (the place where you mention the IP adress and port of
squid). Sorry for being unclear.

>
> And the thing is, it doesn't show up every time with 127.0.0.1, it is
> (apparently) shown as 127.0.0.1 randomly ....

Dunno about this :P

-Bharath
Received on Thu Apr 30 2009 - 05:00:49 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 30 2009 - 12:00:03 MDT