FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 06-13-2008, 07:03 PM
ccostin
 
Default CGI scripts and Busybox

Hello

What is the minimal configuration for httpd.conf required by busybox
httpd to run simple CGI scripts ?
For this are necessary any special environment exported variables ?

When I try to load simple bourne shell scripts, Iceweasel ask me to
save them on disk.

Command line for busybox is
busybox httpd -h /var/www/
and shell scripts are contained in /var/www/cgi-bin/, and have a+x
execution bits.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 06-13-2008, 07:28 PM
Nyizsnyik Ferenc
 
Default CGI scripts and Busybox

On Fri, 13 Jun 2008 22:03:58 +0300
ccostin <ccostin.dmu@gmail.com> wrote:

> Hello
>
> What is the minimal configuration for httpd.conf required by busybox
> httpd to run simple CGI scripts ?
> For this are necessary any special environment exported variables ?
>
> When I try to load simple bourne shell scripts, Iceweasel ask me to
> save them on disk.
>
> Command line for busybox is
> busybox httpd -h /var/www/
> and shell scripts are contained in /var/www/cgi-bin/, and have a+x
> execution bits.
>

Sounds like a problem with the content-type. Make sure you set it to
text/html, like the following simple script:

#!/usr/bin/bash
echo -e "Content-type: text/html

";
echo -e "Hello world.
";

--
Nyizsa.
http://nyizsa.uni.cc

----------------------------------------------------------------------
Get a free email address with REAL anti-spam protection.
http://www.bluebottle.com/tag/1


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 06-14-2008, 02:32 PM
Tzafrir Cohen
 
Default CGI scripts and Busybox

On Fri, Jun 13, 2008 at 09:28:02PM +0200, Nyizsnyik Ferenc wrote:
> On Fri, 13 Jun 2008 22:03:58 +0300
> ccostin <ccostin.dmu@gmail.com> wrote:
>
> > Hello
> >
> > What is the minimal configuration for httpd.conf required by busybox
> > httpd to run simple CGI scripts ?

I believe that busybox in Etch does not support it yet.

Generally busybox is a rather slow-moving package, due to its usage in
the installer. Consider downloading it from source and rebuilding. It's
a single binary.

> > For this are necessary any special environment exported variables ?
> >
> > When I try to load simple bourne shell scripts, Iceweasel ask me to
> > save them on disk.
> >
> > Command line for busybox is
> > busybox httpd -h /var/www/
> > and shell scripts are contained in /var/www/cgi-bin/, and have a+x
> > execution bits.
> >
>
> Sounds like a problem with the content-type. Make sure you set it to
> text/html, like the following simple script:
>
> #!/usr/bin/bash

