Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: decode-cgi bug (?)

From: andreas:bolka:gmx at: 10-Feb-2004 0:50

Monday, February 9, 2004, 11:07:27 PM, Hallvard wrote:
> 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
thanks for reporting that, hallvard! i've extended my patched version of decode-cgi to cope with that as well:
>> decode-cgi "state=threads&board=cult.tamaraswift&&sort=T"
== [state: "threads" board: "cult.tamaraswift" sort: "T"] -- 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 nv-pair value name name-chars val ][ add-nv: func [ list name value /local val-ptr ] [ if none? name [ return ] value: dehex replace/all any [ value (copy "") ] "+" " " either val-ptr: find list to-set-word name [ change/only next val-ptr compose [ (first next val-ptr) (value) ] ] [ append list compose [ (to-set-word name) (value) ] ] ] list: make block! 8 name-chars: complement charset "&=" nv-pair: [ copy name some name-chars value (add-nv list name val) | "&" ] value: [ "=" value | "&" | [ copy val to "&" skip | copy val to end ] ] parse/all args [ some nv-pair | none ] list ] -- snap -- if someone wants to submit it to the view 1.3 effort, do not hesitate to do so. -- Best regards, Andreas