Article delegate-en/3225 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:<_A3222@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: TIMEOUT with a perl filter
17 May 2006 21:50:30 GMT feedback@delegate.org (Yutaka Sato)
The DeleGate Project


In message <_A3222@delegate-en.ML_> on 05/17/06(22:14:02)
you =?ISO-8859-1?Q?S=E9bastien_Cottalorda?= <psygabdyi-h3lluohxmrxr.ml@ml.delegate.org> wrote:
 |I use delegate 9.1.1 on a Mandrake distrib.
 |During a large file filter processing, delegate timed out as this
... 
 |According you, who is disconnecting first :
 |    - My email client (thunderbird)
 |    - or Delegate that wait for an answer from the filter program
...
 |05/17 15:05:45.61 [15468] 9+0: CFI/MSGS ---- --MESSAGE/mime RETR^M
 |05/17 15:06:09.83 [15468] 9+0: systemFilter[1,3]: 
 |/usr/local/delegate9.1.1/lib/filter.pl
 |05/17 15:06:30.56 [15467] 9+0: disconnected [43] 
 |-@[myiaddr]myiaddr:49330 (45.987s)(0)
 |05/17 15:06:31.60 [15467] 9+0: CFI process remaining (1/1)
 |05/17 15:06:33.04 [15468] 9+0: Content-Length: 0 -> 8199000 (000000X - 2385)

DeleGate for POP does not do timeouts on inputs from client or server.
Maybe it's the timeout (about 45 seconds) of Thunderbird waiting the
response to the RETR command.

You can emulate a POP server as follows (lines with ">" are input manually):

   % delegated -P999 -v SERVER=tcprelay
   ...
   05/18 06:20:21.68 [22803] 2+1: (0) accepted [32] -@[127.0.0.1]localhost:61185 (0.014s)(1)
   05/18 06:20:21.69 [22803] 2+1: relays(2) start: timeout=600000msec
>  +
   CAPA
>  .
   USER user
>  +
   PASS pass
>  +
   STAT
>  +ok 1 2
   LIST
... (about 45 seconds) ...
   05/18 06:21:20.29 [22803] 2+1: relays[0]: [32->EOF] 0(0i+0o)
   05/18 06:21:20.30 [22803] 2+1: relays[0]: [32->1] 41 bytes / 6 -> 41
   05/18 06:21:20.30 [22803] 2+1: relays[1]: [0->32] 16 bytes / 5 -> 16
   05/18 06:21:20.30 [22803] 2+1: disconnected [32] -@[127.0.0.1]localhost:61185 (58.633s)(0)



DeleGate + CFI relay a (MIME) message as follows:

                                                        (conversion)
  1) server ----> DeleGate ----> CFI-DeleGate ----> Filter ----> tmpfile
  2) tmpfile ----> CFI-DeleGate ----> client
                   (perfection)

In the second phase, DeleGate does some perfection of the MIME message
including adjusting the Content-Length header (for HTTP protocol).
In your case, this can be unnecessary, so it can be processed as this:

  1) server ----> DeleGate ----> CFI-DeleGate ----> Filter ----> client
                                                     (no-perfection)

I made a tentative CFI directive "Options: NoPerfection" to let DeleGate
work as above.  It can be used as this:

  #!cfi
  Options: NoPerfection
  Filter: filter-command

I hope this will solve your problem.

Cheers,
Yutaka
--
  D G   Yutaka Sato <y.sato@delegate.org> http://delegate.org/y.sato/
 ( - )  National Institute of Advanced Industrial Science and Technology
_<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan
Do the more with the less -- B. Fuller

*** ../delegate9.2.1/filters/cfi.c	Tue Apr 25 04:08:07 2006
--- filters/cfi.c	Thu May 18 06:01:42 2006
***************
*** 418,423 ****
--- 418,424 ----
  			removeFields(AVStr(head),"Vary",0);
  	}
  }
+ 
  void System(PCStr(command),FILE *in,FILE *out);
  static int http_conv(FILE *in,FILE *out,PCStr(conninfo),PCStr(convspec),PCStr(clproto),PVStr(statline),xPVStr(head),int withbody)
  {	const char *spec;
***************
*** 598,603 ****
--- 599,622 ----
  	 *	Translate
  	 */
  	if( withbody ){
+ 		int respTHRU = 0;
+ 		FILE *stmp = tmp;
+ 		CStr(opts,128);
+ 		if( getFV(spec,"Options",opts) )
+ 		if( isinListX(opts,"NoPerfection","cw") ){
+ 			respTHRU = 1;
+ 			sv1log("---- in NoPerfection BEGIN\n");
+ 			Ftruncate(tmp,bodyoff,0);
+ 			fseek(tmp,0,0);
+ 			copyfile1(tmp,out);
+ 			Ftruncate(tmp,0,0);
+ 			tmp = out;
+ 			/* if with Message-Filter, it must be invoked
+ 			 * as a filter process connected with this process
+ 			 * getting input from a pipe.
+ 			 */
+ 		}
+ 
  		if( getFV(spec,"Output-Prefix",prefix) )
  			substitute(tmp,conninfo,spec,"Output","Prefix",statline,savhead);
  
***************
*** 621,626 ****
--- 640,651 ----
  
  		if( getFV(spec,"Output-Postfix",postfix) )
  			substitute(tmp,conninfo,spec,"Output","Postfix",statline,savhead);
+ 		if( respTHRU ){
+ 			tmp = stmp;
+ 			fflush(out);
+ 			sv1log("---- in NoPerfection END\n");
+ 			truncVStr(savhead);
+ 		}
  	}
  	if( getFV(spec,"Message-Filter",filter) ){
  		FILE *inmsg;

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V