Go Back   FlashFXP Forums > > > >

ioFTPD General New releases, comments, questions regarding the latest version of ioFTPD.

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-31-2004, 05:46 PM   #1
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default HTTPd

As promised, I'm now working on the httpd part of daemon So far daemon consists of ~200lines of code, which do following:

0) Handle SSL handshake
1) Determinate HTTP request type (GET, PUT, HEAD, POST)
2) Read http meta-data from header
3) Verify that requested file is within selected root directory
3x) If requested path points to a directory, find first index file from cached db
4) Redirect process to file handlers based on extension
a-4) Create simple handler for ordinary files (.html/.html/.jpg/...)
a-5) Add 'If-Modified-Since' support
a-6) Memory caching for small files
b-4) Finalize php handler
b-5) ... (it works already, but doesn't support POST/PUT yet)
b-6) ...
b-7) Yeap, it's a lot of work
b-8) Add ioftpd specific commands to php
b-9) Add more commands...
b-10) ???

To do:

c-4) Write simple TCL Handler

c-5) CGI handler
c-6) ...
c-7) ...
c-8) This one will take for ages to write

x) Add error messages


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

I will try to keep this thread up to date. If you have experience in writing _modules_ for php, I could use your help. (adding ioftpd specific commands to php)
darkone is offline   Reply With Quote
Old 01-31-2004, 05:57 PM   #2
wooolF[RM]
Senior Member
ioFTPD Foundation User
 
Join Date: Oct 2003
Posts: 411
Default

finally one of the features in ioFTPD that I've waited most for
wooolF[RM] is offline   Reply With Quote
Old 02-01-2004, 07:30 PM   #3
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Keeping it gupdated..
darkone is offline   Reply With Quote
Old 02-01-2004, 10:57 PM   #4
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Some sieging:

# siege -b -c50 -uhttp://192.168.1.10:10000/
** Siege 2.59
** Preparing 50 concurrent users for battle.
The server is now under siege...
Lifting the server siege... done.
Transactions: 25976 hits
Availability: 100.00 %
Elapsed time: 28.37 secs
Data transferred: 138789768 bytes
Response time: 0.05 secs
Transaction rate: 915.62 trans/sec
Throughput: 4892131.26 bytes/sec
Concurrency: 48.82
Successful transactions: 25976
Failed transactions: 0


.. it's well capable of running large sites as well. With keep-alive it's near 2000transactions/sec. (which is 80-90% of IIS performance quite good for hobbyist)
darkone is offline   Reply With Quote
Old 02-02-2004, 03:15 AM   #5
NorLan
Senior Member
 
Join Date: Sep 2003
Posts: 110
Default

i am looking forward to use this feature of io too ...
is the only part missing so far - to make io perfect *g

even if this means that your zipscript (you thougt of loud some time ago) would last a little longer ....
NorLan is offline   Reply With Quote
Old 02-02-2004, 05:38 AM   #6
wooolF[RM]
Senior Member
ioFTPD Foundation User
 
Join Date: Oct 2003
Posts: 411
Default

nice stats over there gj D1
wooolF[RM] is offline   Reply With Quote
Old 02-02-2004, 06:15 AM   #7
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

I decided to make php scripts non-blocking, which means that all data posted to script is read to memory, before script runs. While all data sent by script is also cached to memory, and transfered to client after script finishes successfully.

So, outputting 500kb from php consumes 500kb of memory. I will change this behaviour at later point => then output exceeding the memory buffer will be cached to file instead.
darkone is offline   Reply With Quote
Old 02-02-2004, 07:28 AM   #8
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

php commands will be following:

INT io_user create <user>
INT io_user delete <user>
INT io_user rename <user> <user>
INT io_user login <user> <password>
OBJECT io_user open <user>
INT io_user unlock <user object>
INT io_user print <user object>
INT io_user save <user object> <data>
INT io_user lock <user object>
INT io_user close <user object>

