Hi Hallvard;

this one work on your url, it also has some enhancement
most preferred is ability to set a: "" when http://dom.com?a

I'm not sure who is the author but thanks, and shouldn't this version  
replace
rebol's one?

Hope that helps and have a great day!

Will Arp
[EMAIL PROTECTED]

;core 2.6 decode-cgi do not accept "a" only "a=" or "a&"
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 add-nv
] [
     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
]




On 9-feb-04, at 23:07, Hallvard Ystad wrote:

>
> Hi
>
> I know some people say "garbage in - garbage out", but one can't  
> always control what comes into one's programs as input. Here's what  
> came to one of mine:
>
> http://www.bbc.co.uk/cgi-perl/h2/h2.cgi? 
> state=threads&board=cult.tamaraswift&&sort=T
>
> This crashes 'decode-cgi in /core 2.5.6:
>>> decode-cgi "state=threads&board=cult.tamaraswift&&sort=T"
> ** Script Error: Out of range or past end
> ** Where: to-set-word
> ** Near: to set-word! :value
>>>
>
> I believe Andreas Bolka and/or Andrew Martin made a patch to  
> 'decode-cgi some time back, but can't seem to find it. Does anyone  
> know whether the patch fixes this problem? Or perhaps where I can find  
> it?
>
> Thanks,
> HY
>
> Prętera censeo Carthaginem esse delendam
>
>
> -- 
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to