Newbi CGI question
[1/3] from: kpeters-vu::ware::com at: 4-Mar-2006 18:16
Hi all ~
Carl Sassenrath uses the following construct in his CG tutorial
Creating and Processing Web Forms with CGI
:
switch system/options/cgi/request-method [
"POST" [
data: make string! 1020
buffer: make string! 16380
while [positive? read-io system/ports/input buffer 16380][
append data buffer
clear buffer
]
]
"GET" [data: system/options/cgi/query-string]
]
data
Goldman & Blanton simply use 'input to retrieve POSTed data
switch system/options/cgi/request-method [
"POST" [data: input ]
] [
"GET" [data: system/options/cgi/query-string]
]
data
]
I am sure that Carl will have his reason for doing things the way he does -
so my question is: Why would he choose the markedly more complex way
of doing things in this case?
Thanks for shedding some light on this,
Kai
[2/3] from: compkarori:gmai:l at: 5-Mar-2006 5:38
I think you'll find that the second method will lose data on large posts.
The data lost is dependent upon the OS.
On 3/5/06, Kai Peters <kpeters-vu-ware.com> wrote:
> Hi all ~
> Carl Sassenrath uses the following construct in his CG tutorial
<<quoted lines omitted: 19>>
> data
> ]
--
Graham Chiu
http://www.compkarori.com/emr/
[3/3] from: gabriele::colellachiara::com at: 5-Mar-2006 14:03
Hi Kai,
On Sunday, March 5, 2006, 3:16:23 AM, you wrote:
KP> switch system/options/cgi/request-method [
KP> "POST" [data: input ]
This does not account for binary input data; also, input will give
you only one line of text, so it wouldn't work in many cases.
It should be noted that it is possible to avoid using READ-IO by
setting the input port to binary mode and using COPY/PART with the
expected input length (from Content-Length, maybe capped to a
reasonable maximum).
Regards,
Gabriele.
--
Gabriele Santilli <gabriele-rebol.com> --- http://www.rebol.com/
Colella Chiara software division --- http://www.colellachiara.com/
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted