[Gambas-user] Embeded HTTP server

Adrien Prokopowicz adrien.prokopowicz at ...626...
Fri Sep 28 00:54:04 CEST 2012


Wow, that sounds great ! Thanks Benoît ! :-)
I will try it out right now, and see what I can already do with that.
Just one little question : as you say that the interpreter makes many
initializations, is the project (and all its data, and maybe
translation files) loaded as well ? This can affect a lot the execution
time.

I will see if apache can redirect the HTTP request to the interpreter,
so that Apache will handle serving static files (CSS/JS/Images ...) and
rewrite some URLs. It could be a workaround until the gb.httpd server
can handle all that.

I don't think I will sleep a lot tonight !

Regards,
Adrien.


Le Thu, 27 Sep 2012 23:51:11 +0200,
Benoît Minisini <gambas at ...1...> a écrit :

> Hi,
> 
> In revision #5209, I have added an experimental new feature to the 
> interpreter, which is an... embedded HTTP server.
> 
> At the moment, you can only use it from the command line.
> 
> By running the interpreter with the '-H' option, the current project
> is run as a CGI script from an embedded HTTP server.
> 
> In other words, provided that your application is a CGI script,
> running it with the '-H' option transforms it into a running local
> web site.
> 
> For example:
> 
> $ cd /path/to/my/cgi/script/project
> $ GB_HTTPD_PORT=8000 gbx3 -H
> ...
> [Hit ^C to stop it]
> $
> 
> Note the GB_HTTPD_PORT environmental variable that is needed,
> otherwise the embedded HTTP server will try the port 80, which is
> reserved to root.
> 
> How does it work? "gbx3 -H" will just run the embedded HTTP server,
> and when a request arrives, it will fork and run the Gambas
> interpreter normally. As many initialization have already been done
> by the HTTP server (all components have been loaded), the CGI script
> should run faster than when it is run from a normal HTTP server like
> Apache.
> 
> Another variable is GB_HTTPD_TIMEOUT, which is how many seconds a CGI 
> script can run before being killed by the HTTP server.
> 
> I made that feature so that we will be able to debug web application 
> directly from the IDE. Actually I don't know if this is possible. I 
> mean: running a CGI script step by step like a normal program while
> the HTTP server is running and serving other HTTP request from the
> same CGI script!
> 
> Anyway, even if it is not possible at the moment, that feature will 
> allow to run a Gambas project as a full standalone http server
> serving a complete website.
> 
> I hope some of you will find that interesting. :-)
> 
> Regards,
> 





More information about the User mailing list