{"thread":{"id":"23933","subject":"[PATCH 1/3] git-instaweb: Remove pidfile after stopping web server","startedAt":"2010-05-28T19:11:22Z","lastAt":"2010-05-31T21:15:09Z","messageCount":9,"participants":["Jakub Narebski","Pavan Kumar Sunkara","Eric Wong","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"142501","messageId":"1275073885-26537-1-git-send-email-jnareb@gmail.com","threadId":"23933","inReplyTo":null,"subject":"[PATCH 0/3] git-instaweb: Support for 'plackup' and improvements","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-28T19:11:22Z","receivedAt":"2010-05-28T19:11:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"This series is based on latest GSoC 2010 work by Pavan Kumar Sunkara,\non commit 72855f7 \n  (git-instaweb: Configure it to work with new gitweb structure, 2010-05-21)\nin the 'master' branch of git://repo.or.cz/git/gsoc2010-gitweb.git\n\nThe relevant patches were lately send to git mailing list as 4-patch\nseries:\n [PATCH GSoC 1/4] gitweb: Move static files into seperate subdirectory\n [PATCH GSoC 2/4] gitweb: Set default destination directory for\n                  installing gitweb in Makefile\n [PATCH GSoC 3/4] git-instaweb: Put httpd logs in a \"$httpd_only\"\n                  subdirectory\n [PATCH GSoC 4/4] git-instaweb: Configure it to work with new gitweb\n                  structure\nThe first patch series is available as\n  Message-Id: <1275027952-5057-4-git-send-email-pavan.sss1991@gmail.com>\n  http://thread.gmane.org/gmane.comp.version-control.git/147913\n\nThe following patches were send as non-chained reply to the first\npatch (without cover letter).\n\n\nThis series adds support for 'plackup' web server (PSGI/Plack based\nserver script) to git-instaweb.  Because the web server (by default\npure-Perl HTTP::Server::PSGI aka PLACK_SERVER=Standalone) can take a\nwhile to start, it required adding waiting for web server to be ready\nbefore starting web browser.\n\nThis series also contains somewhat unrelated fixup, namely that\ngit-instaweb removes pidfile after stopping web server.  This is\nprobably important only to web servers which do not have daemon mode,\nand are \"daemonized\" (which includes generating pidfile) by\ngit-instaweb itself.\n\nShortlog:\n~~~~~~~~~\nJakub Narebski (3):\n  git-instaweb: Remove pidfile after stopping web server\n  git-instaweb: Wait for server to start before running web browser\n  git-instaweb: Add support for running gitweb via 'plackup'\n\nTable of contents:\n~~~~~~~~~~~~~~~~~~\n [PATCH 1/3] git-instaweb: Remove pidfile after stopping web server\n [PATCH 2/3] git-instaweb: Wait for server to start before running web browser\n [PATCH 3/3] git-instaweb: Add support for running gitweb via 'plackup'\n\nDiffstat:\n~~~~~~~~~\n Documentation/git-instaweb.txt |    2 +-\n git-instaweb.sh                |  177 +++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 174 insertions(+), 5 deletions(-)\n\n-- \nJakub Narebski\n"},{"id":"142500","messageId":"1275073885-26537-2-git-send-email-jnareb@gmail.com","threadId":"23933","inReplyTo":"1275073885-26537-1-git-send-email-jnareb@gmail.com","subject":"[PATCH 1/3] git-instaweb: Remove pidfile after stopping web server","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-28T19:11:23Z","receivedAt":"2010-05-28T19:11:23Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"This way running e.g. \"git instaweb\" after \"git instaweb --stop\" would\nnot try to kill already stopped web server.\n\nThis is probably important only for those web servers that are\n\"daemonized\" by git-instaweb itself, i.e. for those where it is\ngit-instaweb that creates pidfile.  Currently it is includes only\n'mongoose' web server, but it would also include 'plackup' web server\n(added in later commit).\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n git-instaweb.sh |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 5c700b6..a8c5dc0 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -114,6 +114,7 @@ EOF\n \n stop_httpd () {\n \ttest -f \"$fqgitdir/pid\" && kill $(cat \"$fqgitdir/pid\")\n+\trm -f \"$fqgitdir/pid\"\n }\n \n while test $# != 0\n-- \n1.7.0.1\n"},{"id":"142502","messageId":"1275073885-26537-3-git-send-email-jnareb@gmail.com","threadId":"23933","inReplyTo":"1275073885-26537-1-git-send-email-jnareb@gmail.com","subject":"[PATCH 2/3] git-instaweb: Wait for server to start before running web browser","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-28T19:11:24Z","receivedAt":"2010-05-28T19:11:24Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Add generic httpd_is_ready subroutine, which busy-waits for web server to\nbe started, by checking if $port is opened on localhost.  This is used to\navoid situation where web browser is started before web server is ready to\naccept connection, and fails.\n\nIt uses IO::Socket::INET module, which is core Perl module since v5.6.0.\n\n\nAlternate solution, possible for those web servers that can run arbitrary\ncode hooks after they bind the listen socket (after they start accepting\nconnections), would be to use some kind of blocking mechanism: FIFO or\nlockfile, see\n  http://thread.gmane.org/gmane.comp.version-control.git/147337/focus=147566\n\nThis can be always added later, as a web server specific branch in\nhttpd_is_ready function.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis was required to test support for 'plackup' web server in git-instaweb\n(the next patch in this series), because default pure-Perl web server used\nby Plack, namely HTTP::Server::PSGI, can take a while to start.\n\n git-instaweb.sh |   17 +++++++++++++++--\n 1 files changed, 15 insertions(+), 2 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex a8c5dc0..dc8478f 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -117,6 +117,19 @@ stop_httpd () {\n \trm -f \"$fqgitdir/pid\"\n }\n \n+httpd_is_ready () {\n+\t\"$PERL\" -MIO::Socket::INET -e \"\n+local \\$| = 1; # turn on autoflush\n+exit if (IO::Socket::INET->new('127.0.0.1:$port'));\n+print 'Waiting for \\'$httpd\\' to start ..';\n+do {\n+\tprint '.';\n+\tsleep(1);\n+} until (IO::Socket::INET->new('127.0.0.1:$port'));\n+print qq! (done)\\n!;\n+\"\n+}\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n@@ -414,7 +427,7 @@ start_httpd\n url=http://127.0.0.1:$port\n \n if test -n \"$browser\"; then\n-\tgit web--browse -b \"$browser\" $url || echo $url\n+\thttpd_is_ready && git web--browse -b \"$browser\" $url || echo $url\n else\n-\tgit web--browse -c \"instaweb.browser\" $url || echo $url\n+\thttpd_is_ready && git web--browse -c \"instaweb.browser\" $url || echo $url\n fi\n-- \n1.7.0.1\n"},{"id":"142503","messageId":"1275073885-26537-4-git-send-email-jnareb@gmail.com","threadId":"23933","inReplyTo":"1275073885-26537-1-git-send-email-jnareb@gmail.com","subject":"[PATCHv4 3/3] git-instaweb: Add support for running gitweb via 'plackup'","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-28T19:11:25Z","receivedAt":"2010-05-28T19:11:25Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"PSGI is an interface between Perl web applications and web servers, and\nPlack is a Perl module and toolkit that contains PSGI middleware, helpers\nand adapters to web servers; see http://plackperl.org\n\nPSGI and Plack are inspired by Python's WSGI and Ruby's Rack (and\nprobably JavaScript's Jack/JSGI).\n\nPlack core distribution includes HTTP::Server::PSGI, a reference PSGI\nstandalone web server implementation.  'plackup' is a command line\nlauncher to run PSGI applications from command line, connecting web\napp to a web server via Plack::Runner module.  By default it uses\nHTTP::Server::PSGI as a web server.\n\ngit-instaweb generates gitweb.psgi wrapper (in $GIT_DIR/gitweb).  This\nwrapper uses Plack::App::WrapCGI to compile gitweb.cgi (which is a CGI\nscript) into a PSGI application using CGI::Compile and CGI::Emulate::PSGI.\ngit-instaweb then runs this wrapper, using by default HTTP::Server::PSGI\nstandalone Perl server, via Plack::Runner.\n\nThe configuration for 'plackup' is currently embedded in generated\ngitweb.psgi wrapper, instead of using httpd.conf ($conf).\n\n\nTo run git-instaweb with '--httpd=plackup', you need to have instaled\nPlack core, CGI::Emulate::PSGI, CGI::Compile.  Those modules have to be\navailable for Perl scripts (which can be done for example by setting\nPERL5LIB environment variable).  This is currently not documented.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nDifferences from previous version (v3):\n* resolve_full_httpd sets also $httpd_only, in addition to $full_httpd\n* httpd_is_ready is moved to separate patch, earlier in series\n* gitweb.psgi now includes (probably unnecessary) mimetype mapping\n* gitweb.psgi puts access.log and error.log in $httpd_only subdirectory,\n  like the rest of web servers (after 3rd patch by Pavan Kumar Sunkara)\n* gitweb.psgi logs in error.log also build time warnings\n* root dir in gitweb.psgi  for gitweb.cgi and for static files is $root,\n  not $fqgitdir/gitweb (after 4th patch by Pavan Kumar Sunkara)\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/147337/focus=147415\n\n Documentation/git-instaweb.txt |    2 +-\n git-instaweb.sh                |  159 +++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 158 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt\nindex a1f17df..2c3c4d2 100644\n--- a/Documentation/git-instaweb.txt\n+++ b/Documentation/git-instaweb.txt\n@@ -29,7 +29,7 @@ OPTIONS\n \tThe HTTP daemon command-line that will be executed.\n \tCommand-line options may be specified here, and the\n \tconfiguration file will be added at the end of the command-line.\n-\tCurrently apache2, lighttpd, mongoose and webrick are supported.\n+\tCurrently apache2, lighttpd, mongoose, plackup and webrick are supported.\n \t(Default: lighttpd)\n \n -m::\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex dc8478f..8b6b02e 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -50,6 +50,12 @@ resolve_full_httpd () {\n \t\t\thttpd=\"$httpd -f\"\n \t\tfi\n \t\t;;\n+\t*plackup*)\n+\t\t# server is started by running via generated gitweb.psgi in $fqgitdir/gitweb\n+\t\tfull_httpd=\"$fqgitdir/gitweb/gitweb.psgi\"\n+\t\thttpd_only=\"${httpd%% *}\" # cut on first space\n+\t\treturn\n+\t\t;;\n \tesac\n \n \thttpd_only=\"$(echo $httpd | cut -f1 -d' ')\"\n@@ -87,8 +93,8 @@ start_httpd () {\n \n \t# don't quote $full_httpd, there can be arguments to it (-f)\n \tcase \"$httpd\" in\n-\t*mongoose*)\n-\t\t#The mongoose server doesn't have a daemon mode so we'll have to fork it\n+\t*mongoose*|*plackup*)\n+\t\t#These servers don't have a daemon mode so we'll have to fork it\n \t\t$full_httpd \"$fqgitdir/gitweb/httpd.conf\" &\n \t\t#Save the pid before doing anything else (we'll print it later)\n \t\tpid=$!\n@@ -390,6 +396,152 @@ mime_types\t.gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-t\n EOF\n }\n \n+plackup_conf () {\n+\t# generate a standalone 'plackup' server script in $fqgitdir/gitweb\n+\t# with embedded configuration; it does not use \"$conf\" file\n+\tcat > \"$fqgitdir/gitweb/gitweb.psgi\" <<EOF\n+#!$PERL\n+\n+# gitweb - simple web interface to track changes in git repositories\n+#          PSGI wrapper and server starter (see http://plackperl.org)\n+\n+use strict;\n+\n+use IO::Handle;\n+use Plack::MIME;\n+use Plack::Builder;\n+use Plack::App::WrapCGI;\n+use CGI::Emulate::PSGI 0.07; # minimum version required to work with gitweb\n+\n+# mimetype mapping (from lighttpd_conf)\n+Plack::MIME->add_type(\n+\t\".pdf\"          =>      \"application/pdf\",\n+\t\".sig\"          =>      \"application/pgp-signature\",\n+\t\".spl\"          =>      \"application/futuresplash\",\n+\t\".class\"        =>      \"application/octet-stream\",\n+\t\".ps\"           =>      \"application/postscript\",\n+\t\".torrent\"      =>      \"application/x-bittorrent\",\n+\t\".dvi\"          =>      \"application/x-dvi\",\n+\t\".gz\"           =>      \"application/x-gzip\",\n+\t\".pac\"          =>      \"application/x-ns-proxy-autoconfig\",\n+\t\".swf\"          =>      \"application/x-shockwave-flash\",\n+\t\".tar.gz\"       =>      \"application/x-tgz\",\n+\t\".tgz\"          =>      \"application/x-tgz\",\n+\t\".tar\"          =>      \"application/x-tar\",\n+\t\".zip\"          =>      \"application/zip\",\n+\t\".mp3\"          =>      \"audio/mpeg\",\n+\t\".m3u\"          =>      \"audio/x-mpegurl\",\n+\t\".wma\"          =>      \"audio/x-ms-wma\",\n+\t\".wax\"          =>      \"audio/x-ms-wax\",\n+\t\".ogg\"          =>      \"application/ogg\",\n+\t\".wav\"          =>      \"audio/x-wav\",\n+\t\".gif\"          =>      \"image/gif\",\n+\t\".jpg\"          =>      \"image/jpeg\",\n+\t\".jpeg\"         =>      \"image/jpeg\",\n+\t\".png\"          =>      \"image/png\",\n+\t\".xbm\"          =>      \"image/x-xbitmap\",\n+\t\".xpm\"          =>      \"image/x-xpixmap\",\n+\t\".xwd\"          =>      \"image/x-xwindowdump\",\n+\t\".css\"          =>      \"text/css\",\n+\t\".html\"         =>      \"text/html\",\n+\t\".htm\"          =>      \"text/html\",\n+\t\".js\"           =>      \"text/javascript\",\n+\t\".asc\"          =>      \"text/plain\",\n+\t\".c\"            =>      \"text/plain\",\n+\t\".cpp\"          =>      \"text/plain\",\n+\t\".log\"          =>      \"text/plain\",\n+\t\".conf\"         =>      \"text/plain\",\n+\t\".text\"         =>      \"text/plain\",\n+\t\".txt\"          =>      \"text/plain\",\n+\t\".dtd\"          =>      \"text/xml\",\n+\t\".xml\"          =>      \"text/xml\",\n+\t\".mpeg\"         =>      \"video/mpeg\",\n+\t\".mpg\"          =>      \"video/mpeg\",\n+\t\".mov\"          =>      \"video/quicktime\",\n+\t\".qt\"           =>      \"video/quicktime\",\n+\t\".avi\"          =>      \"video/x-msvideo\",\n+\t\".asf\"          =>      \"video/x-ms-asf\",\n+\t\".asx\"          =>      \"video/x-ms-asf\",\n+\t\".wmv\"          =>      \"video/x-ms-wmv\",\n+\t\".bz2\"          =>      \"application/x-bzip\",\n+\t\".tbz\"          =>      \"application/x-bzip-compressed-tar\",\n+\t\".tar.bz2\"      =>      \"application/x-bzip-compressed-tar\",\n+\t\"\"              =>      \"text/plain\"\n+);\n+\n+my \\$app = builder {\n+\t# to be able to override \\$SIG{__WARN__} to log build time warnings\n+\tuse CGI::Carp; # it sets \\$SIG{__WARN__} itself\n+\n+\tmy \\$logdir = \"$fqgitdir/gitweb/$httpd_only\";\n+\topen my \\$access_log_fh, '>', \"\\$logdir/access.log\"\n+\t\tor die \"Couldn't open access log '\\$logdir/access.log': \\$!\";\n+\topen my \\$error_log_fh,  '>', \"\\$logdir/error.log\"\n+\t\tor die \"Couldn't open error log '\\$logdir/error.log': \\$!\";\n+\n+\t\\$access_log_fh->autoflush(1);\n+\t\\$error_log_fh->autoflush(1);\n+\n+\t# redirect build time warnings to error.log\n+\t\\$SIG{'__WARN__'} = sub {\n+\t\tmy \\$msg = shift;\n+\t\t# timestamp warning like in CGI::Carp::warn\n+\t\tmy \\$stamp = CGI::Carp::stamp();\n+\t\t\\$msg =~ s/^/\\$stamp/gm;\n+\t\tprint \\$error_log_fh \\$msg;\n+\t};\n+\n+\t# write errors to error.log, access to access.log\n+\tenable 'AccessLog',\n+\t\tformat => \"combined\",\n+\t\tlogger => sub { print \\$access_log_fh @_; };\n+\tenable sub {\n+\t\tmy \\$app = shift;\n+\t\tsub {\n+\t\t\tmy \\$env = shift;\n+\t\t\t\\$env->{'psgi.errors'} = \\$error_log_fh;\n+\t\t\t\\$app->(\\$env);\n+\t\t}\n+\t};\n+\t# gitweb currently doesn't work with $SIG{CHLD} set to 'IGNORE',\n+\t# because it uses 'close $fd or die...' on piped filehandle $fh\n+\t# (which causes the parent process to wait for child to finish).\n+\tenable_if { \\$SIG{'CHLD'} eq 'IGNORE' } sub {\n+\t\tmy \\$app = shift;\n+\t\tsub {\n+\t\t\tmy \\$env = shift;\n+\t\t\tlocal \\$SIG{'CHLD'} = 'DEFAULT';\n+\t\t\tlocal \\$SIG{'CLD'}  = 'DEFAULT';\n+\t\t\t\\$app->(\\$env);\n+\t\t}\n+\t};\n+\t# serve static files, i.e. stylesheet, images, script\n+\tenable 'Static',\n+\t\tpath => sub { m!\\.(js|css|png)\\$! && s!^/gitweb/!! },\n+\t\troot => \"$root/\",\n+\t\tencoding => 'utf-8'; # encoding for 'text/plain' files\n+\t# convert CGI application to PSGI app\n+\tPlack::App::WrapCGI->new(script => \"$root/gitweb.cgi\")->to_app;\n+};\n+\n+# make it runnable as standalone app,\n+# like it would be run via 'plackup' utility\n+if (__FILE__ eq \\$0) {\n+\trequire Plack::Runner;\n+\n+\tmy \\$runner = Plack::Runner->new();\n+\t\\$runner->parse_options(qw(--env deployment --port $port),\n+\t                       \"$local\" ? qw(--host 127.0.0.1) : ());\n+\t\\$runner->run(\\$app);\n+}\n+__END__\n+EOF\n+\n+\tchmod a+x \"$fqgitdir/gitweb/gitweb.psgi\"\n+\t# configuration is embedded in server script file, gitweb.psgi\n+\trm -f \"$conf\"\n+}\n+\n gitweb_conf() {\n \tcat > \"$fqgitdir/gitweb/gitweb_config.perl\" <<EOF\n #!/usr/bin/perl\n@@ -417,6 +569,9 @@ webrick)\n *mongoose*)\n \tmongoose_conf\n \t;;\n+*plackup*)\n+\tplackup_conf\n+\t;;\n *)\n \techo \"Unknown httpd specified: $httpd\"\n \texit 1\n-- \n1.7.0.1\n"},{"id":"142504","messageId":"AANLkTilpiwy2NFhOycoMBeYZFZDuVN5yFt8nIiIoYTjL@mail.gmail.com","threadId":"23933","inReplyTo":"1275073885-26537-3-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 2/3] git-instaweb: Wait for server to start before running web browser","fromName":"Pavan Kumar Sunkara","fromEmail":"pavan.sss1991@gmail.com","sentAt":"2010-05-28T19:31:42Z","receivedAt":"2010-05-28T19:31:42Z","isPatch":true,"sender":{"key":"pavan.sss1991@gmail.com","avatar":"https://avatars.githubusercontent.com/u/174703?v=4"},"body":"> It uses IO::Socket::INET module, which is core Perl module since v5.6.0.\n\nCore module means it will be installed by default in v5.6. But what\nhappens in case of lower versions of perl ?\n\n> +httpd_is_ready () {\n> +       \"$PERL\" -MIO::Socket::INET -e \"\n> +local \\$| = 1; # turn on autoflush\n> +exit if (IO::Socket::INET->new('127.0.0.1:$port'));\n> +print 'Waiting for \\'$httpd\\' to start ..';\n> +do {\n> +       print '.';\n> +       sleep(1);\n> +} until (IO::Socket::INET->new('127.0.0.1:$port'));\n> +print qq! (done)\\n!;\n> +\"\n> +}\n> +\n\nOne of the solution is to add a web server specific branch in httpd_is_ready().\nSo, if the server is plackup it loads the module and checks the port,\nif not it will just continue.\n\nJust an Idea for a common usage.\n\nThanks,\nPavan.\n"},{"id":"142505","messageId":"201005282158.57998.jnareb@gmail.com","threadId":"23933","inReplyTo":"AANLkTilpiwy2NFhOycoMBeYZFZDuVN5yFt8nIiIoYTjL@mail.gmail.com","subject":"Re: [PATCH 2/3] git-instaweb: Wait for server to start before running web browser","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-28T19:58:55Z","receivedAt":"2010-05-28T19:58:55Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 28 May 2010, Pavan Kumar Sunkara wrote:\n> Jakub Narebski wrote;\n> >\n> > It uses IO::Socket::INET module, which is core Perl module since v5.6.0.\n> \n> Core module means it will be installed by default in v5.6. But what\n> happens in case of lower versions of Perl?\n\nGitweb itself requires even higher version of Perl for its utf-8\nsupport: at least v5.8.0 for Encode module, and IIRC at least v5.8.3\nor even v5.8.6 for correct handling of utf-8.\n\nPerl v5.8.6 was released in 2006.\n\n> \n> > +httpd_is_ready () {\n> > +       \"$PERL\" -MIO::Socket::INET -e \"\n> > +local \\$| = 1; # turn on autoflush\n> > +exit if (IO::Socket::INET->new('127.0.0.1:$port'));\n> > +print 'Waiting for \\'$httpd\\' to start ..';\n> > +do {\n> > +       print '.';\n> > +       sleep(1);\n> > +} until (IO::Socket::INET->new('127.0.0.1:$port'));\n> > +print qq! (done)\\n!;\n> > +\"\n> > +}\n> > +\n> \n> One of the solution is to add a web server specific branch in httpd_is_ready().\n> So, if the server is plackup it load the module and checks the port,\n> if not it will just continue.\n> \n> Just an idea for a common usage.\n\nThe above solution is universal, and works for any web server.  \n\nWe can add web server specific branch in httpd_is_ready() to use e.g. \nserver_startup hook (and some blocking mechanism) for server(s) which\nsupport it.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"142517","messageId":"20100529023252.GA19705@dcvr.yhbt.net","threadId":"23933","inReplyTo":"1275073885-26537-4-git-send-email-jnareb@gmail.com","subject":"Re: [PATCHv4 3/3] git-instaweb: Add support for running gitweb via 'plackup'","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-05-29T02:32:52Z","receivedAt":"2010-05-29T02:32:52Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Jakub Narebski <jnareb@gmail.com> wrote:\n> +\topen my \\$access_log_fh, '>', \"\\$logdir/access.log\"\n> +\t\tor die \"Couldn't open access log '\\$logdir/access.log': \\$!\";\n> +\topen my \\$error_log_fh,  '>', \"\\$logdir/error.log\"\n> +\t\tor die \"Couldn't open error log '\\$logdir/error.log': \\$!\";\n\nI believe '>>' (append) is preferable for log files and matches the\nbehavior of all other servers.  Other than that everything else looks\ngood.  I can make that change myself + Ack + push for Junio.\n\n-- \nEric Wong\n"},{"id":"142527","messageId":"20100529072140.GA19687@dcvr.yhbt.net","threadId":"23933","inReplyTo":"20100529023252.GA19705@dcvr.yhbt.net","subject":"Re: [PATCHv4 3/3] git-instaweb: Add support for running gitweb via 'plackup'","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2010-05-29T07:21:40Z","receivedAt":"2010-05-29T07:21:40Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Eric Wong <normalperson@yhbt.net> wrote:\n> Jakub Narebski <jnareb@gmail.com> wrote:\n> > +\topen my \\$access_log_fh, '>', \"\\$logdir/access.log\"\n> > +\t\tor die \"Couldn't open access log '\\$logdir/access.log': \\$!\";\n> > +\topen my \\$error_log_fh,  '>', \"\\$logdir/error.log\"\n> > +\t\tor die \"Couldn't open error log '\\$logdir/error.log': \\$!\";\n> \n> I believe '>>' (append) is preferable for log files and matches the\n> behavior of all other servers.  Other than that everything else looks\n> good.  I can make that change myself + Ack + push for Junio.\n\nConsider this series acked with the above change, since this series\ndepends on changes not ready for mainline yet, I've pushed my acks to\nthe \"instaweb\" branch at git://git.bogomips.org/git-svn.\n\n-- \nEric Wong\n"},{"id":"142622","messageId":"20100531211509.GB27342@machine.or.cz","threadId":"23933","inReplyTo":"1275073885-26537-1-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 0/3] git-instaweb: Support for 'plackup' and improvements","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2010-05-31T21:15:09Z","receivedAt":"2010-05-31T21:15:09Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Fri, May 28, 2010 at 09:11:22PM +0200, Jakub Narebski wrote:\n> This series adds support for 'plackup' web server (PSGI/Plack based\n> server script) to git-instaweb.  Because the web server (by default\n> pure-Perl HTTP::Server::PSGI aka PLACK_SERVER=Standalone) can take a\n> while to start, it required adding waiting for web server to be ready\n> before starting web browser.\n> \n> This series also contains somewhat unrelated fixup, namely that\n> git-instaweb removes pidfile after stopping web server.  This is\n> probably important only to web servers which do not have daemon mode,\n> and are \"daemonized\" (which includes generating pidfile) by\n> git-instaweb itself.\n\nI did not test the series, but looking over it, all appears sane, so\n\nAcked-by: Petr Baudis <pasky@suse.cz>\n"}]}