[REBOL] Re: Decode-CGI
From: andreas:bolka:gmx at: 4-Jun-2002 23:03
Monday, June 3, 2002, 7:26:57 PM, Will wrote:
> I get this error using your patch:
[...]
strange set-word! handling differences betweend 2.5.0 and 2.5.2 -
appended version is working with 2.5.0 and 2.5.2.
--- snip ---
decode-cgi: func [
{Converts CGI argument string to a list of words and value strings.}
args [any-string!] "Starts at first argument word"
/local list equate value name name-chars val plus-to-space
] [
add-nv: func [ list name value /local val-ptr ] [
value: either none? value
[ copy "" ]
[ form dehex (replace/all value "+" " ") ]
either none? val-ptr: find list to-set-word name [
append list compose [ (to-set-word name) (value) ]
] [
idx: index? next val-ptr
poke list idx compose [ (pick list idx) (value) ]
]
]
list: make block! 8
name-chars: complement charset "&="
equate: [ copy name some name-chars value ]
value: [ "=" value
| "&" (add-nv list name "")
| [copy val to "&" "&" | copy val to end]
(add-nv list name val)
]
parse/all args [ some equate | none ]
list
]
--- snap ---
--
Best regards,
Andreas mailto:[andreas--bolka--gmx--net]