Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-11 Thread Shaine

But i am confuse in this option. Can you please direct me with an example ?

Shaine




Amos Jeffries-2 wrote:
 
 Shaine wrote:
 Hi Henrik,
 
 First of all i would like to thank you again for all valuable
 informations
 provided to me. Those were really help full for my squid integration. But
 unfortunately there is a problem in sqlite. SO i thought its really waste
 of
 hanging with such a data base , switched to Mysql. Now every thing
 working
 fine. 
 
 Now , i want to allow my redirect program only for specific urls to be
 get
 activated. Say for instance i wanted send only google  via that program. 
 
 How can i do that ? if you dont mind can you give me some examples  , or
 some helpful web urls ?
 Can i keep that url in a txt file to be called by url_redirector ACL , if
 it
 is possible , i dont have to touch for squid configuration. 
 
 url_rewriter_access plus a list of ACL which 'permit' certain requests 
 to have their URL re-written.
 
 Amos
 
 
 Many thanks,
 Shaine
 
 
 
 
 
 
 Henrik Nordstrom-5 wrote:
 On ons, 2008-07-09 at 10:04 -0300, Marcus Kool wrote:
 Shaine,

 When a program runs fine from the command line but not from a daemon,
 the cause is usually the change of environment: PATH or other
 environment variable, user ID
 Remember that squid is started with a very clean environment.

 I suggest to run the redirect program from at:
 # su - squid
 $ at now
 echo input line | redirector  /tmp/log

 Better make that

 ( echo input line ; echo another input line ; echo yet another
 input line ) | redirector

 Redirecting the output is optional. at delivers it in an email
 otherwise.

 should return the correct result for all three lines.


 Regards
 Henrik

  

 
 
 
 -- 
 Please use Squid 2.7.STABLE3 or 3.0.STABLE7
 
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18397449.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-11 Thread Shaine

Hi 

ACL for url_director done. Now that also functioning properly. But I want to
ask some thing.

for instance , www.google.com , I have not defined in url_redirector ACL.
when we access google , cant we forward it directly to the web without going
to url_redirect program ?

Thank you
Shaine.




Amos Jeffries-2 wrote:
 
 Shaine wrote:
 Hi Henrik,
 
 First of all i would like to thank you again for all valuable
 informations
 provided to me. Those were really help full for my squid integration. But
 unfortunately there is a problem in sqlite. SO i thought its really waste
 of
 hanging with such a data base , switched to Mysql. Now every thing
 working
 fine. 
 
 Now , i want to allow my redirect program only for specific urls to be
 get
 activated. Say for instance i wanted send only google  via that program. 
 
 How can i do that ? if you dont mind can you give me some examples  , or
 some helpful web urls ?
 Can i keep that url in a txt file to be called by url_redirector ACL , if
 it
 is possible , i dont have to touch for squid configuration. 
 
 url_rewriter_access plus a list of ACL which 'permit' certain requests 
 to have their URL re-written.
 
 Amos
 
 
 Many thanks,
 Shaine
 
 
 
 
 
 
 Henrik Nordstrom-5 wrote:
 On ons, 2008-07-09 at 10:04 -0300, Marcus Kool wrote:
 Shaine,

 When a program runs fine from the command line but not from a daemon,
 the cause is usually the change of environment: PATH or other
 environment variable, user ID
 Remember that squid is started with a very clean environment.

 I suggest to run the redirect program from at:
 # su - squid
 $ at now
 echo input line | redirector  /tmp/log

 Better make that

 ( echo input line ; echo another input line ; echo yet another
 input line ) | redirector

 Redirecting the output is optional. at delivers it in an email
 otherwise.

 should return the correct result for all three lines.


 Regards
 Henrik

  

 
 
 
 -- 
 Please use Squid 2.7.STABLE3 or 3.0.STABLE7
 
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18399812.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-11 Thread Amos Jeffries

Shaine wrote:

But i am confuse in this option. Can you please direct me with an example ?

Shaine


acl yes dstdomain .site1.com
acl no dstdomain .site2.com

url_rewrite_access yes
url_rewrite_access !no






Amos Jeffries-2 wrote:

Shaine wrote:

Hi Henrik,

First of all i would like to thank you again for all valuable
informations
provided to me. Those were really help full for my squid integration. But
unfortunately there is a problem in sqlite. SO i thought its really waste
of
hanging with such a data base , switched to Mysql. Now every thing
working
fine. 


Now , i want to allow my redirect program only for specific urls to be
get
activated. Say for instance i wanted send only google  via that program. 


How can i do that ? if you dont mind can you give me some examples  , or
some helpful web urls ?
Can i keep that url in a txt file to be called by url_redirector ACL , if
it
is possible , i dont have to touch for squid configuration. 
url_rewriter_access plus a list of ACL which 'permit' certain requests 
to have their URL re-written.


Amos


Many thanks,
Shaine






Henrik Nordstrom-5 wrote:

On ons, 2008-07-09 at 10:04 -0300, Marcus Kool wrote:

Shaine,

When a program runs fine from the command line but not from a daemon,
the cause is usually the change of environment: PATH or other
environment variable, user ID
Remember that squid is started with a very clean environment.

I suggest to run the redirect program from at:
# su - squid
$ at now
echo input line | redirector  /tmp/log

Better make that

( echo input line ; echo another input line ; echo yet another
input line ) | redirector

Redirecting the output is optional. at delivers it in an email
otherwise.

should return the correct result for all three lines.


Regards
Henrik

 



--
Please use Squid 2.7.STABLE3 or 3.0.STABLE7







--
Please use Squid 2.7.STABLE3 or 3.0.STABLE7


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-10 Thread Amos Jeffries

Shaine wrote:

Hi Henrik,

First of all i would like to thank you again for all valuable informations
provided to me. Those were really help full for my squid integration. But
unfortunately there is a problem in sqlite. SO i thought its really waste of
hanging with such a data base , switched to Mysql. Now every thing working
fine. 


Now , i want to allow my redirect program only for specific urls to be get
activated. Say for instance i wanted send only google  via that program. 


How can i do that ? if you dont mind can you give me some examples  , or
some helpful web urls ?
Can i keep that url in a txt file to be called by url_redirector ACL , if it
is possible , i dont have to touch for squid configuration. 


url_rewriter_access plus a list of ACL which 'permit' certain requests 
to have their URL re-written.


Amos



Many thanks,
Shaine






Henrik Nordstrom-5 wrote:

On ons, 2008-07-09 at 10:04 -0300, Marcus Kool wrote:

Shaine,

When a program runs fine from the command line but not from a daemon,
the cause is usually the change of environment: PATH or other
environment variable, user ID
Remember that squid is started with a very clean environment.

I suggest to run the redirect program from at:
# su - squid
$ at now
echo input line | redirector  /tmp/log


Better make that

( echo input line ; echo another input line ; echo yet another
input line ) | redirector

Redirecting the output is optional. at delivers it in an email
otherwise.

should return the correct result for all three lines.


Regards
Henrik

 






--
Please use Squid 2.7.STABLE3 or 3.0.STABLE7


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Shaine

Hi Henrik,

