John F Hall <[EMAIL PROTECTED]> writes:

> I installed 2.8c yesterday and found that htdig searches then failed.
> Patching the wwwoffle-htsearch script, I see that htsearch produces html
> on its standard output and that this should get routed back to the
> browser.  The same output was produced with 2.8c and 2.8b, so the search
> was executing correctly.
> 
> However (using lynx which seem to give the best commentary) with 2.8b I
> get "HTTP/1.0 200 htsearch output" followed after a delay with the
> result, whereas with 2.8c I get "HTTP request sent; waiting for
> response." followed after a delay by "Alert!: Unexpected network read
> error; connection aborted." and then "Alert!: Unable to access
> document."  (Presumably the "request sent" always happens, but is
> normally overwritten before one sees it.)  Other browsers just give the
> "page not found" screen.
> 
> I haven't analysed how wwwoffled gets the search output to the browser,
> other than to see that the coding has changed significantly.  I presume
> that either the output is not getting sent back or that the connection
> is closing prematurely.

The code that handles the searches has changed between version 2.8b
and 2.8c, but it is a tidy up and small bug fix operation rather than
a rewrite.

I did test the changes when I made them and there was no change in the
behaviour.  After some detailed investigations the problem seems to
occur only if wwwoffled is run detached from the console and the '-l'
option is not used.  Since I use the '-l' option I did not see the
problem.

A workaround is to use the -l option (which is a very useful option
anyway).

A minimal patch that will fix the problem is below, a more detailed
one has been put in for the next version.

-------------------- search.c.diff --------------------
--- /tmp/search.c.~1.32~        2004-06-17 19:51:15.000000000 +0100
+++ /tmp/search.c       2004-06-17 19:53:01.000000000 +0100
@@ -482,15 +482,6 @@
     int cgi_fd;
     int env_err=0;
 
-    close(STDIN_FILENO);
-    cgi_fd=open("/dev/null",O_RDONLY);
-    if(cgi_fd!=STDIN_FILENO)
-      {
-       if(dup2(cgi_fd,STDIN_FILENO)==-1)
-          PrintMessage(Fatal,"Cannnot create standard input for %s search script 
[%!s].",name);
-       close(cgi_fd);
-      }
-
     if(fd!=STDOUT_FILENO)
       {
        close(STDOUT_FILENO);
@@ -501,6 +492,14 @@
        init_io(STDOUT_FILENO);
       }
 
+    cgi_fd=open("/dev/null",O_RDONLY);
+    if(cgi_fd!=STDIN_FILENO)
+      {
+       if(dup2(cgi_fd,STDIN_FILENO)==-1)
+          PrintMessage(Fatal,"Cannnot create standard input for %s search script 
[%!s].",name);
+       close(cgi_fd);
+      }
+
     if(dup(STDERR_FILENO)==-1 && errno==EBADF) /* stderr is not open */
       {
        cgi_fd=open("/dev/null",O_WRONLY);
-------------------- search.c.diff --------------------

-- 
Andrew.
----------------------------------------------------------------------
Andrew M. Bishop                             [EMAIL PROTECTED]
                                      http://www.gedanken.demon.co.uk/

WWWOFFLE users page:
        http://www.gedanken.demon.co.uk/wwwoffle/version-2.8/user.html

Reply via email to