]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge branch 'master' of git://github.com/wking/ikiwiki
authorJoey Hess <joey@kitenet.net>
Wed, 10 Oct 2012 14:43:36 +0000 (10:43 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 10 Oct 2012 14:43:36 +0000 (10:43 -0400)
14 files changed:
IkiWiki.pm
IkiWiki/Wrapper.pm
debian/changelog
doc/bugs/CGI_wrapper_doesn__39__t_store_PERL5LIB_environment_variable.mdwn
doc/bugs/ipv6_address_in_comments.mdwn
doc/forum/Multiple_urls.mdwn [new file with mode: 0644]
doc/forum/Multiple_urls/comment_1_e4c1256346d5a421161c20e344d8bada._comment [new file with mode: 0644]
doc/forum/Setting_http__95__proxy.mdwn [new file with mode: 0644]
doc/ikiwiki/directive/meta/discussion.mdwn [new file with mode: 0644]
doc/ikiwikiusers.mdwn
doc/tipjar.mdwn
doc/todo/Restrict_page_viewing.mdwn
doc/users/LucaCapello.mdwn [new file with mode: 0644]
doc/users/hb/discussion.mdwn

index f68797ae3b962bc7556308fffa0da5d644c46ca3..a7dc6b36bb4557be43cde21d9158f7dd607d5d68 100644 (file)
@@ -118,6 +118,14 @@ sub getsetup () {
                safe => 0,
                rebuild => 0,
        },
+       cgi_overload_delay => {
+               type => "string",
+               default => '',
+               example => "10",
+               description => "number of seconds to delay CGI requests when overloaded",
+               safe => 1,
+               rebuild => 0,
+       },
        rcs => {
                type => "string",
                default => '',
index 769540d29ac3de34715436ead21416747d3b09b4..0855a3ba2ede3194d0d71a9697db246c1b619c31 100644 (file)
@@ -93,12 +93,43 @@ EOF
                # memory, a pile up of processes could cause thrashing
                # otherwise. The fd of the lock is stored in
                # IKIWIKI_CGILOCK_FD so unlockwiki can close it.
-               $pre_exec=<<"EOF";
+               #
+               # A lot of cgi wrapper processes can potentially build
+               # up and clog an otherwise unloaded web server. To
+               # partially avoid this, when a GET comes in and the lock
+               # is already held, rather than blocking a html page is
+               # constructed that retries. This is enabled by setting
+               # cgi_overload_delay.
+               if (defined $config{cgi_overload_delay} &&
+                   $config{cgi_overload_delay} =~/^[0-9]+/) {
+                       my $i=int($config{cgi_overload_delay});
+                       $pre_exec.="#define CGI_OVERLOAD_DELAY $i\n"
+                               if $i > 0;
+               }
+               $pre_exec.=<<"EOF";
        lockfd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR, 0666);
-       if (lockfd != -1 && lockf(lockfd, F_LOCK, 0) == 0) {
-               char *fd_s=malloc(8);
-               sprintf(fd_s, "%i", lockfd);
-               setenv("IKIWIKI_CGILOCK_FD", fd_s, 1);
+       if (lockfd != -1) {
+#ifdef CGI_OVERLOAD_DELAY
+               char *request_method = getenv("REQUEST_METHOD");
+               if (request_method && strcmp(request_method, "GET") == 0) {
+                       if (lockf(lockfd, F_TLOCK, 0) == 0) {
+                               set_cgilock_fd(lockfd);
+                       }
+                       else {
+                               printf("Content-Type: text/html\\nRefresh: %i; URL=%s\\n\\n<html><head><title>please wait...</title><head><body><p>Please wait ...</p></body></html>",
+                                       CGI_OVERLOAD_DELAY,
+                                       getenv("REQUEST_URI"));
+                               exit(0);
+                       }
+               }
+               else if (lockf(lockfd, F_LOCK, 0) == 0) {
+                       set_cgilock_fd(lockfd);
+               }
+#else
+               if (lockf(lockfd, F_LOCK, 0) == 0) {
+                       set_cgilock_fd(lockfd);
+               }
+#endif
        }
 EOF
        }
@@ -140,6 +171,12 @@ void addenv(char *var, char *val) {
        newenviron[i++]=s;
 }
 
+set_cgilock_fd (int lockfd) {
+       char *fd_s=malloc(8);
+       sprintf(fd_s, "%i", lockfd);
+       setenv("IKIWIKI_CGILOCK_FD", fd_s, 1);
+}
+
 int main (int argc, char **argv) {
        int lockfd=-1;
        char *s;
index 8d7618753d96f2bf8fd28930dd08e65d819fd916..842eb680677c0a4c3bddec4397c6632649a41230 100644 (file)
@@ -3,6 +3,14 @@ ikiwiki (3.20120726) UNRELEASED; urgency=low
   * monochrome: New theme, contributed by Jon Dowland.
   * rst: Ported to python 3, while still also being valid python 2.
     Thanks, W. Trevor King
+  * Try to avoid a situation in which so many ikiwiki cgi wrapper programs
+    are running, all waiting on some long-running thing like a site rebuild,
+    that it prevents the web server from doing anything else. The current
+    approach only avoids this problem for GET requests; if multiple cgi's
+    run GETs on a site at the same time, one will display a "please wait"
+    page for a configurable number of seconds, which then redirects to retry.
+    To enable this protection, set cgi_overload_delay to the number of
+    seconds to wait. This is not enabled by default.
 
  -- Joey Hess <joeyh@debian.org>  Thu, 30 Aug 2012 11:56:12 -0400
 
index 0da368644055e5003b2e70fe986a377b339ca5a0..81a5abf2862e0430ff566c758e0fe5ebc6ce3fff 100644 (file)
@@ -6,3 +6,23 @@ I think the CGI wrapper should remember PERL5LIB too.
 
 -- Martin
 
+Thank's a lot for pointing me to this location in the code. I was looking it for some time.
+
+This brutal patch implement your solution as a temporary fix.
+
+    *** Wrapper.pm.old      2012-08-25 16:41:41.000000000 +0200
+    --- Wrapper.pm  2012-10-01 17:33:17.582956524 +0200
+    ***************
+    *** 149,154 ****
+    --- 149,155 ----
+      $envsave
+            newenviron[i++]="HOME=$ENV{HOME}";
+            newenviron[i++]="PATH=$ENV{PATH}";
+    +       newenviron[i++]="PERL5LIB=$ENV{PERL5LIB}";
+            newenviron[i++]="WRAPPED_OPTIONS=$configstring";
+      
+      #ifdef __TINYC__
+
+As I am not sure that remembering `PERL5LIB` is a good idea, I think that a prettier solution will be to add a config variable (let's say `cgi_wrapper_perllib`) which, if fixed, contains the `PERL5LIB` value to include in the wrapper, or another (let's say `cgi_wrapper_remember_libdir`), which, if fixed, remember the current `PERL5LIB`.
+
+-- Bruno
index 5e535b9196298d0e29f4b3e409ee57fa0e1d256b..90391650a2ada0000ed7eedd7e45546b18a39629 100644 (file)
@@ -15,3 +15,5 @@ the problem for me. Not sure if this is the best solution. --[[cstamas]]
 [[!tag ipv6]]
 
 > [[done]] --[[Joey]] 
+
+> > Thank you! --[[cstamas]]
diff --git a/doc/forum/Multiple_urls.mdwn b/doc/forum/Multiple_urls.mdwn
new file mode 100644 (file)
index 0000000..03125d2
--- /dev/null
@@ -0,0 +1,8 @@
+Hi,
+Is there a way of making a given ikiwiki instance accessible both from the LAN where it's server is and from the WAN?
+
+Say I have ikiwiki installed on a server connected to a router. That router has  port forwarding and dyndns configured so I could open ikiwiki from outside the LAN. Trying to open normal ikiwiki pages, from outside the LAN, or with a proxy, works. However, the Editing and Preferences pages, for example, redirect to http://192.168.x.x/~username/ikiwiki/ikiwiki.cgi?page=posts%2Fhello_world&do=edit (in the case of the edit page), which of course only exists inside the LAN, and fails loading.
+
+Editing the "url" and "cgiurl" directives in the .setup file to point to the dyndns address makes it work from the outside, but I can't edit the pages from inside the LAN anymore with this configuration. The normal pages, once again, are accessible. Edit or Preferences, on the other hand, redirect to the public address, which I can't open from inside the same LAN it points to.
+
+For this reason I ask, is there an way to have multiple urls point to the same ikiwiki page, namely a LAN IP url and a public IP one? Thanks in advance.
diff --git a/doc/forum/Multiple_urls/comment_1_e4c1256346d5a421161c20e344d8bada._comment b/doc/forum/Multiple_urls/comment_1_e4c1256346d5a421161c20e344d8bada._comment
new file mode 100644 (file)
index 0000000..9806f53
--- /dev/null
@@ -0,0 +1,22 @@
+[[!comment format=mdwn
+ username="http://kerravonsen.dreamwidth.org/"
+ ip="60.241.8.244"
+ subject="A Few Ways To Do This"
+ date="2012-10-09T02:02:09Z"
+ content="""
+I don't think one can alter IkiWiki to have multiple URLs, because the URL is built in to the CGI when the CGI is generated.
+
+1. Use the external hostname (say, foo.com) for the URL, and tell your local machine that foo.com has an IP of 192.168.x.x, thus making it accessible from within the LAN.
+2. Give the URL as a relative-absolute URL; that is, rather than \"http://foo.com/ikiwiki.cgi\" give it as \"/ikiwiki.cgi\". This doesn't always work, though.
+3. Build two versions of the site from the same git repo. One for access from inside, and one for access from outside. Both setup files would need to be identical, apart from
+
+    * the destination directory
+    * the URLs
+    * the git-update file name; one would need to call it something other than post-update.
+    
+    Then one would make a new \"post-update\" file which calls *both* of the ikiwiki post-update scripts, so that both versions of the site are updated when you make a change.
+    Then set up your web-server to point to the \"external\" directory for the external site, and the \"internal\" directory for the internal site; easy enough to do if you use virtual hosts.
+
+Yes, I know the third one is somewhat complex... I use the idea myself in order to make two versions of a site where one is editable and the other is not, but that's not what you're aiming for, I know.
+
+"""]]
diff --git a/doc/forum/Setting_http__95__proxy.mdwn b/doc/forum/Setting_http__95__proxy.mdwn
new file mode 100644 (file)
index 0000000..3bf8a76
--- /dev/null
@@ -0,0 +1,22 @@
+Hi! My wiki is behind a proxy and, as I understood looking in the web, I need to set the environment variables using ENV inside the wiki's config.
+
+So far I tried:
+
+ENV: {
+  http_proxy => 'http://proxy.uns.edu.ar:1280/',
+  https_proxy => 'http://proxy.uns.edu.ar:1280/'
+}
+
+without luck, as I get:
+
+
+YAML::XS::Load Error: The problem:
+
+    found unexpected ':'
+
+was found at document: 1, line: 85, column: 22
+while scanning a plain scalar at line: 85, column: 3
+usage: ikiwiki [options] source dest
+       ikiwiki --setup configfile
+
+What am I missing? (maybe learning perl?)
diff --git a/doc/ikiwiki/directive/meta/discussion.mdwn b/doc/ikiwiki/directive/meta/discussion.mdwn
new file mode 100644 (file)
index 0000000..ed5618b
--- /dev/null
@@ -0,0 +1,65 @@
+Is there any reason the [language attribute](https://en.wikipedia.org/wiki/Meta_element#The_language_attribute) is not supported?
+--[[LucaCapello]]
+
+> Attached a patch against the Git repository, working on Debian ikiwiki_3.20100815.9. --[[LucaCapello]]
+
+[[patch]]
+
+-----
+
+<pre>
+From 680e57fd384b65e289d92054835687f3d6f3a19d Mon Sep 17 00:00:00 2001
+From: Luca Capello <luca@pca.it>
+Date: Sat, 6 Oct 2012 14:11:19 +0200
+Subject: [PATCH] IkiWiki/Plugin/meta.pm: support the language attribute
+
+---
+ IkiWiki/Plugin/meta.pm          |    9 +++++++++
+ doc/ikiwiki/directive/meta.mdwn |    4 ++++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
+index 421f1dc..1a49f0c 100644
+--- a/IkiWiki/Plugin/meta.pm
++++ b/IkiWiki/Plugin/meta.pm
+@@ -102,6 +102,10 @@ sub preprocess (@) {
+               $pagestate{$page}{meta}{description}=$value;
+               # fallthrough
+       }
++      elsif ($key eq 'language') {
++              $pagestate{$page}{meta}{language}=$value;
++              # fallthrough
++      }
+       elsif ($key eq 'guid') {
+               $pagestate{$page}{meta}{guid}=$value;
+               # fallthrough
+@@ -279,6 +283,11 @@ sub preprocess (@) {
+               push @{$metaheaders{$page}}, '<meta name="'.$key.
+                       '" content="'.encode_entities($value).'" />';
+       }
++      elsif ($key eq 'language') {
++              push @{$metaheaders{$page}},
++                      '<meta http-equiv="Content-Language" content="'.
++                      encode_entities($value).'" />';
++      }
+       elsif ($key eq 'name') {
+               push @{$metaheaders{$page}}, scrub('<meta name="'.
+                       encode_entities($value).
+diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn
+index 984f685..b82fa58 100644
+--- a/doc/ikiwiki/directive/meta.mdwn
++++ b/doc/ikiwiki/directive/meta.mdwn
+@@ -59,6 +59,10 @@ Supported fields:
+   Specifies a short description for the page. This will be put in
+   the html header, and can also be displayed by eg, the [[map]] directive.
++* language
++
++  Specifies the natural language for the page, for example, "en".
++
+ * keywords
+   Specifies keywords summarizing the contents of the page. This
+-- 
+1.7.10.4
+</pre>
index 8e641b69a1aa1525cfef2320340e9e82938148c6..d53351106d8b6058c54c91513288d06bdf825e3c 100644 (file)
@@ -82,6 +82,7 @@ Projects & Organizations
 * [*BSD UNIX user group in Denmark](http://www.bsd-dk.dk/)
 * [Telecomix Broadcast System](http://broadcast.telecomix.org/)
 * [WikiMIX.cc](http://WikiMIX.cc/)
+* Paris Observatory [Information System website](http://dio.obspm.fr/), also used for internal documentation
 
 Personal sites and blogs
 ========================
@@ -181,3 +182,4 @@ Personal sites and blogs
 * [Waldgarten]( http://waldgarten.greenonion.org/ ) News and documentation of a permaculture inspired neighbourhood-garden located in Hamburg, Germany.
 * [[OscarMorante]]'s [personal site](http://oscar.morante.eu).
 * [Puckspage]( http://www.puckspage.org/ ) Political and personal blog in German. The name comes from the elf out of midsummer nights dream.  
+* [[LucaCapello]]'s [homepage](http://luca.pca.it)
index ae612e129d8812bd2c9b8e1d12570b11bb27f623..6d65a0a70a87447fc819d810fba6425436a224e3 100644 (file)
@@ -19,6 +19,7 @@ Thanks to the following people for their kind contributions:
 * Nico Schottelius
 * Jon Dowland
 * Amitai Schlair
+* Luca Capello
 
 (Note that this page is locked to prevent anyone from tampering with the PayPal button.
 If you prefer your donation *not* be listed here, let [[Joey]] know.)
index 9c1889d63b88d40cba94cd58cc1e464e0962c2fb..20b59cb13f396566a4d33f7fa21c203caacbdec0 100644 (file)
@@ -37,3 +37,6 @@ much more maintainable htaccess file.
 
 >>>> Yes, I think this could probably be used in combination with ikiwiki's
 >>>> httpauth and openid plugins. --[[Joey]] 
+
+>>>>> If you use the httpauth and the cgiauthurl method, you can restrict a path 
+>>>>> like /private/* to be accessible only under the authenticated request uri.
diff --git a/doc/users/LucaCapello.mdwn b/doc/users/LucaCapello.mdwn
new file mode 100644 (file)
index 0000000..5ddccbf
--- /dev/null
@@ -0,0 +1,5 @@
+[Debian Developer](http://wiki.debian.org/LucaCapello)
+
+[homepage](http://luca.pca.it)
+
+[write me](mailto:luca@pca.it)
index 15c065e45f6bbb9239477c3b27273bbc2c81b2d9..3214e15219ae3a7cf41864694b9aa4da55def628 100644 (file)
@@ -3,3 +3,4 @@ consider documenting them?  Perhaps we could turn the result into a
 [[tip|tips]]. -[[JoshTriplett]]
 > Well, certainly. Basically it's just inline + tag feature. I'm going to have more time in May for ikiwiki, I hope. 
 > > Any news about that ?
+> > > I am also interested if you do not mind to share with us. [[cstamas]]