Thanks for all valuable informations. Those are really help full for me.
Actually in my squid.conf i got enabled url_rewrite_concurrency. As u said
that is why it shifted another step ahead. Now its disabled , took its own
place. second position. I wrote a perl script to handle a sqlite db and
capture some value according to STDIN. 

Its working fine in command line, i tested and it works as i expected. But
when i placed in url_rewrite_program in squid, unfortunately squid get PANIC
and its crashed.

2008/07/09 17:14:34| WARNING: redirector #3 (FD 8) exited
2008/07/09 17:14:34| WARNING: redirector #2 (FD 7) exited
2008/07/09 17:14:34| WARNING: redirector #5 (FD 10) exited
2008/07/09 17:14:34| WARNING: redirector #1 (FD 6) exited
2008/07/09 17:14:34| WARNING: redirector #6 (FD 11) exited
2008/07/09 17:14:34| WARNING: redirector #4 (FD 9) exited
2008/07/09 17:14:34| Too few redirector processes are running
FATAL: The redirector helpers are crashing too rapidly, need help!

Here with i have attached my Perl code also .

#!/usr/bin/perl
use DBI;
use strict;
use warnings;
#
## no buffered output, auto flush
$|=1;

my ($dbh,$sth,$dbargs,$IntValue,$query,$url);

$dbargs = {AutoCommit = 0, PrintError = 1};
$dbh = DBI-connect(dbi:SQLite:dbname=List,,,$dbargs);

if ($dbh-err()) {
   print;
   exit;
}

