Classic CGI questions

Andre Garzia andre at andregarzia.com
Fri May 13 16:17:23 EDT 2011


Malte and Mark,

There is a great chance that there won't be a $CONTENT_LENGHT variable, the
variables I've seen are usually:

DOCUMENT_ROOT The root directory of your server
HTTP_COOKIE The visitor's cookie, if one is set
HTTP_HOST The hostname of the page being attempted
HTTP_REFERER The URL of the page that called your program
HTTP_USER_AGENT The browser type of the visitor
HTTPS "on" if the program is being called through a secure server
PATH The system path your server is running under
QUERY_STRING The query string (see GET, below)
REMOTE_ADDR The IP address of the visitor
REMOTE_HOST The hostname of the visitor (if your server has
reverse-name-lookups on; otherwise this is the IP address again)
REMOTE_PORT The port the visitor is connected to on the web server
REMOTE_USER The visitor's username (for .htaccess-protected pages)
REQUEST_METHOD GET or POST
REQUEST_URI The interpreted pathname of the requested document or CGI
(relative to the document root)
SCRIPT_FILENAME The full pathname of the current CGI
SCRIPT_NAME The interpreted pathname of the current CGI (relative to the
document root)
SERVER_ADMIN The email address for your server's webmaster
SERVER_NAME Your server's fully qualified domain name (e.g. www.cgi101.com)
SERVER_PORT The port number your server is listening on
SERVER_SOFTWARE The server software you're using (e.g. Apache 1.3)


Malte grab the RevOnRockets package from my website and look into
RocketsCGI.rev, there you will see code to do all those kind of stuff. Don't
search for that in HTTPd.Rev that is the server, it does things differently,
you need to look into the rockets cgi library. There is code there to handle
POST. There is also libcgi.rev in there that can also handle POSTs and might
be easier to read. (my code is messy and old, libcgi is old but tight)

On Fri, May 13, 2011 at 5:14 AM, Mark Schonewille <
m.schonewille at economy-x-talk.com> wrote:

> Hi Malte,
>
> > Can I on the CGI side see the HTTP Headers I have set in the LC Client?
>
> Yes, somehow. Try the environment variables perhaps? Check the globalnames.
> The CGI system I use keeps the most important headers in separate
> environment variables. I'm unable to get the complete headers at once. PHP
> would let you do that ;-)
>
> > Can I find out how long the content being posted is?
>
> Yes, in the headers or try $CONTENT_LENGTH
>
> > What is the most reliable method to read in POST data without hogging
> 100% CPU time on the server machine?
>
> Huh? AFAIK there is only one way:
>
> read from stdIn until empty
> read from stdIn until cr
> read from stdIn for 100
>
> Perhaps the hogging is not due to reading the data. Could it be a problem
> with not being able to show the interface?
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
>
> New: Download the Installer Maker Plugin 1.6 for LiveCode here
> http://qery.us/ce
>
> On 13 mei 2011, at 16:36, Malte Brill wrote:
>
> >
> > Hi all,
> >
> > as I did not do too many CGIs in the past, I´d like to reassure myself to
> find reliable methods of reading in post data.
> >
> > Why CGI and not revServer? - Need to deploy on a windows server (server
> 2003 running Apache)
> >
> > I am posting data from a LiveCode Client to a Rev 3.5 CGI
> >
> > Questions:
> >
> > Can I on the CGI side see the HTTP Headers I have set in the LC Client?
> > Can I find out how long the content being posted is?
> > What is the most reliable method to read in POST data without hogging
> 100% CPU time on the server machine?
> >
> > Thanks in advance,
> >
> > Malte
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list