{"thread":{"id":"20681","subject":"[PATCH] Add support for the Mongoose web server.","startedAt":"2009-08-21T06:39:05Z","lastAt":"2009-08-21T14:24:48Z","messageCount":3,"participants":["Wilhansen Li","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"121395","messageId":"bc9549a50908202339h61525d3fo23199313cabe25e5@mail.gmail.com","threadId":"20681","inReplyTo":null,"subject":"[PATCH] Add support for the Mongoose web server.","fromName":"Wilhansen Li","fromEmail":"wil@nohakostudios.net","sentAt":"2009-08-21T06:39:05Z","receivedAt":"2009-08-21T06:39:05Z","isPatch":true,"sender":{"key":"wil@nohakostudios.net","avatar":null},"body":"Mongoose (http://code.google.com/p/mongoose/) is a lightweight web\nserver. It's just a single binary so it's a lot simpler to configure and\ninstall.\n\nSigned-off-by: Wilhansen Li <wil@nohakostudios.net>\n---\n git-instaweb.sh |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++----\n 1 files changed, 53 insertions(+), 5 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 5f5cac7..2acf707 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -77,11 +77,30 @@ start_httpd () {\n \tresolve_full_httpd\n\n \t# don't quote $full_httpd, there can be arguments to it (-f)\n-\t$full_httpd \"$fqgitdir/gitweb/httpd.conf\"\n-\tif test $? != 0; then\n-\t\techo \"Could not execute http daemon $httpd.\"\n-\t\texit 1\n-\tfi\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\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+\n+\t\tif test $? != 0; then\n+\t\t\techo \"Could not execute http daemon $httpd.\"\n+\t\t\texit 1\n+\t\tfi\n+\n+\t\tcat > \"$fqgitdir/pid\" <<EOF\n+$pid\n+EOF\n+\t\t;;\n+\t*)\n+\t\t$full_httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\tif test $? != 0; then\n+\t\t\techo \"Could not execute http daemon $httpd.\"\n+\t\t\texit 1\n+\t\tfi\n+\t\t;;\n+\tesac\n }\n\n stop_httpd () {\n@@ -308,6 +327,32 @@ EOF\n \tfi\n }\n\n+mongoose_conf() {\n+\tcat > \"$conf\" <<EOF\n+# Mongoose web server configuration file.\n+# Lines starting with '#' and empty lines are ignored.\n+# For detailed description of every option, visit\n+# http://code.google.com/p/mongoose/wiki/MongooseManual\n+\n+root\t\t$fqgitdir/gitweb\n+ports\t\t$port\n+index_files\tgitweb.cgi\n+#ssl_cert\t$fqgitdir/gitweb/ssl_cert.pem\n+error_log\t$fqgitdir/gitweb/error.log\n+access_log\t$fqgitdir/gitweb/access.log\n+\n+#cgi setup\n+cgi_env\t\tPATH=/usr/local/bin:/usr/bin:/bin,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH\n+cgi_interp\t$PERL\n+cgi_ext\t\tcgi,pl\n+\n+# mimetype mapping\n+mime_types\t.gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-tgz,.tar=application/x-tar,.zip=application/zip,.gif=image/gif,.jpg=image/jpeg,.jpeg=image/jpeg,.png=image/png,.css=text/css,.html=text/html,.htm=text/html,.js=text/javascript,.c=text/plain,.cpp=text/plain,.log=text/plain,.conf=text/plain,.text=text/plain,.txt=text/plain,.dtd=text/xml,.bz2=application/x-bzip,.tbz=application/x-bzip-compressed-tar,.tar.bz2=application/x-bzip-compressed-tar\n+EOF\n+#\ttest x\"$local\" = xtrue && echo 'server.bind = \"127.0.0.1\"' >> \"$conf\"\n+}\n+\n+\n script='\n s#^(my|our) \\$projectroot =.*#$1 \\$projectroot = \"'$(dirname \"$fqgitdir\")'\";#;\n s#(my|our) \\$gitbin =.*#$1 \\$gitbin = \"'$GIT_EXEC_PATH'\";#;\n@@ -344,6 +389,9 @@ case \"$httpd\" in\n webrick)\n \twebrick_conf\n \t;;\n+*mongoose*)\n+\tmongoose_conf\n+\t;;\n *)\n \techo \"Unknown httpd specified: $httpd\"\n \texit 1\n-- \n1.6.4\n"},{"id":"121397","messageId":"7vvdkhip3a.fsf@alter.siamese.dyndns.org","threadId":"20681","inReplyTo":"bc9549a50908202339h61525d3fo23199313cabe25e5@mail.gmail.com","subject":"Re: [PATCH] Add support for the Mongoose web server.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-21T07:49:13Z","receivedAt":"2009-08-21T07:49:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n\nYou would need to also update Documentation/git-instaweb.txt.  Grep for\n\"lighttpd\" or \"webrick\" to find where you would want to add mention of\ntheir new friend.\n"},{"id":"121432","messageId":"bc9549a50908210724u66caafadv630c31e6ecc1f28a@mail.gmail.com","threadId":"20681","inReplyTo":"7vvdkhip3a.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Add support for the Mongoose web server.","fromName":"Wilhansen Li","fromEmail":"wil@nohakostudios.net","sentAt":"2009-08-21T14:24:48Z","receivedAt":"2009-08-21T14:24:48Z","isPatch":true,"sender":{"key":"wil@nohakostudios.net","avatar":null},"body":"I hope I did this right (the word wraps). I took the liberty to sort\nthe server list.\n---\nMongoose (http://code.google.com/p/mongoose/) is a lightweight web\nserver. It's just a single binary so it's a lot simpler to configure and\ninstall.\n\nSigned-off-by: Wilhansen Li <wil@nohakostudios.net>\n---\n Documentation/git-instaweb.txt |    2 +-\n git-instaweb.sh                |   57 ++++++++++++++++++++++++++++++++++++---\n 2 files changed, 53 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt\nindex 22da21a..0771f25 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 lighttpd, apache2 and webrick are supported.\n+\tCurrently apache2, lighttpd, mongoose and webrick are supported.\n \t(Default: lighttpd)\n\n -m::\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 5f5cac7..d96eddb 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -77,11 +77,30 @@ start_httpd () {\n \tresolve_full_httpd\n\n \t# don't quote $full_httpd, there can be arguments to it (-f)\n-\t$full_httpd \"$fqgitdir/gitweb/httpd.conf\"\n-\tif test $? != 0; then\n-\t\techo \"Could not execute http daemon $httpd.\"\n-\t\texit 1\n-\tfi\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\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+\n+\t\tif test $? != 0; then\n+\t\t\techo \"Could not execute http daemon $httpd.\"\n+\t\t\texit 1\n+\t\tfi\n+\n+\t\tcat > \"$fqgitdir/pid\" <<EOF\n+$pid\n+EOF\n+\t\t;;\n+\t*)\n+\t\t$full_httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\tif test $? != 0; then\n+\t\t\techo \"Could not execute http daemon $httpd.\"\n+\t\t\texit 1\n+\t\tfi\n+\t\t;;\n+\tesac\n }\n\n stop_httpd () {\n@@ -308,6 +327,31 @@ EOF\n \tfi\n }\n\n+mongoose_conf() {\n+\tcat > \"$conf\" <<EOF\n+# Mongoose web server configuration file.\n+# Lines starting with '#' and empty lines are ignored.\n+# For detailed description of every option, visit\n+# http://code.google.com/p/mongoose/wiki/MongooseManual\n+\n+root\t\t$fqgitdir/gitweb\n+ports\t\t$port\n+index_files\tgitweb.cgi\n+#ssl_cert\t$fqgitdir/gitweb/ssl_cert.pem\n+error_log\t$fqgitdir/gitweb/error.log\n+access_log\t$fqgitdir/gitweb/access.log\n+\n+#cgi setup\n+cgi_env\t\tPATH=/usr/local/bin:/usr/bin:/bin,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH\n+cgi_interp\t$PERL\n+cgi_ext\t\tcgi,pl\n+\n+# mimetype mapping\n+mime_types\t.gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-tgz,.tar=application/x-tar,.zip=application/zip,.gif=image/gif,.jpg=image/jpeg,.jpeg=image/jpeg,.png=image/png,.css=text/css,.html=text/html,.htm=text/html,.js=text/javascript,.c=text/plain,.cpp=text/plain,.log=text/plain,.conf=text/plain,.text=text/plain,.txt=text/plain,.dtd=text/xml,.bz2=application/x-bzip,.tbz=application/x-bzip-compressed-tar,.tar.bz2=application/x-bzip-compressed-tar\n+EOF\n+}\n+\n+\n script='\n s#^(my|our) \\$projectroot =.*#$1 \\$projectroot = \"'$(dirname \"$fqgitdir\")'\";#;\n s#(my|our) \\$gitbin =.*#$1 \\$gitbin = \"'$GIT_EXEC_PATH'\";#;\n@@ -344,6 +388,9 @@ case \"$httpd\" in\n webrick)\n \twebrick_conf\n \t;;\n+*mongoose*)\n+\tmongoose_conf\n+\t;;\n *)\n \techo \"Unknown httpd specified: $httpd\"\n \texit 1\n-- \n1.6.4\n"}]}