while (STDIN) {
   chomp;
   my ($url, $ip) = split(/ /);
   $query = SELECT * from ACCOUNTING where IPAddress = '. $ip .' order by
DATETIME desc;
   $sth = $dbh-prepare($query);
   $sth-execute();

   if (my $ref = $sth-fetchrow_hashref()) {
   $IntValue = $ref-{'CalliId'};
   #if ($IntValue == undef) {
#   $IntValue = NA;
  # }
   }else{
   $IntValue = NA;
   }

   if (!($url =~ m#VALUE#)) {
   if ($url =~ m#\?#) {
  $url .= (VALUE= . $IntValue);
   } else {
  $url .= (?VALUE= . $IntValue);
   }
   print $url.\n;
   } else {
   print \n;
   }
}
   $sth-finish();
   undef $sth;
   $dbh-commit();
   $dbh-disconnect();


Why , its getting FALAL error when placed in squid? what is wrong with the
script ? Can you help me please ?

Many Thanks
Shaine.

 



Henrik Nordstrom-5 wrote:
 
 On mån, 2008-07-07 at 05:49 -0700, Shaine wrote:
 I did same way . but client ip doesn't comes in the second possition. Its
 in
 third.
 
 It's the second..
 
 http://www.squid-cache.org/ 127.0.0.1/localhost.localdomain - GET -
 myip=127.0.0.1 myport=3128
 
 unless you have enabled url_rewrite_concurrency in which case all
 parameters is shifted one step due to the added request identifier
 infront... but then url is the second..
 
 0 http://www.squid-cache.org/ 127.0.0.1/localhost.localdomain - GET -
 myip=127.0.0.1 myport=3128
 
 Regards
 Henrik
 
  
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18355096.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Henrik Nordstrom
On tis, 2008-07-08 at 23:12 -0700, Shaine wrote:

 Its working fine in command line, i tested and it works as i expected. But
 when i placed in url_rewrite_program in squid, unfortunately squid get PANIC
 and its crashed.
 
 2008/07/09 17:14:34| WARNING: redirector #3 (FD 8) exited
 2008/07/09 17:14:34| WARNING: redirector #2 (FD 7) exited

Anything before this?


 Why , its getting FALAL error when placed in squid? what is wrong with the
 script ? Can you help me please ?

For some reason your script exits before STDIN is closed by Squid... The
question is why.

Regards
Henrik


signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Shaine



Following are rest of logs which comes in the log.

2008/07/09 22:49:27| Starting Squid Cache version 3.0.STABLE6 for
i686-pc-linux-gnu...
2008/07/09 22:49:27| Process ID 26309
2008/07/09 22:49:27| With 1024 file descriptors available
2008/07/09 22:49:27| Performing DNS Tests...
2008/07/09 22:49:27| Successful DNS name lookup tests...
2008/07/09 22:49:27| DNS Socket created at 0.0.0.0, port 39752, FD 5
2008/07/09 22:49:27| Adding nameserver 192.168.4.3 from /etc/resolv.conf
2008/07/09 22:49:27| Adding nameserver 202.69.192.2 from /etc/resolv.conf
2008/07/09 22:49:27| helperOpenServers: Starting 10 'xxx.pl' processes
2008/07/09 22:49:28| Unlinkd pipe opened on FD 20
2008/07/09 22:49:28| Swap maxSize 102400 KB, estimated 7876 objects
2008/07/09 22:49:28| Target number of buckets: 393
2008/07/09 22:49:28| Using 8192 Store buckets
2008/07/09 22:49:28| Max Mem  size: 8192 KB
2008/07/09 22:49:28| Max Swap size: 102400 KB
2008/07/09 22:49:28| Version 1 of swap file with LFS support detected...
2008/07/09 22:49:28| Rebuilding storage in /usr/local/squid/var/cache
(DIRTY)
2008/07/09 22:49:28| Using Least Load store dir selection
2008/07/09 22:49:28| Set Current Directory to /usr/local/squid/var/cache
2008/07/09 22:49:28| Loaded Icons.
2008/07/09 22:49:28| Accepting  HTTP connections at 0.0.0.0, port 8080, FD
22.
2008/07/09 22:49:28| Accepting ICP messages at 0.0.0.0, port 3130, FD 23.
2008/07/09 22:49:28| HTCP Disabled.
2008/07/09 22:49:28| Ready to serve requests.

Thank you
Shaine.





Henrik Nordstrom-5 wrote:
 
 On tis, 2008-07-08 at 23:12 -0700, Shaine wrote:
 
 Its working fine in command line, i tested and it works as i expected.
 But
 when i placed in url_rewrite_program in squid, unfortunately squid get
 PANIC
 and its crashed.
 
 2008/07/09 17:14:34| WARNING: redirector #3 (FD 8) exited
 2008/07/09 17:14:34| WARNING: redirector #2 (FD 7) exited
 
 Anything before this?
 
 
 Why , its getting FALAL error when placed in squid? what is wrong with
 the
 script ? Can you help me please ?
 
 For some reason your script exits before STDIN is closed by Squid... The
 question is why.
 
 Regards
 Henrik
 
  
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18359427.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Shaine

one thing i couldn't mention in the mail. my redirect program located in
/usr/local/squid/bin/xxx.pl.

And i have given permission for user squid.

chown -R squid:squid /usr/local/squid

In my squid.conf 

cache_effective_user squid
cache_effective_group squid

But slite Database lacated in a defferent location. /home/user/db.sqlite. I
have given the root permision for the database.

is this wrong? 

Thank you
Shaine. 




Shaine wrote:
 
 
 
 Following are rest of logs which comes in the log.
 
 2008/07/09 22:49:27| Starting Squid Cache version 3.0.STABLE6 for
 i686-pc-linux-gnu...
 2008/07/09 22:49:27| Process ID 26309
 2008/07/09 22:49:27| With 1024 file descriptors available
 2008/07/09 22:49:27| Performing DNS Tests...
 2008/07/09 22:49:27| Successful DNS name lookup tests...
 2008/07/09 22:49:27| DNS Socket created at 0.0.0.0, port 39752, FD 5
 2008/07/09 22:49:27| Adding nameserver 192.168.4.3 from /etc/resolv.conf
 2008/07/09 22:49:27| Adding nameserver 202.69.192.2 from /etc/resolv.conf
 2008/07/09 22:49:27| helperOpenServers: Starting 10 'xxx.pl' processes
 2008/07/09 22:49:28| Unlinkd pipe opened on FD 20
 2008/07/09 22:49:28| Swap maxSize 102400 KB, estimated 7876 objects
 2008/07/09 22:49:28| Target number of buckets: 393
 2008/07/09 22:49:28| Using 8192 Store buckets
 2008/07/09 22:49:28| Max Mem  size: 8192 KB
 2008/07/09 22:49:28| Max Swap size: 102400 KB
 2008/07/09 22:49:28| Version 1 of swap file with LFS support detected...
 2008/07/09 22:49:28| Rebuilding storage in /usr/local/squid/var/cache
 (DIRTY)
 2008/07/09 22:49:28| Using Least Load store dir selection
 2008/07/09 22:49:28| Set Current Directory to /usr/local/squid/var/cache
 2008/07/09 22:49:28| Loaded Icons.
 2008/07/09 22:49:28| Accepting  HTTP connections at 0.0.0.0, port 8080, FD
 22.
 2008/07/09 22:49:28| Accepting ICP messages at 0.0.0.0, port 3130, FD 23.
 2008/07/09 22:49:28| HTCP Disabled.
 2008/07/09 22:49:28| Ready to serve requests.
 
 Thank you
 Shaine.
 
 
 
 
 
 Henrik Nordstrom-5 wrote:
 
 On tis, 2008-07-08 at 23:12 -0700, Shaine wrote:
 
 Its working fine in command line, i tested and it works as i expected.
 But
 when i placed in url_rewrite_program in squid, unfortunately squid get
 PANIC
 and its crashed.
 
 2008/07/09 17:14:34| WARNING: redirector #3 (FD 8) exited
 2008/07/09 17:14:34| WARNING: redirector #2 (FD 7) exited
 
 Anything before this?
 
 
 Why , its getting FALAL error when placed in squid? what is wrong with
 the
 script ? Can you help me please ?
 
 For some reason your script exits before STDIN is closed by Squid... The
 question is why.
 
 Regards
 Henrik
 
  
 
 
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18359442.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Shaine

Is there any thing difference of general perl development and develop
url_redirect program from perl for squid ? do we have to use different API ?

Shaine.




Shaine wrote:
 
 one thing i couldn't mention in the mail. my redirect program located in
 /usr/local/squid/bin/xxx.pl.
 
 And i have given permission for user squid.
 
 chown -R squid:squid /usr/local/squid
 
 In my squid.conf 
 
 cache_effective_user squid
 cache_effective_group squid
 
 But slite Database lacated in a defferent location. /home/user/db.sqlite.
 I have given the root permision for the database.
 
 is this wrong? 
 
 Thank you
 Shaine. 
 
 
 
 
 Shaine wrote:
 
 
 
 Following are rest of logs which comes in the log.
 
 2008/07/09 22:49:27| Starting Squid Cache version 3.0.STABLE6 for
 i686-pc-linux-gnu...
 2008/07/09 22:49:27| Process ID 26309
 2008/07/09 22:49:27| With 1024 file descriptors available
 2008/07/09 22:49:27| Performing DNS Tests...
 2008/07/09 22:49:27| Successful DNS name lookup tests...
 2008/07/09 22:49:27| DNS Socket created at 0.0.0.0, port 39752, FD 5
 2008/07/09 22:49:27| Adding nameserver 192.168.4.3 from /etc/resolv.conf
 2008/07/09 22:49:27| Adding nameserver 202.69.192.2 from /etc/resolv.conf
 2008/07/09 22:49:27| helperOpenServers: Starting 10 'xxx.pl' processes
 2008/07/09 22:49:28| Unlinkd pipe opened on FD 20
 2008/07/09 22:49:28| Swap maxSize 102400 KB, estimated 7876 objects
 2008/07/09 22:49:28| Target number of buckets: 393
 2008/07/09 22:49:28| Using 8192 Store buckets
 2008/07/09 22:49:28| Max Mem  size: 8192 KB
 2008/07/09 22:49:28| Max Swap size: 102400 KB
 2008/07/09 22:49:28| Version 1 of swap file with LFS support detected...
 2008/07/09 22:49:28| Rebuilding storage in /usr/local/squid/var/cache
 (DIRTY)
 2008/07/09 22:49:28| Using Least Load store dir selection
 2008/07/09 22:49:28| Set Current Directory to /usr/local/squid/var/cache
 2008/07/09 22:49:28| Loaded Icons.
 2008/07/09 22:49:28| Accepting  HTTP connections at 0.0.0.0, port 8080,
 FD 22.
 2008/07/09 22:49:28| Accepting ICP messages at 0.0.0.0, port 3130, FD 23.
 2008/07/09 22:49:28| HTCP Disabled.
 2008/07/09 22:49:28| Ready to serve requests.
 
 Thank you
 Shaine.
 
 
 
 
 
 Henrik Nordstrom-5 wrote:
 
 On tis, 2008-07-08 at 23:12 -0700, Shaine wrote:
 
 Its working fine in command line, i tested and it works as i expected.
 But
 when i placed in url_rewrite_program in squid, unfortunately squid get
 PANIC
 and its crashed.
 
 2008/07/09 17:14:34| WARNING: redirector #3 (FD 8) exited
 2008/07/09 17:14:34| WARNING: redirector #2 (FD 7) exited
 
 Anything before this?
 
 
 Why , its getting FALAL error when placed in squid? what is wrong with
 the
 script ? Can you help me please ?
 
 For some reason your script exits before STDIN is closed by Squid... The
 question is why.
 
 Regards
 Henrik
 
  
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18359967.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Shaine

one thing i couldn't mention in the mail. my redirect program located in
/usr/local/squid/bin/xxx.pl.

And i have given permission for user squid.

chown -R squid:squid /usr/local/squid

In my squid.conf

cache_effective_user squid
cache_effective_group squid

But slite Database lacated in a defferent location. /home/user/db.sqlite. I
have given the root permision for the database.

is this wrong?

Thank you
Shaine. 




Shaine wrote:
 
 one thing i couldn't mention in the mail. my redirect program located in
 /usr/local/squid/bin/xxx.pl.
 
 And i have given permission for user squid.
 
 chown -R squid:squid /usr/local/squid
 
 In my squid.conf 
 
 cache_effective_user squid
 cache_effective_group squid
 
 But slite Database lacated in a defferent location. /home/user/db.sqlite.
 I have given the root permision for the database.
 
 is this wrong? 
 
 Thank you
 Shaine. 
 
 
 
 
 Shaine wrote:
 
 
 
 Following are rest of logs which comes in the log.
 
 2008/07/09 22:49:27| Starting Squid Cache version 3.0.STABLE6 for
 i686-pc-linux-gnu...
 2008/07/09 22:49:27| Process ID 26309
 2008/07/09 22:49:27| With 1024 file descriptors available
 2008/07/09 22:49:27| Performing DNS Tests...
 2008/07/09 22:49:27| Successful DNS name lookup tests...
 2008/07/09 22:49:27| DNS Socket created at 0.0.0.0, port 39752, FD 5
 2008/07/09 22:49:27| Adding nameserver 192.168.4.3 from /etc/resolv.conf
 2008/07/09 22:49:27| Adding nameserver 202.69.192.2 from /etc/resolv.conf
 2008/07/09 22:49:27| helperOpenServers: Starting 10 'xxx.pl' processes
 2008/07/09 22:49:28| Unlinkd pipe opened on FD 20
 2008/07/09 22:49:28| Swap maxSize 102400 KB, estimated 7876 objects
 2008/07/09 22:49:28| Target number of buckets: 393
 2008/07/09 22:49:28| Using 8192 Store buckets
 2008/07/09 22:49:28| Max Mem  size: 8192 KB
 2008/07/09 22:49:28| Max Swap size: 102400 KB
 2008/07/09 22:49:28| Version 1 of swap file with LFS support detected...
 2008/07/09 22:49:28| Rebuilding storage in /usr/local/squid/var/cache
 (DIRTY)
 2008/07/09 22:49:28| Using Least Load store dir selection
 2008/07/09 22:49:28| Set Current Directory to /usr/local/squid/var/cache
 2008/07/09 22:49:28| Loaded Icons.
 2008/07/09 22:49:28| Accepting  HTTP connections at 0.0.0.0, port 8080,
 FD 22.
 2008/07/09 22:49:28| Accepting ICP messages at 0.0.0.0, port 3130, FD 23.
 2008/07/09 22:49:28| HTCP Disabled.
 2008/07/09 22:49:28| Ready to serve requests.
 
 Thank you
 Shaine.
 
 
 
 
 
 Henrik Nordstrom-5 wrote:
 
 On tis, 2008-07-08 at 23:12 -0700, Shaine wrote:
 
 Its working fine in command line, i tested and it works as i expected.
 But
 when i placed in url_rewrite_program in squid, unfortunately squid get
 PANIC
 and its crashed.
 
 2008/07/09 17:14:34| WARNING: redirector #3 (FD 8) exited
 2008/07/09 17:14:34| WARNING: redirector #2 (FD 7) exited
 
 Anything before this?
 
 
 Why , its getting FALAL error when placed in squid? what is wrong with
 the
 script ? Can you help me please ?
 
 For some reason your script exits before STDIN is closed by Squid... The
 question is why.
 
 Regards
 Henrik
 
  
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18360037.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Amos Jeffries

Shaine wrote:

one thing i couldn't mention in the mail. my redirect program located in
/usr/local/squid/bin/xxx.pl.

And i have given permission for user squid.

chown -R squid:squid /usr/local/squid

In my squid.conf 


cache_effective_user squid
cache_effective_group squid


Um, It's better to configure only the user in squid (and only then if 
you have to), and leave the group config to your OS settings. That makes 
things like permission debugging easier and more secure in the long run.




