Hi Alexander! Your uploadconfig.cgi looks interesting, some months ago I also tried to handle form-based uploads in shell script, but felt it was too tricky and unstable. What if another browser sends more headers? Why read the uploaded file several times for line counting, head and tail operations? and so forth.
[OT] I use httpd (currently BB 1.5.1) on a mipsel platform (embedded router system) in combination with Haserl (http://haserl.sourceforge.net/) as a CGI handler and am very satisfied. Maybe this is an option to be considered for you, too. The latest Haserl release 0.9.18 comes with an interesting new option which has been incorporated by the author upon my request: The upload is not stored as a temp-file, but written into a pipe (FIFO). A handler for reading the FIFO is called asynchronously, so a shell script can extract a tar archive on the fly, for example. This is an advantage on platforms with limited memory if you want to avoid double memory consumption (archive plus extracted content). And the best thing is that the upload is read once and only once. Haserl is lean and the very simple template mechanism integrates beautifully in shell scripts (or Lua scripts, if you prefer). BTW: No, I don't get money for promoting Haserl, I am just a satisfied user. ;-) [/OT] Back to your shell script: I think it would be better to develop a version which reads the content length header and then acts accordingly, not reading linewise, but bytewise, even though in your case you always seem to upload text files or maybe base64-encoded binaries. But don't forget that binary uploads are also allowed. So if you want a more general solution, you might have to improve your script considerably. Best regards -- Alexander Kriegisch _______________________________________________ busybox mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/busybox
