[squid-users] RE: Trouble writing external acl helper

2010-04-15 Thread marriedto51

@Adnan Shahzad-2: I don't immediately see that this has anything to do with
external acl helpers.

I am not a squid expert, but I think if you want to accept all requests for
http://irqa-pc/, then you could define an acl with
acl irqa-pc url_regex ^http://irqa-pc/
and put
http_access allow irqa-pc
early on in the http_access section of the config file. If you want to
accept requests to any URL with no dots in the domain component then you
could probably use
acl no_dots url_regex ^http://[^.]*/
http_access allow no_dots

Others might be able to help with why you are getting so many requests for
this destination -- perhaps start a new thread?
-- 
View this message in context: 
http://n4.nabble.com/Trouble-writing-external-acl-helper-tp1839464p1866336.html
Sent from the Squid - Users mailing list archive at Nabble.com.


[squid-users] [SOLVED] Trouble writing external acl helper

2010-04-14 Thread marriedto51

Thank you! Following your example I can now get this to work.

I was perhaps misled by reading source code for something called
"check_group.c" into thinking the setvbuf() calls were needed.

John.
-- 
View this message in context: 
http://n4.nabble.com/Trouble-writing-external-acl-helper-tp1839464p1839566.html
Sent from the Squid - Users mailing list archive at Nabble.com.


[squid-users] Trouble writing external acl helper

2010-04-14 Thread marriedto51

I am almost certainly missing something very basic, but I haven't found out
what after searching here and elsewhere, so any help will be greatly
appreciated.

I'm using squid 3.1 on Fedora 12 (64-bit).

I want to write an external acl helper (for fun!) and started with a toy
example written in C which is only going to allow the URL
"http://www.google.com";. It works as I expect when I run it at the command
line (lines are read one-by-one from standard input and a reply of "OK" or
"ERR" appears on standard output), but the output I get from squid says:

2010/04/14 08:40:23.731| helperOpenServers: Starting 5/5 'toy_helper'
processes
...
2010/04/14 08:40:31.197| WARNING: toy_helper #1 (FD 7) exited
2010/04/14 08:40:31.197| WARNING: toy_helper #3 (FD 11) exited
2010/04/14 08:40:31.198| WARNING: toy_helper #2 (FD 9) exited
2010/04/14 08:40:31.198| WARNING: toy_helper #4 (FD 13) exited
2010/04/14 08:40:31.198| Too few toy_helper processes are running
...
FATAL: The toy_helper helpers are crashing too rapidly, need help!

In the squid.conf file I've put:

external_acl_type toy_helper %PATH /tmp/squid-tests/toy_helper
acl toy external toy_helper

This squid.conf and the toy_helper executable are both in /tmp/squid-tests,
and everything there is world-readable.

Lastly, here is the source for toy_helper:

   1 #include 
   2 #include 
   3 #define BUFSIZE 8192
   4 
   5 int
   6 main(int argc, char *argv[])
   7 {
   8 
   9   char buf[BUFSIZE];
  10
  11   /* make standard output and input unbuffered */
  12   setvbuf(stdout, NULL, _IONBF, 0);
  13   setvbuf(stdin, NULL, _IONBF, 0);
  14   
  15   /* main loop: read lines from stdin */
  16   while ( fgets(buf, sizeof(buf), stdin) )
  17   {
  18 if ( strcmp("http://www.google.com/\n";, buf) == 0 )
  19   printf("OK\n");
  20 else
  21   printf("ERR\n");
  22   }
  23 
  24   return 0;
  25 }

Thanks in advance for any clues,
John.
-- 
View this message in context: 
http://n4.nabble.com/Trouble-writing-external-acl-helper-tp1839464p1839464.html
Sent from the Squid - Users mailing list archive at Nabble.com.