Commit Graph

35 Commits

Author SHA1 Message Date
Alex Schroeder
0872647101 webdav: new tests using cadaver, when installed 2017-05-22 12:23:15 +02:00
Alex Schroeder
7a0dc0a18e Qualify OddMuse::Modified in a different package 2017-05-22 12:23:15 +02:00
Alex Schroeder
340478ffd8 For PUT and POST, CGI will read STDIN
You can get the content via the parameters POSTDATA and PUTDATA. For
other methods, however, this doesn't work and you still need to read
STDIN. One such method is PROPFIND.
2017-05-22 12:23:15 +02:00
Alex Schroeder
46cb69a6c3 Use helper functions for accessing the file system
As we derive a lot of filenames from strings in UTF-8 encoded files, we
need to make sure that any filename that might might be set by a user –
including all the filenames containing a directory deriving from
$DataDir – are passed through utf8::encode. That is, every character
gets replaced with a sequence of one or more characters that represent
the individual bytes of the character and the UTF8 flag is turned off.

In other words, -d $DataDir might not work if $DataDir contains a UTF-8
encoded string. The solution is to use the following replacements:

-f $name            IsFile($name)
-e $name            IsFile($name)
-d $name            IsDir($name)
(stat($name))[9]    Modified($name)
-M $name            $Now - Modified($name)
-z $name            ZeroSize($name)
unlink $name        Unlink($name)
mkdir $name         CreateDir($name)
rmdir $name         RemoveDir($name)

(Using IsFile for -e is probably not ideal?)

If you don’t, and Oddmuse gets used with Mojolicious, and you use the
Namespaces Extension, and a namespace contains non-ASCII characters such
as ä, ö, or ü, these characters will end up as part of $DataDir and
trigger the problem.

I also wonder whether we should be using some other Perl library.
2016-06-17 14:49:34 +02:00
Alex Schroeder
0ec8dd44e6 use v5.10 everywhere + enabled test in meta.t 2015-08-18 10:48:03 +02:00
Alex Schroeder
5efaf324e1 Revert "Changed EN DASH to - in copyright lines"
This reverts commit 06c7fedec0.
2015-07-28 22:44:53 +02:00
Alex Schroeder
8f3db6ebfe Changed EN DASH to - in copyright lines
The EN DASH is not really required in year ranges such as 2012–2015 when
we're talking about comments in source code that is probably being
displayed in a fixed font anyway. Changing back to an ordinary hypen
allows us to make a meaningful test for use utf8.
2015-07-28 22:14:37 +02:00
Alex Schroeder
c6e490dcb5 Remove $NewText and $NewComment.
$NewText is replaced by a call to NewText() which you can overwrite. Or
you can provide translations for the texts used by NewText(). Basically,
the new text explains that the page in question does not exist and
invites you edit it.
2015-07-03 13:01:32 +02:00
Alex Schroeder
9ee69088ab webdav.pl: Hide 'once' warnings
Without this it throws warnings like 'Name "OddMuse::ScriptName" used only once'.
It is unclear whether these warnings make any sense. We will hide them for now.
2015-04-14 23:36:58 +03:00
Alex Schroeder
d77ef1e07d Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2015-04-13 07:59:57 +02:00
Alex Schroeder
0225c1e4a2 webdav.pl: Add "if $verbose" to two warnings 2015-04-13 07:59:00 +02:00
Alex Schroeder
238b58ae62 No more "*Sub = *NewSub", \&NewSub used instead. (Completely now!) 2015-04-12 22:50:50 +03:00
Alex Schroeder
482888cfaf No more "*Sub = *NewSub", \&NewSub used instead. (Partial progress) 2015-04-11 23:41:33 +03:00
Alex Schroeder
5d2db4b547 No more "use vars"! 2015-04-10 13:31:28 +03:00
Alex Schroeder
ef8f0a3743 webdav.pl replace Perl license with GPL
According to http://dev.perl.org/licenses/ the Perl license is either
the GPL or the Artistic license. We'll pick the GPL so that it matches
the rest of Oddmuse.
2015-03-28 14:36:13 +01:00
Alex Schroeder
a4e0e5a9be "use strict;" in modules (some modules have problems) 2015-03-27 03:01:01 +02:00
Alex Schroeder
e6d3ad8382 Fixed typo in AddModuleDescription sub name 2014-08-21 22:23:23 +02:00
Alex Schroeder
17bd795ef0 Automatically reformatted modules 2014-08-21 07:29:46 +03:00
Alex Schroeder
2d6b2d6a71 Remove $HttpCharset and moved everything to UTF-8
This also required some changes to the tests where explicit UTF-8
encoding had been used in the past.
2012-05-22 11:50:23 +02:00
Alex Schroeder
c9e39a4c19 getting rid of $Id$ tags in $WikiDescription
Replaced the $Id$ tags in $WikiDescription for all the modules and wiki.pl itself with a link to the source and an appropriate wiki page, if possible. This is shown in action=version and should help users figure out what another wiki has installed.
2012-04-19 02:18:45 +02:00
Alex Schroeder
9f8d3b6d0c (body): Comment warning. 2006-09-12 16:39:58 +00:00
Alex Schroeder
486be74a78 Make warnings depend on a local variable instead of being commented
out.
2005-09-18 13:49:53 +00:00
Alex Schroeder
9e36c5f9d1 (lock, unlock): Fake them.
(%implemented): List lock.
(options): Use DAV: 1 header.
2005-09-18 13:12:14 +00:00
Alex Schroeder
0e02397561 (propfind): Handle UTF-8 correctly because the displayname is not
URL encoded.
2005-08-30 20:23:34 +00:00
Alex Schroeder
2308b354a5 (propfind): Removed warning. 2005-08-30 13:38:18 +00:00
Alex Schroeder
1c7933ad7f ($WebDavCache): New option.
(propfind_data): Use cached data if appropriate.
(propfind): Add support for displayname and getetag properties.
Use propfind_data() to cache data.  Add etag to the response even
though the RFC says PROPFIND should not be cached.  No longer use
libraries for decoding and escaping.
(DavNewOpenPage): Add 'created' property to all pages.
2005-08-30 12:58:41 +00:00
Alex Schroeder
3529ef8b7e (put): Add support for image/png. 2005-08-29 20:58:17 +00:00
Alex Schroeder
b5dffa127a (put): Bugfix 2005-08-29 20:47:28 +00:00
Alex Schroeder
e13f53fd60 (options): Don't send DAV header, since we're
not even a class 1 server.
(put): Handle image/jpeg files using magic bytes.
(no_content): New.
2005-08-29 18:03:05 +00:00
Alex Schroeder
0c2a189232 Removed warnings. 2005-08-28 21:04:55 +00:00
Alex Schroeder
6f209c075e Added $ModulesDescription 2005-08-28 20:19:57 +00:00
Alex Schroeder
6cb4dd88cb (get): Removed cookie code. 2005-08-28 19:48:56 +00:00
Alex Schroeder
dea2ca2539 Removed some dependencies 2005-08-28 19:21:27 +00:00
Alex Schroeder
c0ca2beb5f Works with cadaver! 2005-08-28 19:09:09 +00:00
Alex Schroeder
90b436b7bb work in progress 2005-08-26 23:52:20 +00:00