But slite Database lacated in a defferent location. /home/user/db.sqlite. I
have given the root permision for the database.

is this wrong? 


Maybe yes, maybe no.

Login as the 'squid' user and see if it has permissions to run the 
helper properly.
Also while you are logged in there, check that the user is a member of 
exactly one group same as your squid.conf settings.


I suspect its the DB connect and abort which is killing things early.
If it is, you should see the errors when your script is run to debug as 
the squid user.


Amos



Thank you
Shaine. 





Shaine wrote:



Following are rest of logs which comes in the log.

2008/07/09 22:49:27| Starting Squid Cache version 3.0.STABLE6 for
i686-pc-linux-gnu...
2008/07/09 22:49:27| Process ID 26309
2008/07/09 22:49:27| With 1024 file descriptors available
2008/07/09 22:49:27| Performing DNS Tests...
2008/07/09 22:49:27| Successful DNS name lookup tests...
2008/07/09 22:49:27| DNS Socket created at 0.0.0.0, port 39752, FD 5
2008/07/09 22:49:27| Adding nameserver 192.168.4.3 from /etc/resolv.conf
2008/07/09 22:49:27| Adding nameserver 202.69.192.2 from /etc/resolv.conf
2008/07/09 22:49:27| helperOpenServers: Starting 10 'xxx.pl' processes
2008/07/09 22:49:28| Unlinkd pipe opened on FD 20
2008/07/09 22:49:28| Swap maxSize 102400 KB, estimated 7876 objects
2008/07/09 22:49:28| Target number of buckets: 393
2008/07/09 22:49:28| Using 8192 Store buckets
2008/07/09 22:49:28| Max Mem  size: 8192 KB
2008/07/09 22:49:28| Max Swap size: 102400 KB
2008/07/09 22:49:28| Version 1 of swap file with LFS support detected...
2008/07/09 22:49:28| Rebuilding storage in /usr/local/squid/var/cache
(DIRTY)
2008/07/09 22:49:28| Using Least Load store dir selection
2008/07/09 22:49:28| Set Current Directory to /usr/local/squid/var/cache
2008/07/09 22:49:28| Loaded Icons.
2008/07/09 22:49:28| Accepting  HTTP connections at 0.0.0.0, port 8080, FD
22.
2008/07/09 22:49:28| Accepting ICP messages at 0.0.0.0, port 3130, FD 23.
2008/07/09 22:49:28| HTCP Disabled.
2008/07/09 22:49:28| Ready to serve requests.

Thank you
Shaine.





Henrik Nordstrom-5 wrote:

On tis, 2008-07-08 at 23:12 -0700, Shaine wrote:


Its working fine in command line, i tested and it works as i expected.
But
when i placed in url_rewrite_program in squid, unfortunately squid get
PANIC
and its crashed.

2008/07/09 17:14:34| WARNING: redirector #3 (FD 8) exited
2008/07/09 17:14:34| WARNING: redirector #2 (FD 7) exited

Anything before this?



Why , its getting FALAL error when placed in squid? what is wrong with
the
script ? Can you help me please ?

For some reason your script exits before STDIN is closed by Squid... The
question is why.

Regards
Henrik

 








--
Please use Squid 2.7.STABLE3 or 3.0.STABLE7


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Marcus Kool

Shaine,

When a program runs fine from the command line but not from a daemon,
the cause is usually the change of environment: PATH or other
environment variable, user ID
Remember that squid is started with a very clean environment.

I suggest to run the redirect program from at:
# su - squid
$ at now
echo input line | redirector  /tmp/log

If the redirector runs fine from at, it should run from Squid.
(my _guess_ is that the database connection fails).

-Marcus


Shaine wrote:

one thing i couldn't mention in the mail. my redirect program located in
/usr/local/squid/bin/xxx.pl.

And i have given permission for user squid.

chown -R squid:squid /usr/local/squid

In my squid.conf 


cache_effective_user squid
cache_effective_group squid

But slite Database lacated in a defferent location. /home/user/db.sqlite. I
have given the root permision for the database.

is this wrong? 


Thank you
Shaine. 





Shaine wrote:



Following are rest of logs which comes in the log.

