Article delegate-en/3210 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:<_A3209@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: problem with CGI (not CFI) on Windows?
02 May 2006 21:10:04 GMT feedback@delegate.org (Yutaka Sato)
The DeleGate Project


Martin,

In message <_A3209@delegate-en.ML_> on 05/02/06(21:29:45)
you Martin Vetter <pnieabdyi-5sbstghenwxr.ml@ml.delegate.org> wrote:
 |as of delegate 9.2.0 pre9 it seems CFI is working on Windows, thanks.
 |now I try to get a working "inline CGI mount" setup with delegate ...

I don't remember whether or not DeleGate has been able to do usual
CGI on Windows.

 |I see something like this in the console:
 |
 |   (WIN) 20:41.580 [1484] failed spawn(), terminate frozen child: 0
 |   (WIN) 20:41.596 [1484] spawn(c:...\test.exe) = 612, no response  
 |from child, 259,1/35
 |
 |The browser receives nothing. Similar things happen using test.bat ...
 |
 |Funny thing is: if I "ctrl-c" the delegated process
 |during the timeout period occuring before the "failed spawn()",
 |I *do* get output in the browser, but garbled like:
 |
 |   Hello World!
 |   Status: 503 Service Unavailable
 |   Content-Type: text/plain
 |
 |   the service is unavailable temporarily.

The problem occurs because DeleGate waits a negotiation with the spawned
CGI process at the start and at the exit of the process, supposing the
child process is a DeleGate or its filter program which calles
DO_INITIALIZE() or CFI_init() at the start.
It can be escpaed with the enclosed patch.  I confirmed it with the
following test.bat file.

@echo Content-Type: text/html
@echo.
@echo BY CGI ON WIN^<BR^>

 |What would be a minimum working "inline CGI" setup with delegate 9.2?
 |Thanks and regards,

What does "inline" mean ?

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


diff -cr ../delegate9.2.0-pre11/rary/windows.c ./rary/windows.c
*** ../delegate9.2.0-pre11/rary/windows.c	Wed Feb  8 12:07:12 2006
--- ./rary/windows.c	Wed May  3 05:47:36 2006
***************
*** 2302,2307 ****
--- 2302,2313 ----
  			FD_SET(chsock,&chset);
  		}
  
+ 	if( nc == 0 ){
+ 		LE("ERROR wait3() no child");
+ 		errno = ECHILD;
+ 		return -1;
+ 	}
+ 
  	if( options == WAIT_WNOHANG ){
  		tv->tv_sec = 0;
  		tv->tv_usec = 0;
diff -cr ../delegate9.2.0-pre11/src/cgi.c ./src/cgi.c
*** ../delegate9.2.0-pre11/src/cgi.c	Sat Apr  8 20:16:52 2006
--- ./src/cgi.c	Wed May  3 05:42:22 2006
***************
*** 553,559 ****
--- 553,565 ----
  			Finish(-1);
  		}
  	}else{
+ 		extern int MIN_DGSPAWN_WAIT;
+ 		int ws;
+ 		int setwaitspawn(int ws);
+ 		ws = setwaitspawn(MIN_DGSPAWN_WAIT-1);
+ 		/* maybe the child is not DeleGate */
  		pid = SpawnvpDirenv("CGI",execpath,av);
+ 		setwaitspawn(ws);
  	}
  	if( pid == -1 ){
  		putExecError(1,execpath); /* write to fromCGI[1] */
***************
*** 640,645 ****
--- 646,654 ----
  	    }
  	    for( ntry = 0; ; ntry++ ){
  		xpid = checkChildAbort1("CGI");
+ 		if( xpid < 0 && errno == ECHILD ){
+ 			break;
+ 		}
  		/*
  		xpid = NoHangWait();
  		*/

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