INT io_group create <group>
INT io_group delete <group>
INT io_group rename <group> <group>
OBJECT io_group open <group>
INT io_group unlock <group object>
INT io_group print <group object>
INT io_group save <group object> <data>
ITN io_group lock <group object>
INT io_group close <group object>

INT io_client list init <arguments>
STRING io_client list
INT io_client kill <client id>
INT io_client kick <user id>

INT io_log <type> <line>

STRING io_sha1 <string>

STRING io_resolve vpath <virtual path> <mount file>
STRING io_resolve uid
UID io_resolve user
STRING io_resolve gid
GID io_resolve group

INT io_vfs write <real path> <uid> <gid> <filemode>
INT io_vfs chattr <real path> <+-><type> [value]
INT io_vfs read <real path>

INT io_fileattachment <filename> <file offset>



Any suggestions?
darkone is offline   Reply With Quote
Old 02-02-2004, 02:17 PM   #9
Mouton
Posse Member
Ultimate Scripter
ioFTPD Administrator
 
Join Date: Dec 2002
Posts: 1,956
Default

config edition commands ?
Mouton is offline   Reply With Quote
Old 02-02-2004, 09:41 PM   #10
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

rehash perhaps, can't see much use for other commands (as you can read config directly from file)
darkone is offline   Reply With Quote
Old 02-03-2004, 03:30 AM   #11
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Wii.. all user_ commands were added (I was kind enough to add error definitions php api, is quite nice for adding new commands)

io_user_open command looks following:

Code:
/* proto object io_user_open(uid)
   Open user */
PHP_FUNCTION(io_user_open)
{
	LONG		Uid;
	LPPHP_USERFILE	lpUserFile;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
		"l", &Uid) == FAILURE) return;

	if (Uid < 0 || Uid >= MAX_UID)
	{
		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid UID");
		RETURN_FALSE;
	}

	lpUserFile	= (LPPHP_USERFILE)Allocate("PHP:UserFile", sizeof(USERFILE));
	if (! lpUserFile) RETURN_FALSE
	ZeroMemory(lpUserFile, sizeof(PHP_USERFILE));

	if (UserFile_OpenPrimitive(Uid, &lpUserFile->lpUserFile, 0))
	{
		Php_SetError(GetLastError(), TSRMLS_CC);
		Free(lpUserFile);
		RETURN_FALSE;
	}

	ZEND_REGISTER_RESOURCE(return_value, lpUserFile, iUserFile);
}
darkone is offline   Reply With Quote
Old 02-03-2004, 09:38 AM   #12
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Some testing, try to guess what it does:
Code:
	$uid = io_user_id('ioFTPD');
	$uhandle = io_user_open($uid);
	$text = io_user_print($uhandle);
	io_user_lock($uhandle);
	io_user_lock($uhandle);

	io_user_close($uhandle);

	$ulist = io_user_list_init();
	while (($id = io_user_list_fetch($ulist)) >= 0) {
		$uname = io_user_name($id);
		echo "User: $uname<br>";
	}
	io_user_list_close($ulist);
darkone is offline   Reply With Quote
Old 02-03-2004, 05:36 PM   #13
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default

lists users?
mr_F_2 is offline   Reply With Quote
Old 02-03-2004, 06:14 PM   #14
NorLan
Senior Member
 
Join Date: Sep 2003
Posts: 110
Default

something like this, i guess mr_f *gg
NorLan is offline   Reply With Quote
Old 02-04-2004, 12:23 AM   #15
darkone
Disabled
FlashFXP Registered User
ioFTPD Administrator
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Find handle is compatible with all fs query/modify functions:

Code:
	$hFind = io_fs_find_first('d:/ioFTPD/site/home/');
	do {
		$fname = io_fs_query_filename($hFind);
		$finfo = io_fs_query($hFind);

		echo "$finfo[0]:$finfo[1] $fname<br>";

	} while (io_fs_find_next($hFind));
	io_fs_find_close($hFind);
darkone is offline   Reply With Quote
Reply

Tags
add, commands, file, handler, php

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 03:51 PM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)