Version 0.1 Beta
Version 0.1 Beta *
What is it ?
Au3 FastCGI is a CGI handler that will run constantly to get request from webservers
The process will send back html code to the webserver.
It’s the same as php or other language that acts as cgi.
FastCGI is powerful since CGI spawn a process on each request. FastCGI works with TCP connection, so it’s always started to handle request.
Some reads : http://www.fastcgi.com/drupal/
This udf enables FastCGI to be used with autoit.
FastCGI is used by a lot of webservers ( mainly to use php ) to call functions written in other languages. Its main purpose is too use sockets on existants processes instead of stdios to send/receive result and spawn process.
With is, you can spawn your fastcgi “listener” then let it run. A service is in preparation to do so.
You can use any webserver that support FastCGI. Lighttp, apache, and more, make a total third part architecture. The webserver with your firewall can run in linux and Au3_fastcgi_Server can run on a dedicated server.
Multiple instances can run, so many processes can run, to avoid contention and make a bigger webserver.
This UDF uses
- TCP_Event by kip to boost performances. ( avoid loop )
- Bininbinary by ward to fastcheck only needed informations. ( avoid uses of multiple structure, can gain 1-2 ms ) ( will be in proper version ) ( not used in FastCGI_Lite )
I’ve attached a script that you rerun your script in scite to test. Simply right-click on autoit icon when running, then click restart, and it will close and tells cite to reload it. Be careful, scite will run active tab.
To use it, you have to think this way :
The main process will handle all of your process code. You have to let the engine function, then add your functions to test it.
When you call http://localhost/test.au3, the script will call “test” function.
If the function doesn’t exists, a custom 404 error is thrown. For now, you can’t set subpages ( like /somepages/test/index.au3 ) only “root” can be called.
The Fast CGI Lite script is my paperboard. You can execute it and test some pages, but it will changed often in the future. Please test your script in an external file.
HOW TO RUN
- First of all, start the ServerControl.exe, then click start, and reduces it if everything ok. If another process is listening to port 80, close it, or change port in ligttpd config files.
- Open Au3_FastCGI_Lite.au3 in Scite and run it
- Open your favorite webbrower and type http://localhost/index.au3
- You should see a 404 custom page
- Now go to http://localhost/_all.au3
TO DO LIST
- Add SubPages Support
- Add GZip support ( should be on lighttp size, don’t know)
- Add ability to send/receive files and process them
- Add Multiple process example
- Add Session ID or something like that
- Benchmark TCP Event <> TCP Loop
- Your code must contain engine code.
- All of your pages must be functions ( for now, I plan to make something different with an array soon )
- All au3 code must be added in. You can btw use external files to make more. AutoIt can’t compile code on the fly (as php does ), so your “listener” must be fully stopped and restarted to test changes.
- Doesn’t support session id ( for now )
Edited by arcker, 26 April 2012 - 01:27 PM.