www-modproxy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Holsman <Ian.Hols...@cnet.com>
Subject Re: Files from FTP servers are transmitted as text
Date Thu, 08 Aug 2002 15:42:43 GMT
On Thu, 2002-08-08 at 00:28, Alexey Panchenko wrote:
> Hi !

Hi Alexey.

I don't know if this is the correct fix for 2.0
if you have a multi-threaded server than old_type may be changed by a 
different thread.

maybe if we just remove 'old_type' altogether and just send out the type
command all the time ?

> 
> The function ftp_set_TYPE in proxy_ftp.c should be fixed.
> Now because of the static variable used correct type is set only once,
> and all subsequent file downloads use default type, resulting in
> corrupted files downloaded as text.
> 
> The simpliest fix is to remove comparision with old type value:
> 
>  /* Set ftp server to TYPE {A,I,E} before transfer of a directory or file */
>  static int ftp_set_TYPE(request_rec *r, BUFF *ctrl, char xfer_type)
>  {
>      static char old_type[2] = {'A', '\0'};      /* After logon, mode is ASCII */
>      int ret = HTTP_OK;
>      int rc;
>  
> -    if (xfer_type == old_type[0])  // remove these lines.
> -        return ret;
> -
>      /* set desired type */
>      old_type[0] = xfer_type;
>      ap_bvputs(ctrl, "TYPE ", old_type, CRLF, NULL);
>      ap_bflush(ctrl);
>      ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, r->server, "FTP: TYPE %s",
old_type);
> 
> -- 
> Best regards,
>  Alexey                          mailto:alexey@liwest.ru
> 
-- 
Ian Holsman
Performance Measurement & Analysis
CNET Networks
PH: 415-344-2608

Mime
View raw message