lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev pre.10 : -post_data, nls-fork, various


From: Bela Lubkin
Subject: Re: lynx-dev pre.10 : -post_data, nls-fork, various
Date: Wed, 14 Oct 1998 16:03:52 -0700

Serge MUNHOVEN wrote:

> # ./configure  --with-zlib --enable-forms-options --enable-persistent-cookies 
> --enable-partial --enable-nsl-fork --enable-dired
> 
> % cat POST
> test
> ---
> % cat POST | ./lynx -cfg ./lynx.cfg -post_data http://echo.znet.de:8888/ > 
> FILE
> 
> lynx: Can't access startfile http://echo.znet.de:8888/
> % cat POST | ./lynx -cfg ./lynx.cfg -post_data http://195.238.147.34:8888/ > 
> FILE 
> % ./lynx -cfg ./lynx.cfg -post_data http://echo.znet.de:8888/ > FILE
> test
> ---
> 
> The first one fails, the second and third work. After tracing those and
> trying other things (cat POST - | ./lynx ...; works and while cat is waiting
> for some input on stdin, lynx ... has already *completed* without failure !)
> and wondering if there was a timing problem or a spurious reading from tty I
> came to the conclusion that nls-fork is involved :
> # ./configure  --with-zlib --enable-forms-options --enable-persistent-cookies 
> --enable-partial --enable-dired
> and all combinations work. I crosschecked this on another machine. It would be
> nice if someone else could try to reproduce this (or wake me up ?).

Fascinating.  I get the same behavior on my system.  `truss` helped me
figure out why.  I understand the sequence, but not why `cat | ...
-post_data` would trigger it.  Nevertheless, here's a patch (Tom, this
should go into 2.8.1).

>Bela<

=============================================================================

*** HTTCP.c.orig        Wed Oct 14 05:23:56 1998
--- HTTCP.c     Wed Oct 14 16:01:34 1998
***************
*** 455,456 ****
--- 455,457 ----
            int dns_patience = 30; /* how many seconds will we wait for DNS? */
+           int child_exited = 0;
  
***************
*** 577,582 ****
                /*
!               **  End loop if child exited.
                */
!               if ((waitret = waitpid(fpid, &cst1, WNOHANG)) > 0)
                    break;
  
--- 578,590 ----
                /*
!               **  Clean up if child exited before & no data received.  -BL
                */
!               if (child_exited) {
!                   waitret = waitpid(fpid, &cst1, WNOHANG);
                    break;
+               }
+               /*
+               **  If child exited, loop once more looking for data.  -BL
+               */
+               if ((waitret = waitpid(fpid, &cst1, WNOHANG | WNOWAIT)) > 0)
+                   child_exited = 1;
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]