Some tidbits on revHTTPd and LibCGI 1.0

Andre Garzia soapdog at mac.com
Mon Jan 26 20:00:46 EST 2004


On Jan 26, 2004, at 8:27 PM, rodney tamblyn wrote:

> Monte Guilding and I are pleased to announce the availability of our 
> LibCGI package, as demonstrated by Jacqueline at the Revolution 
> conference recently.  We are releasing this to the Revolution 
> community as freeware.


Rodney and Monte,

Congratulations on your marvelous stack!!!! It's really quick and easy 
to use libCGI. Since I am doing similar job in revHTTPd, I want express 
how impressed I was when I inspected your code today. It's so simple 
and so powerfull, I really think that if one is considering a CGI 
solution that LibCGI can be used!

I am very happy to be able to learn from your code, after seeing how 
you both handled some issues that where troubling my mind I decided to 
patch revHTTPd (third major rewrite), I'll sumarize the changes below.

* New ways to access server data.
In previous version, revHTTPd would match field names to the field 
names acquired from POST or GET Methods, thus if you used a form with a 
field named email or a url like 
http://yourhost/yourStack?email=soapdog@mac.com it would get the email 
value and fill the email field of the desired stack with it. Now you 
also have the option to access it in a nice global array called gDataA 
(This is inspired by LibCGI, thats how it handles), this way, you can 
access non expected fields and also you will be able to access the data 
without creating fields for everything.

* Cookies!
After seeing the code from libCGI, I finally understood how HTTP 
handles cookies (it's not covered with HTTP Made Easy - my main 
learning book), so I put cookie support with a function called 
"http_flush_with_cookies" that will flush a response and also set 
cookies based on a array parameter. The current browser cookies will be 
inside gDataA array.

* New packaging! :D
revHTTPd was first a stack, then a button, now... now it still a 
button, but since I learned much from message primer by Mr Dar Scott 
and from message path article at Fourth World Embassy, I figured out 
that inserting button "httpd" into back would be very good, this way we 
can guarantee that it always receive the message and that the handlers 
are available everywhere.

* Brand new and improved and over-powerfull template engine.
We created Inform2, our new template engine. This is a frontscript that 
overdrive normal http_flush, this way, besides the normal template tags 
%BODY%, %STACKNAME%, %TITLE%, we've got some ubercool tags like:
	
	Inform-field tag: This one will insert a field from any card or stack, 
to be used like [inform-field: passwordField stack: User Database card: 
andre garzia] this would insert the content of field "passwordField" of 
card "andre garzia" of stack "User Database". You can omit the card: 
parameter and it will act on current card.

	Inform-property tag: the same as above but insert a custom property. 
Used like [inform-property: cHits stack: serverworkz card: 1] where 
card parameter is optional.

	Inform-throw tag: will send a message thru message path, like 
[inform-throw: closeStack stack: about], when inform2 engine find this 
tag it sends a message, this is good for using static html to send 
messages and stuff. For example, inform-field is proccessed before 
inform-throw, so you can make voodoo things like [inform-throw: 
[inform-field: messageField stack: messageSelector] stack: 
messageDestination], can you guess what this one will do... that's 
evil!!! :D

	Must say that it was after seeing WebMerge from Fourth World that I 
thought of custom tags thru Regular Expressions, I thought: "They did 
that with metacard, so there must be a way". After couple minutes 
search I found matchText command and a primer on Regular Expressions on 
the net.


This code will be released as freeware too at the end of the week for 
we're still working on this:

* Session management.
Automatic session management thru cookies. (in test, currently not 
working well...)

* Compatibility layer for LibCGI.
This is to be able to serve libCGI stacks using revHTTPd server. It 
should be easy, but it's not done yet.

The server will come bundled with the framework source code and some 
demos of creative ways to use it. The current demos are:

* Chat app - A full featured, revZeroConf enabled chat app for two 
persons to talk to each other. 80% of the code are windowshape stuff 
and ZeroConf code! :D

* PayPal IPN + Authorized Download Stack - This is huge, it's a server 
that conforms to a PayPal Instant Payment Notification CGI (more info 
at http://www.paypal.com/pdn), this way when someone buy something from 
you thru paypal system, your stack/server will get notified, it will 
store buyer email in a database and when buyer access the server it 
will allow/forbid his access to downloads. The only current issue is 
the lack of SSL. For using in a secure enviroment SSL is needed. But 
new Rev version will settle that.

* Tribe, simple blog system - simple blog server app, it will manage 
and serve a blog.

* revPasteboard - networked pasteboard for the masses.


This are the demos in production, they will show creative and simple 
ways to use revHTTPd to power the network functions of your app. 
Everything should be ready by the end of the week. While the release 
date does not come, you can help me stress test the server,  it's 
running in my home machine at http://home.soapdog.org:8081/  it's a 
256k cable modem full of firewalls placed from my ISP, so it's a bit 
slow sometimes. Come take a look and send me mail if you like it.

Cheers

-- 
Andre Alves Garzia ð 2004 ð BRAZIL
http://studio.soapdog.org



More information about the use-livecode mailing list