how to write bash shell CGI under uHTTPd
cgi
- Target
- Reference
- WWW ROOT Dir on OpenWRT
- Browser Client Access
Target
Want to provide the smaple RESTful server under uHTTPd on OpenWRT, I select the bash script for a demo
Reference
WWW ROOT Dir on OpenWRT
/www/cgi/test.cgi
- #!/bin/sh
- POST_STRING=$(cat)
- echo "Content-type: application/json"
- echo ""
- echo "$POST_STRING"
uHTTPd passes ‘GET’ paramter to bash by ‘$QUERY_STRING’
uHTTPd passes ‘POST’ conent to bash by STDIN, so bash use ‘POST_STRING=$(cat)’ to get them
Browser Client Access
http://192.168.254.219/cgi-bin/test.cgi
[email protected] 2017-4-21
时间: 2024-10-15 07:26:17