busybox httpd cgi cgi-bin

cheesiong bluecolour.sz at gmail.com
Sun May 4 19:49:32 PDT 2008


hi busybox friends,
 i am trying to have a feel on how cgi is woking on busybox.
 but i still have problem while after i have several try, would anyone
please teach me or give me a pointer so to make it running?
 thank you.

 i have busybox compiled on i686 system running fedora 8 in vmware on winxp.
 i put busybox source in /home/keo/busybox and compile statically with only
httpd. ( i tried a defconfig, but i hope a simplest compile will isolate
problem).

then i mkdir www for webroot and cgi-bin within www.
then i launch with ./busybox httpd -h www -c $PWD/www/httpd.conf

i copy 2 files from internet. www/form-post.html and cgi-bin/test-post
but when i submit in the form-post.html which pass to test-post i get

404 Not Found

The requested URL was not found

regards,-keo

-----------------------------------
<html>
<head>
<title>CGI Test</title>
</head>

<body>
<form name="form1" method="post" action="/cgi-bin/test-post">
  <p>Text field
    <input name="Text_Field" type="text" id="Text_Field">
  </p>
  <p>Radio button  </p>
  <p>
    <input name="Radio_Button" type="radio" value="1"> 1
  </p>
  <p>
    <input name="Radio_Button" type="radio" value="2"> 2
  </p>
  <p>
    <input name="Radio_Button" type="radio" value="3"> 3
  </p>
  <p>Some text </p>
  <p>
    <textarea name="Text_Area" id="Text_Area"></textarea>
  </p>
  <p>&nbsp;</p>
  <p>
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" name="Reset" value="Reset">
  </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</form>
</body>
</html>
--------------------------------------
#!/bin/sh
echo "Content-type: text/html"
echo ""
echo "<HTML><HEAD><TITLE>Sample CGI Output</TITLE></HEAD>"
echo "<BODY>"
echo "<pre>"
echo "Environment variables"
echo ""
env
echo ""
echo "========================================================="
echo ""
echo "Form variables :"
echo ""
read QUERY_STRING
eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}')
tmp=`httpd -d $Text_Field`
echo "Text_Field=$tmp"
tmp=`httpd -d $Radio_Button`
echo "Radio_Button=$tmp"
tmp=`httpd -d $Text_Area`
echo "Text_Area=$tmp"
echo "</pre>"
echo "</BODY></HTML>"




[root at fedora8 busybox]# pwd
/home/keo/busybox

[root at fedora8 busybox]# file busybox
busybox: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
statically
linked, for GNU/Linux 2.6.9, stripped

[root at fedora8 busybox]# ./busybox
BusyBox v1.10.1 (2008-05-05 10:35:41 HKT) multi-call binary
Copyright (C) 1998-2007 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as!

Currently defined functions:
        httpd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://busybox.net/lists/busybox/attachments/20080505/322723c9/attachment.htm 


More information about the busybox mailing list