Brad Stone wrote:
BTW, there's no reason your program shouldn't be able to
handle
either a GET or POST request.  I believe API QzhbCGIParse
doesn't
care which method is used.
CGIParse does care...  to "Easliy" read from a POST you have
to use the -init command string, then put the data to the
Query string EV, then use -value for each paramter.

It's pretty simple, but it does care.  :)
I stand corrected!  ;-)

Actually, almost all of my CGI experience has been in languages
other than RPG, where the available tools make CGI programming much
easier, so perhaps I've been spoiled by those other languages.
(Also, I've been having some trouble finding the documentation for
the QzhbCGIParse API!)

For example, in a Python CGI program, the statement:
"form=cgi.FieldStorage()" gets the variables passed in, and does so
regardless of the HTTP request method.  In Zope (a Python based web
server), things can be even easier.  The query string arguments can
be passed directly as parameters to a Python function, and the
function doesn't even have to know it's being called from an HTTP
request!

Likewise, using the CGI module in Perl, the parameters are accessed
by the "param()" method, regardless of the HTTP request method.

Java isn't quite as easy, but even there, the parameters are passed
in to the doGet() and doPost() methods as part of the ServletRequest
object passed in.  The Java Servlet programmer doesn't have to worry
about how the parameters are parsed.

Anyways, my point is simply that the CGI programmer should not have
to worry about the low-level details of the request.  The CGI
programmer should have straight-forward and robust API's at his/her
disposal that take care of the nitpicky details.

I won't repeat my tired old story of taking a 400 line RPG-CGI
program and rewriting it into 200 lines of Python code.

But I'll just add one story illustrating why it can be useful to use
appropriate tools when programming a CGI app.  There's one on-line
forum I visit where you can tailor the topics you're interested in.
Previously, a POST request took you from the topic selection page to
the list of current discussions involving the topics you're
interested in.  I suggested to the web-master that he change the
form to use a GET request instead, which would allow the active
discussion page to be bookmarked, thus allowing the visitor to
bypass the selection page. All he had to change was the form - the
CGI app was robust enough to handle the different HTTP request
without change.  (I don't know what language he was using, probably
Perl.)

Cheers!  Hans





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.