2008/07/09 22:49:27| Starting Squid Cache version 3.0.STABLE6 for
i686-pc-linux-gnu...
2008/07/09 22:49:27| Process ID 26309
2008/07/09 22:49:27| With 1024 file descriptors available
2008/07/09 22:49:27| Performing DNS Tests...
2008/07/09 22:49:27| Successful DNS name lookup tests...
2008/07/09 22:49:27| DNS Socket created at 0.0.0.0, port 39752, FD 5
2008/07/09 22:49:27| Adding nameserver 192.168.4.3 from /etc/resolv.conf
2008/07/09 22:49:27| Adding nameserver 202.69.192.2 from /etc/resolv.conf
2008/07/09 22:49:27| helperOpenServers: Starting 10 'xxx.pl' processes
2008/07/09 22:49:28| Unlinkd pipe opened on FD 20
2008/07/09 22:49:28| Swap maxSize 102400 KB, estimated 7876 objects
2008/07/09 22:49:28| Target number of buckets: 393
2008/07/09 22:49:28| Using 8192 Store buckets
2008/07/09 22:49:28| Max Mem  size: 8192 KB
2008/07/09 22:49:28| Max Swap size: 102400 KB
2008/07/09 22:49:28| Version 1 of swap file with LFS support detected...
2008/07/09 22:49:28| Rebuilding storage in /usr/local/squid/var/cache
(DIRTY)
2008/07/09 22:49:28| Using Least Load store dir selection
2008/07/09 22:49:28| Set Current Directory to /usr/local/squid/var/cache
2008/07/09 22:49:28| Loaded Icons.
2008/07/09 22:49:28| Accepting  HTTP connections at 0.0.0.0, port 8080, FD
22.
2008/07/09 22:49:28| Accepting ICP messages at 0.0.0.0, port 3130, FD 23.
2008/07/09 22:49:28| HTCP Disabled.
2008/07/09 22:49:28| Ready to serve requests.

Thank you
Shaine.





Henrik Nordstrom-5 wrote:

On tis, 2008-07-08 at 23:12 -0700, Shaine wrote:


Its working fine in command line, i tested and it works as i expected.
But
when i placed in url_rewrite_program in squid, unfortunately squid get
PANIC
and its crashed.

2008/07/09 17:14:34| WARNING: redirector #3 (FD 8) exited
2008/07/09 17:14:34| WARNING: redirector #2 (FD 7) exited

Anything before this?



Why , its getting FALAL error when placed in squid? what is wrong with
the
script ? Can you help me please ?

For some reason your script exits before STDIN is closed by Squid... The
question is why.

Regards
Henrik

 







Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Henrik Nordstrom
On ons, 2008-07-09 at 04:43 -0700, Shaine wrote:
 
 
 Following are rest of logs which comes in the log.

The interesting part is before the error, not after...

from where the helpers is started, to where Squid complains that it
exited.

Regards
Henrik


signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Henrik Nordstrom
On ons, 2008-07-09 at 05:02 -0700, Shaine wrote:
 one thing i couldn't mention in the mail. my redirect program located in
 /usr/local/squid/bin/xxx.pl.
 
 And i have given permission for user squid.
 
 chown -R squid:squid /usr/local/squid
 
 In my squid.conf 
 
 cache_effective_user squid
 cache_effective_group squid
 
 But slite Database lacated in a defferent location. /home/user/db.sqlite. I
 have given the root permision for the database.

Your cache_effective_user need permission to access the database.

Always test helpers using the cache_effective_user account, not root.

Regards
Henrik


signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Henrik Nordstrom
On ons, 2008-07-09 at 05:28 -0700, Shaine wrote:
 Is there any thing difference of general perl development and develop
 url_redirect program from perl for squid ? do we have to use different API ?

No, no significant difference. The differences are:

  - stdin/stdout is a pipe, not a terminal. Hence the need for $|=1;

  - It's running as you cache_effective_user account, not whatever
account you are using for development.. (and not root, ever)

Regards
Henrik


signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-09 Thread Henrik Nordstrom
On ons, 2008-07-09 at 10:04 -0300, Marcus Kool wrote:
 Shaine,
 
 When a program runs fine from the command line but not from a daemon,
 the cause is usually the change of environment: PATH or other
 environment variable, user ID
 Remember that squid is started with a very clean environment.
 
 I suggest to run the redirect program from at:
 # su - squid
 $ at now
 echo input line | redirector  /tmp/log


Better make that

( echo input line ; echo another input line ; echo yet another
input line ) | redirector

Redirecting the output is optional. at delivers it in an email
otherwise.

should return the correct result for all three lines.


Regards
Henrik


signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-07 Thread Henrik Nordstrom
On sön, 2008-07-06 at 22:05 -0700, Shaine wrote:

 Following is my script.
 
 #!/usr/bin/perl
 # no buffered output, auto flush
 use strict;
 use warnings;
 
 my ($temp, $array, @array, $param_1, $param_2, $param_3, $new_uri);
 
 $|=1;
 $temp = ;
 
 
 while (STDIN){
   [EMAIL PROTECTED] = split(/ /);
   ($param_1, $param_2, $param_3) = split(/ /);
   #if (!($array[1] =~ m#VALUE-X#)) {
   if (!($param_2 =~ m#VALUE-X#)) {
 $temp = $param_2;
 if ($param_2 =~ m#\?#) {
   $temp .= VALUE-X=652224848;
 }else {
   $temp .= ?VALUE-X=652224848;
 }
 $new_uri = ($param_1 .   . $temp .   . $param_3);
 s#$param_2#$temp#;
 #print $new_uri;
 print;
   }else {
 print;
   }
 }


If I understand the above correct you modify the second parameter sent
to the script which is the requesting client ip...

The URL is the first, and the only one used by Squid in responses.

Here is a simplified version of that script which should work better I
think (completely untested)

### BEGIN ###
#!/usr/bin/perl
use strict;
use warnings;

# no buffered output, auto flush
$|=1;
while (STDIN) {
  chomp;
  my ($url) = split(/ /);
  if (!($url =~ m#VALUE-X#)) {
if ($url =~ m#\?#) {
   $url .= VALUE-X=652224848;
} else {
   $url .= ?VALUE-X=652224848;
}
print $url.\n;
  } else {
print \n;
  }
}
### END ###

The chomp isn't stricly needed, but makes testing from command line
easier as it's sufficient to then enter just the URL for proper results
and not a complete url rewriter request.

Regards
Henrik


signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-07 Thread Shaine

Thank you Henrik. yes that script is very simple and now and its working. But
i have another requirement to capture Client IP which comes via the URL .
Its bit confuse at this time coz i had different idea .So now can u direct
me to how to capture client ip by that perl script which you have posted.

Thank you
Shaine.




Henrik Nordstrom-5 wrote:
 
 On sön, 2008-07-06 at 22:05 -0700, Shaine wrote:
 
 Following is my script.
 
 #!/usr/bin/perl
 # no buffered output, auto flush
 use strict;
 use warnings;
 
 my ($temp, $array, @array, $param_1, $param_2, $param_3, $new_uri);
 
 $|=1;
 $temp = ;
 
 
 while (STDIN){
   [EMAIL PROTECTED] = split(/ /);
   ($param_1, $param_2, $param_3) = split(/ /);
   #if (!($array[1] =~ m#VALUE-X#)) {
   if (!($param_2 =~ m#VALUE-X#)) {
 $temp = $param_2;
 if ($param_2 =~ m#\?#) {
   $temp .= VALUE-X=652224848;
 }else {
   $temp .= ?VALUE-X=652224848;
 }
 $new_uri = ($param_1 .   . $temp .   . $param_3);
 s#$param_2#$temp#;
 #print $new_uri;
 print;
   }else {
 print;
   }
 }
 
 
 If I understand the above correct you modify the second parameter sent
 to the script which is the requesting client ip...
 
 The URL is the first, and the only one used by Squid in responses.
 
 Here is a simplified version of that script which should work better I
 think (completely untested)
 
 ### BEGIN ###
 #!/usr/bin/perl
 use strict;
 use warnings;
 
 # no buffered output, auto flush
 $|=1;
 while (STDIN) {
   chomp;
   my ($url) = split(/ /);
   if (!($url =~ m#VALUE-X#)) {
 if ($url =~ m#\?#) {
$url .= VALUE-X=652224848;
 } else {
$url .= ?VALUE-X=652224848;
 }
 print $url.\n;
   } else {
 print \n;
   }
 }
 ### END ###
 
 The chomp isn't stricly needed, but makes testing from command line
 easier as it's sufficient to then enter just the URL for proper results
 and not a complete url rewriter request.
 
 Regards
 Henrik
 
  
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18312476.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-07 Thread Henrik Nordstrom
On mån, 2008-07-07 at 10:03 +, Shain Lee wrote:
 Thank you Henrik. yes that script is very simple and now and its
 working. But i have another requirement to capture Client IP which
 comes via the URL . Its bit confuse at this time coz i had different
 idea .So now can direct me to how to capture client ip by that perl
 script which you have posted.

change the split line to 

my ($url, $ip) = split(/ /);

Then use $ip as you like in the script..

Regards
Henrik



signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-07 Thread Shaine

I did same way . but client ip doesn't comes in the second possition. Its in
third.

my ($url, $x, $ip) = split(/ /);

but in squid guide says it shoudl be in second element. why is this
confusion ? URL ip-address/fqdn ident method.

If that thrid possition will not constant all will goes off. i meant our
logic will not work any more. 

Regards
Shaine




Henrik Nordstrom-5 wrote:
 
 On mån, 2008-07-07 at 10:03 +, Shain Lee wrote:
 Thank you Henrik. yes that script is very simple and now and its
 working. But i have another requirement to capture Client IP which
 comes via the URL . Its bit confuse at this time coz i had different
 idea .So now can direct me to how to capture client ip by that perl
 script which you have posted.
 
 change the split line to 
 
 my ($url, $ip) = split(/ /);
 
 Then use $ip as you like in the script..
 
 Regards
 Henrik
 
 
  
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18315957.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-07 Thread Henrik Nordstrom
On mån, 2008-07-07 at 05:49 -0700, Shaine wrote:
 I did same way . but client ip doesn't comes in the second possition. Its in
 third.

It's the second..

http://www.squid-cache.org/ 127.0.0.1/localhost.localdomain - GET - 
myip=127.0.0.1 myport=3128

unless you have enabled url_rewrite_concurrency in which case all
parameters is shifted one step due to the added request identifier
infront... but then url is the second..

0 http://www.squid-cache.org/ 127.0.0.1/localhost.localdomain - GET - 
myip=127.0.0.1 myport=3128

Regards
Henrik


signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL / Problem in the url_redirect program

2008-07-06 Thread Shaine

Dear Friends,

Thanks a lot  for all the support so far. Little by little i have some
solutions. But my redirect programs behave very unusual way. Its a working
script. How would i say , when i pass argument via comand line , result was
as i expected. but when its in squid , it doesnt act how it supposed to
work. 

All the web requests comes into the redirect program , its adding VALUE-X
value into the script. But here i am doing grep  for ? mark in to
requested url , if its matched doing another function squid itself. it was
success. 

When a web request receives as follows , 
http://10.48.15.1:8080/main/main_view?id=7
that adding of the value wont happen.why is that ? why its not perform in
squid redirector program ? doi have to do any thing special in squid or in
the perl script ?

Following is my script.

#!/usr/bin/perl
# no buffered output, auto flush
use strict;
use warnings;

my ($temp, $array, @array, $param_1, $param_2, $param_3, $new_uri);

$|=1;
$temp = ;


while (STDIN){
  [EMAIL PROTECTED] = split(/ /);
  ($param_1, $param_2, $param_3) = split(/ /);
  #if (!($array[1] =~ m#VALUE-X#)) {
  if (!($param_2 =~ m#VALUE-X#)) {
$temp = $param_2;
if ($param_2 =~ m#\?#) {
  $temp .= VALUE-X=652224848;
}else {
  $temp .= ?VALUE-X=652224848;
}
$new_uri = ($param_1 .   . $temp .   . $param_3);
s#$param_2#$temp#;
#print $new_uri;
print;
  }else {
print;
  }
}



Thank you
Shaine.






Marcus Kool wrote:
 
 Shaine,
 
 Because you use the 302: prefix the URL that you pass back from the
 redirector
 to Squid is sent back to the browser and because of the 302 the browser
 sends a new request to Squid and the new URL is the URL that the
 redirector sent
 in the first place.  This URL is passed by Squid to the redirector and now
 you
 have an endless loop.
 
 solution:
 - do not use the 302: prefix, or
 - modify your perl code so that it checks for orchard=66677722 in which
 case it must not 
 rewrite the URL.
 
 -Marcus
 
 
 Shaine wrote:
 Dear friedns, 
 
 I am really fed up with url -redirecting program which i have used for
 redirect specific url comes and validate by the url -rewriting program .
 It
 wasnt gave me any errors at initial steps.But now when i try to access
 google or any url , its repating ( url * n ) ,
 
 eg:-
 :http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com
 
 following is my perl code ( url-redirecting program ) 
 
 
 #!/usr/bin/perl
 # no buffered output, auto flush
 $|=1;
 $temp = ;
 
 while (STDIN){
   @array = split(/ /);
   if (!(@array[1] =~ m#orchard#)) {
 $temp = 302: .  @array[1];
 if (@array[1] =~ m/\?/) {
   $temp .= orchard=66677722;
 }else {
   $temp .= ?orchard=66677722;
 }
 [EMAIL PROTECTED];
 print;
   }else {
 print;
   }
 }
 
 
 Can somebody help me to solve my issue ? please help me. actually why it
 is
 happening like that .
 
 Many thanks
 Shaine.
 
 
 
 
 Sylvain Viart-2 wrote:
 Hi Shaine,

 Shaine a écrit :
 I have a big problem with adding a parameter to a URL which passes via
 squid
 . For that i am going to use url_rewrite program. I had a big time with
 squid url rewriting, but no success. 

 Could you please tell me , to get in to my point what are the minimum
 requirement to be satisfied ?
   
 I haven't tested to rewrite the querystring part of the url, but it's 
 available on the redirector (rewrite_program)

 Here's sample input for the rewrite_program

 0 
 http://www.somedomain.com/thumb/100/3/b/2/7/3b279a6eab3d0a983d9tre.somedomain.com/messenger/messPing.php
  
 12.34.56.78/- - POST -
 0 
 http://subdom.somedomain.com/thumb/55/3/c/3/6/3c36046ed06c78b2b65627f660be6220.jpg
  
 12.34.56.78/- - GET -
 0 
 http://www.somedomain.com/thumb/100/3/6/8/4/3684949288972604fafdb167ffc214d5.jpg
  
 12.34.56.78/- - GET -
 0 
 http://www.somedomain.com/thumb/100/7/a/4/1/7a4113fd5fba8ec93fa6bf82a6c993be.jpg
  
 12.34.56.78/- - GET -
 0 
 http://www..somedomain.com/thumb/100/4/3/d/f/43df2ca304f508557294d3a835a6fd29.jpg
  
 12.34.56.78/- - GET -

 The digit in the first position  is only present when 
 url_rewrite_concurrency is used, see

 The thread : url_rewrite_concurrency singlethreaded redirector
 performance?

 http://www.mail-archive.com/squid-users@squid-cache.org/msg49897.html

 url_rewrite_program
 url_rewrite_children
 url_rewrite_concurrency
 url_rewrite_host_header on|off 
 url_rewrite_access allow|deny acl ...
   
 I use :
 url_rewrite_program /etc/squid/redirector.pl
 url_rewrite_children 100
 url_rewrite_concurrency 50
 url_rewrite_host_header off


 which means :

 100 process spawned (busy proxy)
 url_rewrite_concurrency 50, means squid can pass up to 50 URL to the 
 program using a counter

 url_rewrite_host_header off, means that redirector rewrites the URL, but 
 squid keep the original URL, useful in 

Re: [squid-users] adding a parameter to a URL

2008-07-04 Thread Shaine

Dear friedns, 

I am really fed up with url -redirecting program which i have used for
redirect specific url comes and validate by the url -rewriting program . It
wasnt gave me any errors at initial steps.But now when i try to access
google or any url , its repating ( url * n ) ,

eg:-
:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com

following is my perl code ( url-redirecting program ) 


#!/usr/bin/perl
# no buffered output, auto flush
$|=1;
$temp = ;

while (STDIN){
  @array = split(/ /);
  if (!(@array[1] =~ m#orchard#)) {
$temp = 302: .  @array[1];
if (@array[1] =~ m/\?/) {
  $temp .= orchard=66677722;
}else {
  $temp .= ?orchard=66677722;
}
[EMAIL PROTECTED];
print;
  }else {
print;
  }
}


Can somebody help me to solve my issue ? please help me. actually why it is
happening like that .

Many thanks
Shaine.




Sylvain Viart-2 wrote:
 
 Hi Shaine,
 
 Shaine a écrit :
 I have a big problem with adding a parameter to a URL which passes via
 squid
 . For that i am going to use url_rewrite program. I had a big time with
 squid url rewriting, but no success. 

 Could you please tell me , to get in to my point what are the minimum
 requirement to be satisfied ?
   
 I haven't tested to rewrite the querystring part of the url, but it's 
 available on the redirector (rewrite_program)
 
 Here's sample input for the rewrite_program
 
 0 
 http://www.somedomain.com/thumb/100/3/b/2/7/3b279a6eab3d0a983d9tre.somedomain.com/messenger/messPing.php
  
 12.34.56.78/- - POST -
 0 
 http://subdom.somedomain.com/thumb/55/3/c/3/6/3c36046ed06c78b2b65627f660be6220.jpg
  
 12.34.56.78/- - GET -
 0 
 http://www.somedomain.com/thumb/100/3/6/8/4/3684949288972604fafdb167ffc214d5.jpg
  
 12.34.56.78/- - GET -
 0 
 http://www.somedomain.com/thumb/100/7/a/4/1/7a4113fd5fba8ec93fa6bf82a6c993be.jpg
  
 12.34.56.78/- - GET -
 0 
 http://www..somedomain.com/thumb/100/4/3/d/f/43df2ca304f508557294d3a835a6fd29.jpg
  
 12.34.56.78/- - GET -
 
 The digit in the first position  is only present when 
 url_rewrite_concurrency is used, see
 
 The thread : url_rewrite_concurrency singlethreaded redirector
 performance?
 
 http://www.mail-archive.com/squid-users@squid-cache.org/msg49897.html
 
 url_rewrite_program
 url_rewrite_children
 url_rewrite_concurrency
 url_rewrite_host_header on|off 
 url_rewrite_access allow|deny acl ...
   
 
 I use :
 url_rewrite_program /etc/squid/redirector.pl
 url_rewrite_children 100
 url_rewrite_concurrency 50
 url_rewrite_host_header off
 
 
 which means :
 
 100 process spawned (busy proxy)
 url_rewrite_concurrency 50, means squid can pass up to 50 URL to the 
 program using a counter
 
 url_rewrite_host_header off, means that redirector rewrites the URL, but 
 squid keep the original URL, useful in accelerator mode (surrogate), See 
 the doc, to be sure.
 how it should like , url rewrite program ? can somebody leave me a simple
 example ?
 Simple perl program :
 
 # no buffered output, auto flush
 $|=1;
 
 while(STDIN)
 {
s#http://something/#http://somthingelse/#;
print;
 }
 
 
 A bit fast answer, hope that helps.
 
 
 Regards,
 Sylvain.
 
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p18276958.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL

2008-07-04 Thread Marcus Kool

Shaine,

Because you use the 302: prefix the URL that you pass back from the redirector
to Squid is sent back to the browser and because of the 302 the browser
sends a new request to Squid and the new URL is the URL that the redirector sent
in the first place.  This URL is passed by Squid to the redirector and now you
have an endless loop.

solution:
- do not use the 302: prefix, or
- modify your perl code so that it checks for orchard=66677722 in which case it must not 
rewrite the URL.


-Marcus


Shaine wrote:
Dear friedns, 


I am really fed up with url -redirecting program which i have used for
redirect specific url comes and validate by the url -rewriting program . It
wasnt gave me any errors at initial steps.But now when i try to access
google or any url , its repating ( url * n ) ,

eg:-
:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com/302:http://www.yahoo.com

following is my perl code ( url-redirecting program ) 



#!/usr/bin/perl
# no buffered output, auto flush
$|=1;
$temp = ;

while (STDIN){
  @array = split(/ /);
  if (!(@array[1] =~ m#orchard#)) {
$temp = 302: .  @array[1];
if (@array[1] =~ m/\?/) {
  $temp .= orchard=66677722;
}else {
  $temp .= ?orchard=66677722;
}
[EMAIL PROTECTED];
print;
  }else {
print;
  }
}


Can somebody help me to solve my issue ? please help me. actually why it is
happening like that .

Many thanks
Shaine.




Sylvain Viart-2 wrote:

Hi Shaine,

Shaine a écrit :

I have a big problem with adding a parameter to a URL which passes via
squid
. For that i am going to use url_rewrite program. I had a big time with
squid url rewriting, but no success. 


Could you please tell me , to get in to my point what are the minimum
requirement to be satisfied ?
  
I haven't tested to rewrite the querystring part of the url, but it's 
available on the redirector (rewrite_program)


Here's sample input for the rewrite_program

0 
http://www.somedomain.com/thumb/100/3/b/2/7/3b279a6eab3d0a983d9tre.somedomain.com/messenger/messPing.php 
12.34.56.78/- - POST -
0 
http://subdom.somedomain.com/thumb/55/3/c/3/6/3c36046ed06c78b2b65627f660be6220.jpg 
12.34.56.78/- - GET -
0 
http://www.somedomain.com/thumb/100/3/6/8/4/3684949288972604fafdb167ffc214d5.jpg 
12.34.56.78/- - GET -
0 
http://www.somedomain.com/thumb/100/7/a/4/1/7a4113fd5fba8ec93fa6bf82a6c993be.jpg 
12.34.56.78/- - GET -
0 
http://www..somedomain.com/thumb/100/4/3/d/f/43df2ca304f508557294d3a835a6fd29.jpg 
12.34.56.78/- - GET -


The digit in the first position  is only present when 
url_rewrite_concurrency is used, see


The thread : url_rewrite_concurrency singlethreaded redirector
performance?

http://www.mail-archive.com/squid-users@squid-cache.org/msg49897.html


url_rewrite_program
url_rewrite_children
url_rewrite_concurrency
url_rewrite_host_header on|off 
url_rewrite_access allow|deny acl ...
  

I use :
url_rewrite_program /etc/squid/redirector.pl
url_rewrite_children 100
url_rewrite_concurrency 50
url_rewrite_host_header off


which means :

100 process spawned (busy proxy)
url_rewrite_concurrency 50, means squid can pass up to 50 URL to the 
program using a counter


url_rewrite_host_header off, means that redirector rewrites the URL, but 
squid keep the original URL, useful in accelerator mode (surrogate), See 
the doc, to be sure.

how it should like , url rewrite program ? can somebody leave me a simple
example ?

Simple perl program :

# no buffered output, auto flush
$|=1;

while(STDIN)
{
   s#http://something/#http://somthingelse/#;
   print;
}


A bit fast answer, hope that helps.


Regards,
Sylvain.











[squid-users] adding a parameter to a URL

2008-06-11 Thread Shaine

Dear Friends,

I have a big problem with adding a parameter to a URL which passes via squid
. For that i am going to use url_rewrite program. I had a big time with
squid url rewriting, but no success. 

Could you please tell me , to get in to my point what are the minimum
requirement to be satisfied ?

url_rewrite_program
url_rewrite_children
url_rewrite_concurrency
url_rewrite_host_header on|off 
url_rewrite_access allow|deny acl ...

how it should like , url rewrite program ? can somebody leave me a simple
example ?

Many Thanks
Shaine.
-- 
View this message in context: 
http://www.nabble.com/adding-a-parameter-to-a-URL-tp17776816p17776816.html
Sent from the Squid - Users mailing list archive at Nabble.com.



Re: [squid-users] adding a parameter to a URL

2008-06-11 Thread Henrik Nordstrom
On ons, 2008-06-11 at 05:51 -0700, Shaine wrote:

 I have a big problem with adding a parameter to a URL which passes via squid
 . For that i am going to use url_rewrite program. I had a big time with
 squid url rewriting, but no success. 
 
 Could you please tell me , to get in to my point what are the minimum
 requirement to be satisfied ?

url_rewrite_program is the only required directive.

It's recommended to also use url_rewrite_concurrency, but you must then
adjust your helper to understand the concurrent version of the helper
protocol (a request channel number is inserted infront of helper
requests/responses)

If you don't use url_rewrite_concurrency then you most likely need to
tune url_rewrite_children a bit depending on your load, but the default
of 5 is more than sufficient for testing.

Regards
Henrik


signature.asc
Description: This is a digitally signed message part


Re: [squid-users] adding a parameter to a URL

2008-06-11 Thread Sylvain Viart

Hi Shaine,

Shaine a écrit :

I have a big problem with adding a parameter to a URL which passes via squid
. For that i am going to use url_rewrite program. I had a big time with
squid url rewriting, but no success. 


Could you please tell me , to get in to my point what are the minimum
requirement to be satisfied ?
  
I haven't tested to rewrite the querystring part of the url, but it's 
available on the redirector (rewrite_program)


Here's sample input for the rewrite_program

0 
http://www.somedomain.com/thumb/100/3/b/2/7/3b279a6eab3d0a983d9tre.somedomain.com/messenger/messPing.php 
12.34.56.78/- - POST -
0 
http://subdom.somedomain.com/thumb/55/3/c/3/6/3c36046ed06c78b2b65627f660be6220.jpg 
12.34.56.78/- - GET -
0 
http://www.somedomain.com/thumb/100/3/6/8/4/3684949288972604fafdb167ffc214d5.jpg 
12.34.56.78/- - GET -
0 
http://www.somedomain.com/thumb/100/7/a/4/1/7a4113fd5fba8ec93fa6bf82a6c993be.jpg 
12.34.56.78/- - GET -
0 
http://www..somedomain.com/thumb/100/4/3/d/f/43df2ca304f508557294d3a835a6fd29.jpg 
12.34.56.78/- - GET -


The digit in the first position  is only present when 
url_rewrite_concurrency is used, see


The thread : url_rewrite_concurrency singlethreaded redirector performance?

http://www.mail-archive.com/squid-users@squid-cache.org/msg49897.html


url_rewrite_program
url_rewrite_children
url_rewrite_concurrency
url_rewrite_host_header on|off 
url_rewrite_access allow|deny acl ...
  


I use :
url_rewrite_program /etc/squid/redirector.pl
url_rewrite_children 100
url_rewrite_concurrency 50
url_rewrite_host_header off


which means :

100 process spawned (busy proxy)
url_rewrite_concurrency 50, means squid can pass up to 50 URL to the 
program using a counter


url_rewrite_host_header off, means that redirector rewrites the URL, but 
squid keep the original URL, useful in accelerator mode (surrogate), See 
the doc, to be sure.

how it should like , url rewrite program ? can somebody leave me a simple
example ?

Simple perl program :

# no buffered output, auto flush
$|=1;

while(STDIN)
{
  s#http://something/#http://somthingelse/#;
  print;
}


A bit fast answer, hope that helps.


Regards,
Sylvain.







Re: [squid-users] adding a parameter to a URL

2008-06-11 Thread Henrik Nordstrom
On ons, 2008-06-11 at 18:02 +0200, Sylvain Viart wrote:

 url_rewrite_program /etc/squid/redirector.pl
 url_rewrite_children 100
 url_rewrite_concurrency 50
 url_rewrite_host_header off
 
 
 which means :
 
 100 process spawned (busy proxy)
 url_rewrite_concurrency 50, means squid can pass up to 50 URL to the 
 program using a counter

You would actually be better off with url_rewrite_children 1 and a much
higher concurrency level.

 url_rewrite_host_header off, means that redirector rewrites the URL, but 
 squid keep the original URL, useful in accelerator mode (surrogate), See 
 the doc, to be sure.

It's better to not rewrite the host component. Use cache_peer_access to
select the right backend server instead.

This is a directive likely to be removed in future releases as it's not
really needed, and can cause some often unexpected problems (but natural
once you look at it..)

Regards
Henrik


signature.asc
Description: This is a digitally signed message part