Commit Graph

35 Commits

Author SHA1 Message Date
Alex Schroeder
71b93887dc webdav: new tests using cadaver, when installed 2017-05-22 12:23:15 +02:00
Alex Schroeder
391049ef77 Qualify OddMuse::Modified in a different package 2017-05-22 12:23:15 +02:00
Alex Schroeder
3d5aec5651 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
83f13a9a1a 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
58e9a1e240 use v5.10 everywhere + enabled test in meta.t 2015-08-18 10:48:03 +02:00
Alex Schroeder
dfa71cb2e3 Revert "Changed EN DASH to - in copyright lines"
This reverts commit 06c7fedec0.
2015-07-28 22:44:53 +02:00
Alex Schroeder
06c7fedec0 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
8d4c15e948 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
Aleks-Daniel Jakimenko
892d352b9e 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
39b8439371 Merge branch 'master' of git.sv.gnu.org:/srv/git/oddmuse 2015-04-13 07:59:57 +02:00
Alex Schroeder
e703a3ca89 webdav.pl: Add "if $verbose" to two warnings 2015-04-13 07:59:00 +02:00
Aleks-Daniel Jakimenko
17b2562054 No more "*Sub = *NewSub", \&NewSub used instead. (Completely now!) 2015-04-12 22:50:50 +03:00
Aleks-Daniel Jakimenko
40ec24349a No more "*Sub = *NewSub", \&NewSub used instead. (Partial progress) 2015-04-11 23:41:33 +03:00
Aleks-Daniel Jakimenko
6f8d281d79 No more "use vars"! 2015-04-10 13:31:28 +03:00
Alex Schroeder
46a5a32348 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
Aleks-Daniel Jakimenko
4492ede096 "use strict;" in modules (some modules have problems) 2015-03-27 03:01:01 +02:00
Alex Schroeder
5aba2ae56f Fixed typo in AddModuleDescription sub name 2014-08-21 22:23:23 +02:00
Alex Jakimenko
ee932dee37 Automatically reformatted modules 2014-08-21 07:29:46 +03:00
Alex Schroeder
cd2b4d624e 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
f11e2a8731 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
fa2e9751d4 (body): Comment warning. 2006-09-12 16:39:58 +00:00
Alex Schroeder
d5a193cddf Make warnings depend on a local variable instead of being commented
out.
2005-09-18 13:49:53 +00:00
Alex Schroeder
6f65ac8097 (lock, unlock): Fake them.
(%implemented): List lock.
(options): Use DAV: 1 header.
2005-09-18 13:12:14 +00:00
Alex Schroeder
7c85dfabaa (propfind): Handle UTF-8 correctly because the displayname is not
URL encoded.
2005-08-30 20:23:34 +00:00
Alex Schroeder
de4cc0d15a (propfind): Removed warning. 2005-08-30 13:38:18 +00:00
Alex Schroeder
21119eb7e2 ($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
d3f0585312 (put): Add support for image/png. 2005-08-29 20:58:17 +00:00
Alex Schroeder
90a5926315 (put): Bugfix 2005-08-29 20:47:28 +00:00
Alex Schroeder
cfb47333e2 (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
2df9079524 Removed warnings. 2005-08-28 21:04:55 +00:00
Alex Schroeder
4b3b16951e Added $ModulesDescription 2005-08-28 20:19:57 +00:00
Alex Schroeder
de4cfd0ca5 (get): Removed cookie code. 2005-08-28 19:48:56 +00:00
Alex Schroeder
65822f571d Removed some dependencies 2005-08-28 19:21:27 +00:00
Alex Schroeder
d2928e8fb4 Works with cadaver! 2005-08-28 19:09:09 +00:00
Alex Schroeder
dbe9878e9c work in progress 2005-08-26 23:52:20 +00:00