/bin/bash fir a script? I figure busybox ash would be faster (and may
even save you time on for/exec, as it's the same binary).

shell scripts may be useful for trivial CGI scripts. But for anything
more complicated they become rather slow. And I really don't trust them
to handle input correctly.

The busybox "tiny unitities" page recommends microperl and lua.
microperl requires rebuilding perl. The result, though, is a more
limited perl variant, but also considerbly smaller (e.g: 1MB vs. 5MB)
and hence faster to load and requires less memory.

> echo -e "Content-type: text/html

";
> echo -e "Hello world.
";

We all love benchmarks, right? I ran the following with:

bash 3.2-4
busybox 1:1.10.2-1
dash 0.5.4-9
pdksh 5.2.14-23
posh 0.6.8
zsh 4.3.6-4
coreutils 6.10-6 (for shells with no built-in 'echo')
lua40 4.0-13
lua50 5.0.3-3
perl 5.10.0-10
python2.4 2.4.5-2
python2.5 2.5.2-6
ruby1.8 1.8.7-2



I ran the following several times for each shell, and the one I provide
here is a "typical" run. There wasn't great variance anyway.

bash:
$ time (for i in `seq 1000`; do bash -c 'echo -e "Content-type: text/html

"; echo -e "Hello world.
"'; done >/dev/null)

real 0m3.220s
user 0m1.328s
sys 0m2.036s

dash:
$ time (for i in `seq 1000`; do dash -c 'echo -e "Content-type: text/html

"; echo -e "Hello world.
"'; done >/dev/null)

real 0m1.242s
user 0m0.456s
sys 0m0.932s

posh:
$ time (for i in `seq 1000`; do posh -c 'echo -e "Content-type: text/html

"; echo -e "Hello world.
"'; done >/dev/null)

real 0m1.378s
user 0m0.536s
sys 0m0.916s

$ time (for i in `seq 1000`; do pdksh -c 'echo -e "Content-type: text/html

"; echo -e "Hello world.
"'; done >/dev/null)

real 0m1.456s
user 0m0.664s
sys 0m0.908s

zsh:
$ time (for i in `seq 1000`; do zsh -c 'echo -e "Content-type: text/html

"; echo -e "Hello world.
"'; done >/dev/null)

real 0m3.892s
user 0m1.760s
sys 0m2.308s


busybox ash:
$ time (for i in `seq 1000`; do busybox ash -c 'echo -e "Content-type: text/html

"; echo -e "Hello world.
"'; done >/dev/null)

reel 0m1.390s
user 0m0.496s
sys 0m1.108s

rc:
$ time (for i in `seq 1000`; do rc -c 'echo -e "Content-type: text/html

"; echo -e "Hello world.
"'; done >/dev/null)

real 0m1.870s
user 0m0.808s
sys 0m1.188s


So larger shells take much more time to load. They make up to this if
you actually use their built-in abilities wisely to save processing with
external utilities.

But is it worth it?

So let's check some other languages:

perl:
$ time (for i in `seq 1000`; do perl -e 'print "Content-type: text/html

"; print "Hello world.
"'; done >/dev/null)

real 0m2.788s
user 0m1.200s
sys 0m1.708s

perl, loading the module CGI:
$ time (for i in `seq 1000`; do perl -MCGI -e 'print "Content-type: text/html

"; print "Hello world.
"'; done >/dev/null)

real 0m29.725s
user 0m25.350s
sys 0m4.616s

lua40:
$ time (for i in `seq 1000`; do lua40 -e 'print "Content-type: text/html

"; print "Hello world.
"'; done >/dev/null)

real 0m1.595s
user 0m0.588s
sys 0m1.112s

lua50:
$ time (for i in `seq 1000`; do lua50 -e 'print "Content-type: text/html

"; print "Hello world.
"'; done >/dev/null)

real 0m2.244s
user 0m0.996s
sys 0m1.332s

ruby:
$ time (for i in `seq 1000`; do ruby1.8 -e 'print "Content-type: text/html

"; print "Hello world.
"'; done >/dev/null)

real 0m5.979s
user 0m3.976s
sys 0m2.212s

python2.4:
$ time (for i in `seq 1000`; do python2.4 -c 'print "Content-type: text/html

"; print "Hello world.
"'; done >/dev/null)

real 0m12.668s
user 0m8.245s
sys 0m4.664s

python2.5:
$ time (for i in `seq 1000`; do python2.5 -c 'print "Content-type: text/html

"; print "Hello world.
"'; done >/dev/null)

real 0m14.134s
user 0m9.609s
sys 0m4.720s


Note that this is a very minimal script. If it got more complicated,
"smarter" interpeters would start showing their abilities.

--
Tzafrir Cohen | tzafrir@jabber.org | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir@cohens.org.il | | best
ICQ# 16849754 | | friend


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 06-14-2008, 06:24 PM
Nyizsnyik Ferenc
 
Default CGI scripts and Busybox

On Sat, 14 Jun 2008 14:32:19 +0000
Tzafrir Cohen <tzafrir@cohens.org.il> wrote:

> On Fri, Jun 13, 2008 at 09:28:02PM +0200, Nyizsnyik Ferenc wrote:
> > On Fri, 13 Jun 2008 22:03:58 +0300
> > ccostin <ccostin.dmu@gmail.com> wrote:
> >
> > > Hello
> > >
> > > What is the minimal configuration for httpd.conf required by
> > > busybox httpd to run simple CGI scripts ?
>
> I believe that busybox in Etch does not support it yet.
>
> Generally busybox is a rather slow-moving package, due to its usage in
> the installer. Consider downloading it from source and rebuilding.
> It's a single binary.
>
> > > For this are necessary any special environment exported
> > > variables ?
> > >
> > > When I try to load simple bourne shell scripts, Iceweasel ask me
> > > to save them on disk.
> > >
> > > Command line for busybox is
> > > busybox httpd -h /var/www/
> > > and shell scripts are contained in /var/www/cgi-bin/, and have
> > > a+x execution bits.
> > >
> >
> > Sounds like a problem with the content-type. Make sure you set it to
> > text/html, like the following simple script:
> >
> > #!/usr/bin/bash
>
> /bin/bash fir a script? I figure busybox ash would be faster (and may
> even save you time on for/exec, as it's the same binary).
>
> shell scripts may be useful for trivial CGI scripts. But for anything
> more complicated they become rather slow. And I really don't trust
> them to handle input correctly.
>
> The busybox "tiny unitities" page recommends microperl and lua.
> microperl requires rebuilding perl. The result, though, is a more
> limited perl variant, but also considerbly smaller (e.g: 1MB vs. 5MB)
> and hence faster to load and requires less memory.
>

ccostin explicitly mentioned Bourne shell scripts, that's why I used
bash. Very impressive work with the benchmarks, though.

--
Nyizsa.
http://nyizsa.uni.cc


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 12:04 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org