sbp
Posts: 128
Joined: Wed Sep 26, 2012 7:54 pm

Re: Pi Web Server: testers wanted

Sat Aug 24, 2013 12:11 pm

Hi Jeff.
Thank you for your reply.

Actually it is working really good on the tinycore linux already. It is running fine even on the version without the option for no logging, however, I would imagine that if I left it running for a long time the log file would finally have used all the RAM, so the "no logging option" is a good thing.

Regarding the PHP - actually I would prefer if I could manage using CGI only, so I will continue working down that path.

I have tried to use method POST instead of GET, but then I can't see the variables?

Once again - thank you for this nice little web-server

Steen.

Just spotted this BASH script which should be able to manage both get and post actions, both somehow I can't manage to get it to show the variable and its value. http://oinkzwurgl.org/bash_cgi

A similar script:: https://marc.waeckerlin.org/computer/bl ... gi_scripts But again I can't get it to show the variables and values.
piCorePlayer webpage: https://sites.google.com/site/picoreplayer/home

sbp
Posts: 128
Joined: Wed Sep 26, 2012 7:54 pm

Re: Pi Web Server: testers wanted

Sat Sep 21, 2013 1:54 pm

Hi Jeff

I have now been able to make a few web pages that allows for changing most of the settings on the piCorePlayer. It is not totally finished, as I have the following issues:

1. Still I have the problem with extra character: -o ALSA::1:32_2 becomes -o+ALSA%3A%3A1%3A32_2 and I haven't figured out how to get rid of them.

2. Especially I have this problem: If I start a script via OliWeb on the raspberry which accept/needs input from the user, then It won't work. This is probably never going to work via CGI, so I don't think it is a problem with OliWeb.

Steen
piCorePlayer webpage: https://sites.google.com/site/picoreplayer/home

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Sat Sep 21, 2013 3:18 pm

Hey Steen,

For issue #1, the browser converts all non-URL-allowed characters to the ASCII codes starting with '%' (I think the HTTP protocol requires this).

I'll fix the parser utility to recognize these and convert back to the original characters... Will let you know as soon as I fix it.

I wired OliWeb up for PHP and noticed that PHP does this automatically (reverts the codes back to their character representations).

For issue #2, can you elaborate on how the user input works? There may be a way to make it go.

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Sun Sep 22, 2013 8:11 pm

Hi Steen,

Okay, posted an update to GitHub that fixes the GetProperty utility to replace all of the browser url escape sequences back to their original characters. I tested it out with the input tester and it seems to be working just fine now. Let me know if that fixes issue #1 for you! It's been on my to-do list for a bit now.

~Jeff

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Wed Sep 25, 2013 11:00 pm

I added support for HTTP POST to OliWeb today. I'm not sure it's in its "end state" yet, but it works at least for managing HTML forms using the POST action (would probably work for SOAP/XML just fine as well).

sbp
Posts: 128
Joined: Wed Sep 26, 2012 7:54 pm

Re: Pi Web Server: testers wanted

Thu Sep 26, 2013 4:43 pm

Thank you very much for your continued work on this little genius webserver.

I'm trying to make a web page where I can populate a config file with different variables - and this is working well. So I can produce a config file containing a structure like this:

name=-n variable_name
alsa=-a variable_alsa
Etc..

My question is if it would be possible for oliweb to read these variables and fill the form on the web page with the content of the config file
then the user could see what is used now, and if wanted edit this variable ie the name to something else.
And finally when pressing apply, the changed variable is saved, and the untouched variables are unchanged
piCorePlayer webpage: https://sites.google.com/site/picoreplayer/home

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Mon Sep 30, 2013 11:01 pm

My question is if it would be possible for oliweb to read these variables and fill the form on the web page with the content of the config file
then the user could see what is used now, and if wanted edit this variable ie the name to something else.
And finally when pressing apply, the changed variable is saved, and the untouched variables are unchanged
Should be absolutely possible, but where injecting values into forms and managing that kind of interactivity in concert with HTML structures is concerned, PHP is probably better suited to the task than bash scripts. I'm sure you could do it with bash scripts, but it would require your script to parse the config file, probably search and replace some string tokens in a template HTML file, and stream the resulting HTML out to the client. I would probably use sed if I were taking this route (I'd have to brush up on its usage because it's been a while). Then in the reverse direction you'd have to take the changes in and update the file accordingly (not sure if you can tell from a form submission what has been changed or what has not, so I think you'd probably get everything regardless and handle appropriately in the submission handler).

PHP could let you do the same thing, but with a little less hassle since the script embeds right in the HTML and makes things like form population pretty straightforward. But the shell script approach will absolutely work as well, and if you don't want the PHP payload given the minimalist setup, it should be relatively straightforward to go that route.

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Mon Sep 30, 2013 11:29 pm

Hey Steen,

I took a quick look at the script you put up for handling post calls... I haven't had a chance to test it yet but it appears that they are using QUERY_STRING_POST as an environment variable to pass in POST query strings... I *think* if you change QUERY_STRING_POST to BODY the script will work (I'm currently using that environment variable to pass in the encoded search string from POST calls since I haven't figured out yet what the preferred mechanism is for feeding post data through the CGI interface - I'm pretty sure they're doing the same in the script you've got but with a different environment variable).

I think (but am not 100% certain) that the preferred way to handle POSTed data is to feed in the entire HTTP request (headers + body) through STDIN and then it's up to the handler to deal with it... I'm still researching this though.

~Jeff

sbp
Posts: 128
Joined: Wed Sep 26, 2012 7:54 pm

Re: Pi Web Server: testers wanted

Thu Dec 12, 2013 4:47 pm

Hi Jeff.

Thank you for making this great webserver. It is running very robust on my microcore linux - and I have now almost made the configuration web-pages for my piCorePlayer using bash and CGI.

The server is running fine and I haven't been disconnected or discovered any errors.

As I wrote to you previously, I have a small issue: If you submit an empty box in a form, then the result is 1, and not "nothing" as I would have expected. (but I simply made a small script that removes 1 from the result).

For me the memory footprint with OliWeb is smaller than using the Mongoose web-server.

Steen
piCorePlayer webpage: https://sites.google.com/site/picoreplayer/home

sbp
Posts: 128
Joined: Wed Sep 26, 2012 7:54 pm

Re: Pi Web Server: testers wanted

Sun Feb 23, 2014 9:23 am

Hi Jeff

Thank you for your wonderful OliWeb server - it is running trock stabile on tinycore linux and I use it for configuration menu of my Squeezebox player: piCorePlayer

Thanks
Steen

Here you can see how it looks like:

Image
piCorePlayer webpage: https://sites.google.com/site/picoreplayer/home

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Fri Sep 26, 2014 8:33 pm

Hi Steen,

I'm really glad to hear it's working out! I've been running it at my house for months at a time now and had no outages except when we lose power to the house. I've still got a to-do list in Trello for a lot of enhancements, but haven't had as much time to spend on it of late. Do let me know if there's any additional fixes/features/enhancements though and I'll be happy to look into them.

~Jeff

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Sat Sep 27, 2014 4:10 am

sbp wrote: As I wrote to you previously, I have a small issue: If you submit an empty box in a form, then the result is 1, and not "nothing" as I would have expected. (but I simply made a small script that removes 1 from the result).
Sorry for lengthy delay in addressing this - I overlooked the issue in the thread previously. The behavior you describe is "as designed", sort of... it's coded so that "naked" parameters (that do not have an "=XYZ" attached in the URL) default to "true" (1). This distinguishes the response coming from the arg parser between parameters which are present but have no assignment ("naked parameters", which return a value of 1) from parameters that are absent (not present in the QUERY_STRING, resulting in no response from arg parser). So a value of 1 basically indicates "present, but with no value specified".

I won't claim it's the most thought-out convention, but it's a convention...

I think you could also default the form field to pass a space or something as well by setting value=" ", which might be closer to the "null/empty" that you're looking for. Maybe I'll put another parameter on the arg parser to allow the caller to choose the response behavior for naked parameters.

Hope OliWeb is treating you well! I'm hoping to circle back to it soon - I've got some more functionality planned.

Cheers!

~Jeff

coacharnold
Posts: 2
Joined: Fri Aug 29, 2014 3:19 pm

