On Sun, May 9, 2010 at 17:59:11 -0700, Tatsuhiko Miyagawa wrote: > On Sun, May 9, 2010 at 4:05 PM, Jakub Narebski <jnareb@xxxxxxxxx> wrote: > > > Moving to PSGI, or adding possibility to run gitweb as PSGI script (like > > the series adds *ability* to run gitweb as FastCGI script) by modifying > > gitweb would not be that easy, even with help of CGI::PSGI. > > You don't need it - since you can just use Plack::App::WrapCGI. It is simplest method, but I don't think it is best one from the performance and especially latency point of view. As I understand it, CGI::Compile catches all STDOUT output of compiled CGI script, and passes it to PSGI layer (PSGI interface). That doesn't allow, I think, for serving request as it is generated. This might be important for actions (pages) such as 'snapshot', 'blob_plain' and 'patches', which simply dump output of external comand to STDOUT. If gitweb was written as PSGI app, or with PSGI-compliant web framework, it would return IO::Handle-like object. Also I think that currently you can currently see in web browser page as it is being generated by gitweb (e.g. 'projects_list' page). This is impossible (I guess) with CGI::Compile. There is also a problem that there is no way, I guess, to automatically reload / refresh app if underlying CGI script changes (a la "plackup -r"). > > CGI::Compile was referring to an alternate approach, where instead of > > modifying gitweb to be able to run it as FastCGI script (you can run it > > as CGI script and as ModPerl::Registry script from mod_perl) there was > > added gitweb.fcgi wrapper: > > and the .fcgi wrapper can just use Plack::Loader, or the plackup > executable with FCGI environment variable set, to DWIM. Right, having gitweb.psgi PSGI wrapper, which can be run not only via FCGI, but also on many other web servers, is certainly superior to having gitweb.fcgi FastCGI wrapper, which allows to run gitweb as FastCGI script (on FCGI server). > > One can of course use this approach wrapping gitweb to be run on PSGI, > > using CGI::Emulate::PSGI (via Plack::App::WrapCGI), which in turn uses > > CGI::Compile. The gitweb.fcgi wrapper could use CGI::Emulate::FCGI... > > if it existed. > > Again, you still don't understand - once your CGI script is turned > into PSGI, plackup can take over the web server interface, including > the FastCGI interface. If you need .fcgi wrapper to be spawned from > web servers, just put plackup command line call (or Plack::Runner or > ::Loader) in the .fcgi script. I didn't made myself clear here. What I want, like I wrote in neighbour subthread, is for the FastCGI app that looks like this: use CGI::Fast; do_some_initialization(); while ($q = new CGI::Fast) { process_request(); # it uses 'my $cgi = CGI->new()' inside } to make PSGI application that runs do_some_initialization() only once, and returns converted-to-PSGI process_request() as PSGI subroutine (as PSGI $app). -- Jakub Narebski jnareb on #plack Poland -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html