Subject: Trouble with http-gw

From: "Michael St. Laurent" <[email-masked]>
Date: Thu, 18 May 2000 10:21:54 -0700

[To be removed from this list send the message "unsubscribe fwtk-users" in the
BODY of a mail message to [email-masked].]

I'm having the following problem with the stock http-gw program from 
fwtk-2.1 running in daemon mode on a Debian GNU-Linux box using kernel 2.0.37.

If I enter the following full path URL to a file on an FTP site it 
works.  Example: 
ftp://ftp.adobe.com/pub/adobe/acrobatreader/win/4.x/ar405eng.exe

If I enter the following path to display the contents of the directory 
containing the file on the same FTP site it 
works.  Example:  ftp://ftp.adobe.com/pub/adobe/acrobatreader/win/4.x

If I remove the "4.x" portion of the address and try again, there is a 
delay of about thirty seconds before the browser (IE 5.01) returns the 
following error:  "An error occurred reading the contents of the 
folder.  Make sure the file name is valid and you have permission to access 
the location specified.  Details: The operation timed out"

If I use an FTP client program instead of the web browser I can access the 
directory without error.

Help!!!  ;-)

--------------------

Michael St. Laurent
Hartwell Corporation

---

From: Scott Newton <[email-masked]>
Date: Fri, 19 May 2000 08:28:46 +1200

Hi

Try
ftp://ftp.adobe.com/pub/adobe/acrobatreader/win/4.x/
with the trailing slash. I've noticed that without the slash http-gw thinks it's a
regular file and so fails.

By the way, does anyone know a fix to this?

Scott

--
Scott Newton
Quanta Systems Ltd

---

From: Tony Gale <[email-masked]>
Date: Fri, 19 May 2000 09:24:31 +0100 (BST)

Well, it works fine for me. Therefore, one of the enclosed patches
should fix it.

-tony

On 18-May-2000 Michael St. Laurent wrote:
> ftp://ftp.adobe.com/pub/adobe/acrobatreader/win/4.x
> 

---
E-Mail: Tony Gale <[email-masked]>
It is a sobering thought that when Mozart was my age, he had been
dead for two years.
		-- Tom Lehrer

The views expressed above are entirely those of the writer
and do not represent the views, policy or understanding of
any other person or official body.
*** hmain.c.orig	Wed Nov 11 14:22:14 1998
--- hmain.c	Sun Feb 14 13:39:23 1999
***************
*** 857,869 ****
  		if(html_read(fd,(char *)&buf[x],1) != 1)
  			goto done;
  
! 		/* get \r\n - read a char and throw it away */
! 		if(buf[x] == '\r') {
  			if(html_read(fd,(char *)&buf[x],1) != 1)
  				goto done;
- 			buf[x] = '\0';
- 			ret = x;
- 			goto done;
  		}
  
  		if(buf[x] == '\n') {
--- 857,866 ----
  		if(html_read(fd,(char *)&buf[x],1) != 1)
  			goto done;
  
!                 /* eat all \r from the stream */
!                 while(buf[x] == '\r') {
  			if(html_read(fd,(char *)&buf[x],1) != 1)
  				goto done;
  		}
  
  		if(buf[x] == '\n') {
*** fwtk/http-gw/hmain.c.dist	Mon Feb 28 14:23:18 2000
--- fwtk/http-gw/hmain.c	Mon Feb 28 14:28:26 2000
***************
*** 945,953 ****
  char	*s;
  int	n;
  {
! 	if(net_write(fd,s,n) != n)
  		return(1);
! 	return(net_write(fd,"\r\n",2) != 2);
  }

--- 945,965 ----
  char	*s;
  int	n;
  {
! 	char *buff;
! 	int retval;
! 
! 	/* Some FTP servers don't like receiving commands
! 	 * split over multiple packets.
! 	 * TRG - 20000228
! 	 */
! 	if ( (buff = malloc(n+2)) == NULL)
  		return(1);
! 	memcpy(buff, s, n);
! 	buff[n]='\r';
! 	buff[n+1]='\n';
! 	retval = net_write(fd,buff,n+2);
! 	free(buff);
! 	return(retval != n+2);
  }