Jump to content



Photo

Au3 FastCGI - AuCGI, but faster. ( Generate WebPages behind any WebServer )


  • Please log in to reply
2 replies to this topic

#1 arcker

arcker

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 556 posts

Posted 20 April 2012 - 01:28 PM

Au3_FastCGI

Arck System.
Version 0.1 Beta

alpha version ( proof of concept ).
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/

Features :

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 )
For now, this udf lets you make webservers in autoit with easy integration. By detaching webserver and fastcgi, you can easily update your webserver.
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


LIMITATIONS
  • 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 )

DOWNLOAD

http://www.2shared.com/file/UmS1x9Hv/FastCGI.html

Edited by arcker, 26 April 2012 - 01:27 PM.

-- Arck System _ Soon --Ideas make everything"La critique est facile, l'art est difficile"Projects :Au3Service = Run your exe as service / Updated 27/05/2011 Get it Here







#2 davidkim

davidkim

    Adventurer

  • Active Members
  • PipPip
  • 100 posts

Posted 25 April 2012 - 03:33 AM

#include "F:AuCGIhtdocsindex.au3"
#include "F:AuCGIhtdocsRequest_data.au3"
#include "F:AuCGIhtdocsGet_results.au3"
#include "F:AuCGIhtdocsindex_test.au3"
4 file where?
I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript] Korea of cafe(blog) to be operating, English cannot well.Many help it requests.To read, it stands it thanks.

#3 arcker

arcker

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 556 posts

Posted 25 April 2012 - 05:40 PM

#include "F:AuCGIhtdocsindex.au3"
#include "F:AuCGIhtdocsRequest_data.au3"
#include "F:AuCGIhtdocsGet_results.au3"
#include "F:AuCGIhtdocsindex_test.au3"
4 file where?


Don't use au3_fastcgi_server, prefer use au3_fastcgi_lite.au3

you can remove those, they are other test pages ;)
will post update asap.

Edited by arcker, 25 April 2012 - 05:46 PM.

-- Arck System _ Soon --Ideas make everything"La critique est facile, l'art est difficile"Projects :Au3Service = Run your exe as service / Updated 27/05/2011 Get it Here




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users