[REBOL] Getting empty Post data
From: sags:apollo:lv at: 21-Dec-2004 23:26
Hi, List!
Beginner question:
Why following script function by Mike Yaunish gives different
output on different webservers:
input-cgi: func [/stdin] [
stdin: make string! 15000
either system/options/cgi/request-method = "POST" [
read-io system/ports/input stdin 15000
return stdin
][
system/options/cgi/query-string
]
]
On some servers this function returns false or none on empty Post
data, but on others String: "" . So normaly I can't use this
function in simple If or Either.
So I rewrited the function:
input-cgi: func [/stdin] [
data: make string! 15000
either system/options/cgi/request-method = "POST" [
read-io system/ports/input data 15000
outdata: data
][
outdata: system/options/cgi/query-string
]
either outdata [
either ( string! = type? outdata ) and ( empty? outdata ) [
return false
][
return outdata
]
][
return false
]
]
Are there some better ways?
brgds
Janeks