Text
|
The Caravan FTP server is now an integral part of the application platform, so the developer can now integrate the ftp services directly to the application context. Previously the Caravan ftp server was just like any other ftp server -- it just served static files from the user's ftphome directory. Now for the first time Caravan ftp server can actually serve dynamic content generated by the application logic!
The ftp server's access control is managed by Caravan's user management system. Ftp access for the user is granted as per the ftphome property of the user. For static ftp , this value is the users's home directory for ftp operations. With versions> 3.00 this value can also be the name of a caravan script which is the code written specifically to service the ftp requests from this user. Caravan will redirect all ftp commands from the client to this code.
The script which is intented for ftp servicing , is executed by caravan everytime the ftp client sends a command. Ftp commands are passed in the 'form(command)' property. The code should process the following commands . If the processing was successfull ftp(ok) should be setto "yes";
These are the command strings and their purpose is given below:
"user"; client logged in; just for information ; form(param) giver user's login -- should ok by setting the ftp(ok) property.
"list"; list filenames with time and size and type; form(arg) gives file specification if any.
"nlst"; list filenames only ; form(arg) gives file specification (is *.zip etc) if any
"retr"; client wants to get a file whose name is form(arg) "retrd"; get command on form(arg) was successfull
"stor"; client wants to put a file which is the value of form(param)
"rmd"; client wants to delete a directory whose name is given in form(arg)
"ren"; client wants to rename file from form(param) to form(arg)
"mkd"; client wants makes a new directory of name 'form(arg)'
"dele"; client wants to delete a file whose name is given in 'form(arg)'
"cwd"; client wants to change directory to form(arg);
"quit"; the client has logged out
An object of name 'ftp' is passed to the the script. The 'ok' property should be set if the command was successfull. The 'ftp' object will hold the result of the precessing like file list, file content etc.
An object of name 'form' is also passed to the script which contains all the information about the command.
'form' has following properties :
command : One of the command tokens listed above -- which commands to process and which to ignore is upto the programmer. Minimum "list","nlst" and "retr" will need to implemented.
pwd : present working directory of the client -- can give the context of users' actions this will be something like 'users/kdv/files' arg : first argument to the command -- most commands have an argument
param: second argument of the command -- some commands need 2 arguments . This value also holds the entire file in "stor" (put) command .
It is also possible to maintain additional persistent objects for the duration of the user's ftp session.
|