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 => '',
# 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
}
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;
* 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
-- 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
[[!tag ipv6]]
> [[done]] --[[Joey]]
+
+> > Thank you! --[[cstamas]]
--- /dev/null
+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.
--- /dev/null
+[[!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.
+
+"""]]
--- /dev/null
+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?)
--- /dev/null
+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>
* [*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
========================
* [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)
* 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.)
>>>> 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.
--- /dev/null
+[Debian Developer](http://wiki.debian.org/LucaCapello)
+
+[homepage](http://luca.pca.it)
+
+[write me](mailto:luca@pca.it)
[[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]]