Re: Pi Web Server: testers wanted

Mon Aug 24, 2015 6:08 pm

Quick Question ..... I hope this is the correct place to ask this.

I've set up Oliweb and I think it's pretty great. I'm just using the sample stuff inside to play and test it...

So in cgi-bin i put something to check mounted volumes called df.cgi in it I put:

df -h

I get no output. What did I miss? does it need a /bin/bash on top?

T

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Mon Aug 24, 2015 10:38 pm

coacharnold wrote:Quick Question ..... I hope this is the correct place to ask this.

I've set up Oliweb and I think it's pretty great. I'm just using the sample stuff inside to play and test it...

So in cgi-bin i put something to check mounted volumes called df.cgi in it I put:

df -h

I get no output. What did I miss? does it need a /bin/bash on top?

T
Hiya Coach,

First question - Can you navigate to the CGI Scripts page and run the test code like ifConfig? It is doing the same sort of thing (running a command line script, capturing standard out, returning output to web browser when called).

I tried to to the same thing (created a simple script called "df.cgi") that just calls df from command line and mine didn't work either. From the logs it looks like it's getting a permission denied error when trying to invoke df even though my user can do it from the command line... I'm guessing that the same thing is happening to you (see below - the log file will show you what it did or tried to do whenever you invoke a CGI or request a resource).

OliWeb is calling out to /bin/sh to invoke CGIs internally. I tried running OliWeb under sudo rights and still got the same problem. It seems specific to the df command - I'll have to do some research to figure out why it's complaining about that. I'm not having trouble with any other commands (ls, ps, who, ifconfig all work just fine) - will do some research and see what I can find.


(329 bytes)
Requested File = [/df.cgi]
[2015-8-24 17:30:31] Invoking: '/bin/sh -c'.
[2015-8-24 17:30:31] Target: 'cgi-bin/df.cgi'
/bin/sh: cgi-bin/df.cgi: Permission denied
[2015-8-24 17:30:31] Fetching scriptOutput.5
[2015-8-24 17:30:31] Sent 0 bytes.
Deleteding request handler!!
EXITING THREAD!!

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Mon Aug 24, 2015 10:42 pm

Oops - I had a temporary brain failure. The error wasn't with df, it was with invoking df.cgi (the script). Once I changed permissions on the script:

Code: Select all

chmod 775 df.cgi
it worked just fine. Try setting permissions on the script and give it a whirl.

Requested File = [/df.cgi]
[2015-8-24 17:39:45] Invoking: '/bin/sh -c'.
[2015-8-24 17:39:45] Target: 'cgi-bin/df.cgi'
[2015-8-24 17:39:45] Fetching scriptOutput.5
[2015-8-24 17:39:45] Sent 518 bytes.
Deleteding request handler!!
EXITING THREAD!!

coacharnold
Posts: 2
Joined: Fri Aug 29, 2014 3:19 pm

Re: Pi Web Server: testers wanted

Tue Aug 25, 2015 12:16 am

AWESOME !!!!!
Perfect ...... seems my brain malfunctioned as well ....

This is everything mounted:
..................
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 797M 11M 787M 2% /run
/dev/sdb1 55G 16G 37G 31% /
tmpfs 3.9G 148M 3.8G 4% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sdd2 433G 202G 209G 50% /home
/dev/sde1 688G 597G 56G 92% /media/borris2
/dev/sda1 227G 212G 3.4G 99% /media/bullwinkle
/dev/sda2 691G 646G 11G 99% /media/natasha
/dev/sdc2 2.1T 870G 1.1T 44% /media/MrBig
/dev/sdc1 668G 624G 9.6G 99% /media/rocky2
..................

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Tue Aug 25, 2015 6:22 pm

Excellent - glad it's working for you. Let me know if you hit any more snags!

T3am5hark
Posts: 62
Joined: Wed Jul 17, 2013 5:37 pm

Re: Pi Web Server: testers wanted

Thu Mar 17, 2016 2:27 pm

I've just added support for start-on-boot (requiring absolute paths in config file). Would be grateful for some other folks to test this as well.

~Jeff

Return to “Networking and servers”