Re: [Cppcms-users] Integrated FastCGI module
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2012-12-19 07:51:16
|
One small note: I don't think there should be a big problem to change fastcgi connector to handle authorizer requests. I think it should be enough to accept role == FCGI_AUTHORIZER in addition to role == FCGI_RESPONDER in fastcgi_api.cpp line 440) but you should be aware of the following fastcgi specs: The Authorizer application receives HTTP request information from the Web server on the FCGI_PARAMS stream, in the same format as a Responder. The Web server does not send CONTENT_LENGTH, PATH_INFO, PATH_TRANSLATED, and SCRIPT_NAME headers Which makes it quite useless for control of specific files as PATH_INFO and SCRIPT_NAME are critical for content detection. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Artyom Beilis <art...@ya...> >To: "cpp...@li..." <cpp...@li...> >Sent: Wednesday, December 19, 2012 9:36 AM >Subject: Re: [Cppcms-users] Integrated FastCGI module > > >CppCMS does not support "authorizer" FastCGI mode (and honestly I'm not aware of any framework that does, correct me if I wrong). > >authorizer FastCGI request is quite unusual one and not frequently used. > > >Quoting original main > >> HTTP-Requests and allow or deny them according to the rights of the currently logged in user." > >Usually user management is done using session cookies. Can you explain what are you trying to do, maybe >it can be done withoutusing lighttpd/fastcgi authorization module? > >For example if you want to serve some static files according to some permissions, there are other ways to do it. > >Also if you must to use fastcgi authorizer (which is basically simple responder with status for authorization requests) you can start a speparate thread and use libfastcgi directly, see: > >http://www.fastcgi.com/devkit/examples/authorizer.c > > > >Artyom Beilis >-------------- >CppCMS - C++ Web Framework: http://cppcms.com/ >CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > > >>________________________________ >> From: Sab <rim...@gm...> >>To: cpp...@li... >>Sent: Tuesday, December 18, 2012 4:51 PM >>Subject: Re: [Cppcms-users] Integrated FastCGI module >> >>Thanks for the answers. >> >>I built the hello word app and configured my Lighty to look for the application >>on port 9000 as a FastCGI module. It seems to work fine, the main function gets >>called and I can send a response back to the server. So that looks just fine. >> >>But as soon as I configure Lighty to run in authorizer mode, my application does >>not receive the request. As far as I understand the authorizer mode, the server >>should first send the request to the FastCGI module, the module should decide if >>the access is granted or not and return accordingly a 200 or 401 as status in >>the response. But I don't receive the request in my CppCMS app. According to the >>server's error.log, the fastcgi module is called and it returns immediately with >>no further comment, so it goes on to find the physical path (which in my case >>does not exists but that shouldn't be the reason not to execute the FastCGI >>function). >> >>What am I doing wrong? >> >>My config.js: >>{ >> "service" : { >> "api" : "fastcgi", >> "port" : 9000, >> "ip" : "127.0.0.1" >> } >>} >> >>The critical parts of my lighttpd.conf: >>server.modules = ( >> "mod_access", >> "mod_alias", >> "mod_compress", >> "mod_redirect", >> "mod_accesslog", >> "mod_fastcgi", >> "mod_rewrite" >>) >> >>fastcgi.server = ( >> "" => >> (( "host" => "127.0.0.1", >> "port" => 9000, >> "check-local" => "disable", >> "docroot" => "/", >> "mode" => "authorizer" >> )) >>) >> >>This is my error.log: >> >>2012-12-18 13:15:16: (request.c.304) fd: 8 request-len: 406 >>GET /test24 HTTP/1.1 >>Host: localhost >>User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.16) Gecko/20120511 >>Iceweasel/3.5.16 (like Firefox/3.5.16) >>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 >>Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 >>Accept-Encoding: gzip,deflate >>Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 >>Keep-Alive: 300 >>Connection: keep-alive >> >>2012-12-18 13:15:16: (response.c.241) run condition >>2012-12-18 13:15:16: (response.c.300) -- splitting Request-URI >>2012-12-18 13:15:16: (response.c.301) Request-URI : /test24 >>2012-12-18 13:15:16: (response.c.302) URI-scheme : http >>2012-12-18 13:15:16: (response.c.303) URI-authority: localhost >>2012-12-18 13:15:16: (response.c.304) URI-path : /test24 >>2012-12-18 13:15:16: (response.c.305) URI-query : >>2012-12-18 13:15:16: (response.c.349) -- sanatising URI >>2012-12-18 13:15:16: (response.c.350) URI-path : /test24 >>2012-12-18 13:15:16: (mod_access.c.135) -- mod_access_uri_handler called >>2012-12-18 13:15:16: (mod_fastcgi.c.3636) handling it in mod_fastcgi >>2012-12-18 13:15:16: (response.c.470) -- before doc_root >>2012-12-18 13:15:16: (response.c.471) Doc-Root : /var/www >>2012-12-18 13:15:16: (response.c.472) Rel-Path : /test24 >>2012-12-18 13:15:16: (response.c.473) Path : >>2012-12-18 13:15:16: (response.c.521) -- after doc_root >>2012-12-18 13:15:16: (response.c.522) Doc-Root : /var/www >>2012-12-18 13:15:16: (response.c.523) Rel-Path : /test24 >>2012-12-18 13:15:16: (response.c.524) Path : /var/www/test24 >>2012-12-18 13:15:16: (response.c.541) -- logical -> physical >>2012-12-18 13:15:16: (response.c.542) Doc-Root : /var/www >>2012-12-18 13:15:16: (response.c.543) Rel-Path : /test24 >>2012-12-18 13:15:16: (response.c.544) Path : /var/www/test24 >>2012-12-18 13:15:17: (mod_fastcgi.c.3061) got proc: pid: 0 socket: >>tcp:127.0.0.1:9000 load: 1 >>2012-12-18 13:15:17: (mod_fastcgi.c.1492) released proc: pid: 0 socket: >>tcp:127.0.0.1:9000 load: 0 >>2012-12-18 13:15:17: (response.c.561) -- handling physical path >>2012-12-18 13:15:17: (response.c.562) Path : //test24 >>2012-12-18 13:15:17: (response.c.618) -- file not found >>2012-12-18 13:15:17: (response.c.619) Path : //test24 >>2012-12-18 13:15:17: (response.c.128) Response-Header: >>HTTP/1.1 404 Not Found >>Content-Type: text/html >>Content-Length: 345 >>Date: Tue, 18 Dec 2012 12:15:17 GMT >>Server: lighttpd/1.4.28 >> >>Any suggestions? >> >>Thanks, >>Sab >> >> >> >> >> >>------------------------------------------------------------------------------ >>LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial >>Remotely access PCs and mobile devices and provide instant support >>Improve your efficiency, and focus on delivering more value-add services >>Discover what IT Professionals Know. Rescue delivers >>http://p.sf.net/sfu/logmein_12329d2d >>_______________________________________________ >>Cppcms-users mailing list >>Cpp...@li... >>https://lists.sourceforge.net/lists/listinfo/cppcms-users >> >> >> >------------------------------------------------------------------------------ >LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial >Remotely access PCs and mobile devices and provide instant support >Improve your efficiency, and focus on delivering more value-add services >Discover what IT Professionals Know. Rescue delivers >http://p.sf.net/sfu/logmein_12329d2d >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |