Again, troubles with uploading files using busybox httpd

Alexander Griesser alexander.griesser at lkh-vil.or.at
Thu Aug 9 13:12:54 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Kriegisch wrote:
> 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?

Well, I never thought about that, as Mozilla and IE6/7 worked with it.

> Why read the uploaded file several times for line counting,
> head and tail operations?

Because I had no other idea about how to do that without investing much
time into it.

> 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.

Will have a look at it, but doesn't haserl only read what it gets from
busybox httpd?
To me it seems as if the upload never finishes because of a bug in httpd
and although using haserl and pipes and whatsoever, wouldn't that wait
for the end of the stream too?

> The upload is not stored as a temp-file, but written into a pipe (FIFO).

Not really a necessity for me currently, but it sounds great.

> Haserl is lean and the very simple template mechanism integrates
> beautifully in shell scripts (or Lua scripts, if you prefer).

Unfortunately, there are no examples on the website, but I'll try to
build a demo script with haserl just to see how it fairs.

> 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,

Well, that was what came to my mind at first after recognizing that the
upload of the file works, but afterwards the read() doesn't finish.
Reading only n bytes of data would - of course - work around this
problem, but mentioning the bug is worth it, because it was fixed some
releases ago (as stated in my first mail) and has now somehow been
reintroduced.

> 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.

I once had an "upload firmware" button too which uploaded base64
converted firmware files, but wasn't satisfied with this solution as
the resulting converted files were at least twice as big as the
original file :-/

So maybe the use of haserl will reintroduce firmware uploads as well ;)

Thanks for the hint so far,
will see what I can accomplish.

ciao,
- --
Alexander Griesser (Netzwerkadministration)
E-Mail: alexander.griesser at lkh-vil.or.at | Web: http://www.lkh-vil.or.at
KABEG LKH Villach | Nikolaigasse 43 | 9500 Villach
Tel.:   +43 4242 208 3061 | Fax.:   +43 4242 971 3061
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGuxLW66HVD6KUm1oRAmARAJ47lcf7VfE8FXNqyxOUiGVNkBH2gACeJfdE
pAvty+SHejydI7wl2PV/DCA=
=nwYv
-----END PGP SIGNATURE-----



More information about the busybox mailing list