POST vs GET
[1/10] from: john:thousand-hills at: 1-Jul-2001 8:00
I'm kind of new to REBOL and have a question that may seem moronic to this
list.
I wrote a form script that is stunning in its output, compared to what it
looked like from PERL.
The problem is that I can't find any examples of haw to change the .r file
to interact with a
<FORM [ POST ] vs. [ GET ] action.
Hete is the .r code that accepts the GET action:
set-net [[office--thousand-hills--net] MAIL.thousand-hills.tzo.net ]
cgi: make object! decode-cgi system/options/cgi/query-string
What and how -do I change?
John
[2/10] from: gchiu:compkarori at: 4-Jul-2001 8:24
On Sun, 01 Jul 2001 08:00:39 -0500
John <[john--thousand-hills--net]> wrote:
> The problem is that I can't find any examples of haw to
> change the .r file
<<quoted lines omitted: 5>>
> cgi: make object! decode-cgi
> system/options/cgi/query-string
if system/options/cgi/request-method = "GET" [
cgi: make object! decode-cgi
system/options/cgi/query-string
]
if system/options/cgi/request-method = "POST" [
len_post: ( 20 + load system/options/cgi/content-length )
post: make string! len_post
while [0 < read-io system/ports/input post len_post ] []
cgi: make object! decode-cgi post
]
--
Graham Chiu
http://www.compkarori.co.nz/index.r
[3/10] from: office:ky-bible at: 8-Jul-2001 19:38
I'm new to Rebol, but here is a script that works with the html METHOD=GET
method, how should I change it to accept data from a METHOD=POST ?
My reason for changing is the size limit placed upon the data by the GET
method.
/john
set-net [[john--autx--net] MAIL.autx.net]
cgi: make object! decode-cgi system/options/cgi/query-string
write %output.txt reduce [
cgi/name "| "
cgi/ssn "|"
cgi/address "| "
cgi/city "| "
cgi/st "| "
cgi/zip "| "
cgi/phone "| "
cgi/email "| "
]
[4/10] from: syke:amigaextreme at: 9-Jul-2001 23:34
Hi,
try the following:
content-length: 20 + load system/options/cgi/content-length
read-io system/ports/input data: make string! content-length content-length
data: make object! decode-cgi data
/Regards Stefan
[5/10] from: chris:starforge:demon at: 10-Jul-2001 15:05
Stefan Falk wrote:
> Hi,
>
> try the following:
>
> content-length: 20 + load system/options/cgi/content-length
> read-io system/ports/input data: make string! content-length content-length
> data: make object! decode-cgi data
/me slaps his head
So *that's* how you make the buffer the right size! Thanks :))
Chris
[6/10] from: syke:amigaextreme at: 10-Jul-2001 16:25
Hi,
don't thank me, thank whoever told me, unfortunately, I can't remember who
it was. ;)
/Regards Stefan Falk - www.amigaextreme.com
[7/10] from: gchiu:compkarori at: 11-Jul-2001 23:10
On Tue, 10 Jul 2001 16:25:41 +0200
"Stefan Falk" <[syke--amigaextreme--com]> wrote:
> Hi,
> don't thank me, thank whoever told me, unfortunately, I
> can't remember who
> it was. ;)
these things are all documented in the vidwiki site :-)
--
Graham Chiu
[8/10] from: chris:ross-gill at: 11-Jul-2001 9:03
Hi Stefan,
> don't thank me, thank whoever told me, unfortunately, I can't remember
> who it was. ;)
Thought I'd add a little footnote to my original post...
- Chris
--
content-length: 20 + load system/options/cgi/content-length
; content length with a little to spare
post-data: make string! content-length
read-io system/ports/input post-data content-length
--
The value 20 was an arbitrary selection that gives some space for
url-encoded characters (or something, can't quite remember) - which
makes the post data longer than the content length. Depending on how
many of these you expect, you may want to make that number higher.
[9/10] from: g:santilli:tiscalinet:it at: 12-Jul-2001 21:31
Hello Christopher!
On 11-Lug-01, you wrote:
CR> The value 20 was an arbitrary selection that gives some space
CR> for url-encoded characters (or something, can't quite
CR> remember) - which makes the post data longer than the content
CR> length. Depending on how many of these you expect, you may
CR> want to make that number higher.
Actually, a User-Agent posting data with a Content-Length
different than the actual message's length is simply buggy. The
server won't be able to respond to the request if the specified
Content-Length is greater than the actual one, and could lose the
extra data if it is lesser.
Regards,
Gabriele.
--
Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[10/10] from: john:thousand-hills at: 8-Jul-2001 19:40
I'm new to Rebol, but here is a script that works with the html METHOD=GET
method, how should I change it to accept data from a METHOD=POST ?
My reason for changing is the size limit placed upon the data by the GET
method.
/john
set-net [[john--autx--net] MAIL.autx.net]
cgi: make object! decode-cgi system/options/cgi/query-string
write %output.txt reduce [
cgi/name "| "
cgi/ssn "|"
cgi/address "| "
cgi/city "| "
cgi/st "| "
cgi/zip "| "
cgi/phone "| "
cgi/email "| "
]
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted