Hi, I've downloaded the mod_ftpd's src from
http://www.outoforder.cc/projects/apache/mod_ftpd/ and have
installed it on my WinXP box. When I read the code, I found some
problem and got some thought. I don't know if this is the right
place to put the idea, but I've mailed the author yesterday, and
didn't receive any reply. so, I post my idea here and hope
somebody'll give some direction to me.

First, the mod_ftpd's doc says that it can't be runned under
Win32. Through debug, I've found it's because some funciton
in it used more than 1M stack space, Just make stack var to
heap/pool var will solve this problem:

static char *ftpd_ascii_convert(...)
{
 /* char temp[p, FTPD_IO_BUFFER_MAX*2] ;  */
 char* temp = apr_palloc(p, FTPD_IO_BUFFER_MAX*2) ;
}

HANDLER_DECLARE(stor)
{
    /* char buff[FTPD_IO_BUFFER_MAX] ;  */
 char* buff = apr_palloc(r->pool, FTPD_IO_BUFFER_MAX) ;
}

HANDLER_DECLARE(retr)
{
   /* char buff[FTPD_IO_BUFFER_MAX] ;  */
   char* buff = apr_palloc(r->pool, FTPD_IO_BUFFER_MAX) ;
}

Next, there isn't any cache mechanism in the stor&retr's handler,
I think maybe mod_disk_cache can help here.

Third, the funcion ftpd_ascii_convert can use the technology appeared
in Nick's article: http://www.apachetutor.org/dev/brigades to reduce
the memory usage.

And the last, I don't know if I can directly write:
ap_rgetline(&buffer, FTPD_STRING_LENGTH, &len, r, 0, bb) != APR_SUCCESS)
in my main-loop code. I've seen from mod_echo.c that is use
ap_get_brigade(c->input_filters, bb, AP_MODE_GETLINE,APR_BLOCK_READ, 0) != 
APR_SUCCESS)
instead of ap_rgetline.



Reply via email to