lör 2009-10-31 klockan 15:32 -0700 skrev nitinnitin18: > I configured squid to use redirector behind another squid proxy of our > institute. > It is working fine when i am using it to redirect it to another constant url > like http://www.google.com/ > what i want to do is to redirect each request url as url+?mail, as the proxy > server allows all connections > of this type. But it is not working with the perl script > > #!/usr/bin/perl > $|=1; > while (<>) { > @X = split; > $url = $X[0]; > print "$url\?mail\n"; > } > > So , i thought that perl might not be working so i wrote an C program for > this > > int main() > { > > char s[200]; > cin>>s; > strcat(s,"\?mail"); > cout<<s<<"\n"; > } These two are not the same. The C++ version has many errors in how it reads and processes the request, some fatal (2 buffer overflows), some just causing malfunction (improper reading & parsing of squid requests). using cin like this is very tricky. Better to read a line at a time and using string instead of char arrays. The following C++ should be equal to your perl: #include <string> #include <iostream> #include <sstream> using namespace std; int main() { string line; while ( getline(cin, line) ) { string url; istringstream split(line); split >> url; cout << url << "?mail\n" << flush; } } Regards Henrik