> I've got a minimal configuration form/cgi that I would like to test > before posting for weblet. It works via Apache on my local webserver, > however I have been unable to get the sh-httpd POST patch to work. > > I've figured I could simply use the GET method to work, however I have > been unable to figure out how to parse the $QUERY_STRING into a > read-able set of variables (replace the "&"'s with "/n"'s). I've also > tried to use "uncgi" with it, but "uncgi" does not work with sh-httpd > (it attemps only the literal path instead of "/binary/option"). > > Does anyone have a sed or cut script to parse $QUERY_STRING into > something friendlier to a sh cgi?
No sed or cut script...sorry. I think you're making this whole thing too hard. Just do something like: qs2env () { local IFS='&' set -- $QUERY_STRING while [ "$1" ] ; do eval "$1" shift done } If you want to assign all the form values to local variables. *WARNING* This presents a potentially BIG security hole, since we're eval'ing data sent from a client, so there should be something else in place that only allows the code above to run if the rest of the query looks "kosher" (see sh-httpd for examples of checking variables for escape characters). Checking for [0-9a-zA-Z=&] only should keep things safe. NOTE: You may need to save/restore IFS if you make changes to the above procedure...the "local" keeps IFS from being mucked up in your main script. There are lots of other ways to parse QUERY_STRING, but I'd stick with the shell built-ins (set, ${#} and ${%} expansions, etc)...they'll be lots faster than using an external program like sed. Charles Steinkuehler http://lrp.steinkuehler.net http://c0wz.steinkuehler.net (lrp.c0wz.com mirror) ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Leaf-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/leaf-devel