Is 'cgi_environment' option deprecated?

80 views
Skip to first unread message

Dimitar D. Mitov

unread,
Feb 4, 2014, 5:42:36 AM2/4/14
to mongoos...@googlegroups.com


Hello to all Mongoose developers, testers, users and fans!

Is 'cgi_environment' option deprecated in recent versions?

I'm using Mongoose 5.1 and when trying to set this option from configuration file, I receive:
'Failed to set option [cgi_environment]: No such option'
I found that in version 3.2 (https://code.google.com/p/mongoose/source/browse/mongoose.1) this option was still available.
I also found the following entry in the old Mongoose manual on googlecode:
' -cgi_env list
	     Pass environment variables to the CGI script in addition to stan-
	     dard ones.  The list must be comma-separated list of X=Y pairs,
	     like this: "VARIABLE1=VALUE1,VARIABLE2=VALUE2".  Default: not 
set.'
When I tried to set 'cgi_env', again from configuration file, I get the same error:
'Failed to set option [cgi_env]: No such option'

My other questions are:
1. What are the reasons for disabling this option?
(implementation problems, security issues, lack of interest among users?)
2. How to reeanble this option? Can I and should I use parts of the old code (from versions using this option)?

I need this option to pass PERL5LIB environment variable for Perl scripts and be able to load Perl modules without system-wide installation or any modifications in the scripts.

Thanks in advance for any usefull info!

Sergey Lyubka

unread,
Feb 4, 2014, 5:45:44 AM2/4/14
to mongoose-users
Hi Dimitar!
 
My other questions are:
1. What are the reasons for disabling this option?
(implementation problems, security issues, lack of interest among users?)

The reason is that a simpler mechanism exists: mongoose passes MONGOOSE_CGI
variable to the CGI. So, export MONGOOSE_CGI with any information you want to pass
to mongoose, and it'll be available to CGI process.
 
2. How to reeanble this option? Can I and should I use parts of the old code (from versions using this option)?

MONGOOSE_CGI functionality should be enough.
Please let me know if you have any troubles.

Dimitar D. Mitov

unread,
Feb 4, 2014, 4:07:22 PM2/4/14
to mongoos...@googlegroups.com

Hi Sergey!
And thanks for the fast reply and the usefull web server!

When I type
export MONGOOSE_CGI=PERL5LIB=/home/knoppix/github/peb/perl/lib
before starting Mongoose, my CGI scripts get environment variable 'MONGOOSE_CGI' with a value 'PERL5LIB=/home/knoppix/github/peb/perl/lib', but I want that every CGI script will get environment variable ''PERL5LIB' with a value '/home/knoppix/github/peb/perl/lib', so that Perl modules not on PATH will be loaded without any modifications in the scripts. I can easily read a custom environment variable from a Perl script, take folder name from that variable and load modules from that folder, but that means to modify every script with a non-core module and I want to avoid that. After all, if I'm going to modify all scripts, I can take advantage of 'use lib' command and load modules from whatever location, so the custom environment variable will not help me much.

I think the old approach from http://mongoose.googlecode.com/svn/wiki/MongooseManual.wiki is of more use for me:
' -cgi_env list
	     Pass environment variables to the CGI script in addition to stan-
	     dard ones.  The list must be comma-separated list of X=Y pairs,
	     like this: "VARIABLE1=VALUE1,VARIABLE2=VALUE2".  Default: not 
set.'
because I can set not only a value of a custom environment variable, but names and values of environment variables (more than one, if necessary, which I think is also usefull).

So my renewed question is can I reintroduce the old code, which 'injects' custom names & values of environment variables in the CGI environment? Is it still compatible with the current code base?

With best wishes,
Dimitar

Sergey Lyubka

unread,
Feb 4, 2014, 5:25:00 PM2/4/14
to mongoose-users
Note: PERLLIB is passed to CGI scripts independently, there is no need
to wrap it in MONGOOSE_CGI. Just export PERLLIB before starting mongoose.


--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/groups/opt_out.

Message has been deleted

Sergey Lyubka

unread,
Feb 7, 2014, 3:24:36 PM2/7/14
to mongoose-users
You're welcome Dimitar.  
Good point about documentation.
I've added notes about environment to http://cesanta.com/docs.html?Options.md

Sergey.

Dimitar D. Mitov

unread,
Feb 7, 2014, 5:51:05 PM2/7/14
to mongoos...@googlegroups.com

Hi Sergey!

The documentation is now even better and exhaustive!
It is friendly to new users and so should it be!

Thanks and with all the best wishes,
Dimitar
Reply all
Reply to author
Forward
0 new messages