From b637f7f700438f0812e9ed3e329b43895300c6c0 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 19 Oct 2008 18:13:47 -0400 Subject: initial bug report --- doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn (limited to 'doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn') diff --git a/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn b/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn new file mode 100644 index 000000000..c272d4b4f --- /dev/null +++ b/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn @@ -0,0 +1,8 @@ +I spent hours trying to understand why my wiki suddenly refused me to log in (using passwordauth). +The failure message was always: `login failed, perhaps you need to turn on cookies?` + +Inspecting the cookie information (thanks to Iceweasel's webdeveloper add-on), I realized there were some weird-looking encoded chars in the cookie name. + +Replacing "·" with "-" in `wikiname` fixed this login issue. + +(BTW, such a char was replaced by -I don't remember what encoding thingie- in my setup file, when running `ikiwiki-transition setupformat`.) -- cgit v1.2.3 From 3e992b758b0d7e96f369372340b95d8ef4302aae Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 19 Oct 2008 21:07:12 -0400 Subject: Fix issue with utf-8 in wikiname breaking session cookies, by entity-encoding the wikiname in the session cookie. --- IkiWiki/CGI.pm | 4 ++-- debian/changelog | 2 ++ doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index dac522eea..4399d0dcb 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -278,9 +278,9 @@ sub check_banned ($$) { #{{{ sub cgi_getsession ($) { #{{{ my $q=shift; - eval q{use CGI::Session}; + eval q{use CGI::Session; use HTML::Entities}; error($@) if $@; - CGI::Session->name("ikiwiki_session_".encode_utf8($config{wikiname})); + CGI::Session->name("ikiwiki_session_".encode_entities($config{wikiname})); my $oldmask=umask(077); my $session = eval { diff --git a/debian/changelog b/debian/changelog index 1f47f614e..352329f94 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ ikiwiki (2.68) UNRELEASED; urgency=low * Plugins that used to override displaytime should instead override formattime. displaytime will call that, and may wrap markup around the formatted time. + * Fix issue with utf-8 in wikiname breaking session cookies, by + entity-encoding the wikiname in the session cookie. -- Joey Hess Fri, 17 Oct 2008 20:11:02 -0400 diff --git a/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn b/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn index c272d4b4f..7c71ff0ff 100644 --- a/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn +++ b/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn @@ -5,4 +5,10 @@ Inspecting the cookie information (thanks to Iceweasel's webdeveloper add-on), I Replacing "·" with "-" in `wikiname` fixed this login issue. +> Hmm, Recai sent me a patch a long time ago to handle utf-8 here by encoding +> the wikiname. But it doesn't seem to work, somehow the encoded utf-8 +> value still doesn't make it through. (CGI::Session seems to have underermined utf-8 +> issues too.) Seems like I will have to possibly break some sessions and +> entity-encode the wikiname in the cookie.. done. --[[Joey]] + (BTW, such a char was replaced by -I don't remember what encoding thingie- in my setup file, when running `ikiwiki-transition setupformat`.) -- cgit v1.2.3 From 423fae6f18853bfaa08f647e7e4d10b7587738e0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 19 Oct 2008 21:23:48 -0400 Subject: Use the pure perl Data::Dumper when generating setup files to ensure that utf-8 characters are written out as such, and not as the encoded perl strings the C Data::Dumper produces. Note that the text produced by the C version was interpreted fine when ikiwiki loaded the setup file. But it was not user-friendly. --- IkiWiki/Setup/Standard.pm | 2 ++ debian/changelog | 3 +++ doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn') diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index 92f887f0c..e6bff2826 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -26,6 +26,8 @@ sub dumpline ($$$$) { #{{{ local $Data::Dumper::Pad="\t"; local $Data::Dumper::Sortkeys=1; local $Data::Dumper::Quotekeys=0; + # only the perl version preserves utf-8 in output + local $Data::Dumper::Useperl=1; my $dumpedvalue; if (($type eq 'boolean' || $type eq 'integer') && $value=~/^[0-9]+$/) { diff --git a/debian/changelog b/debian/changelog index 352329f94..e53799306 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,6 +14,9 @@ ikiwiki (2.68) UNRELEASED; urgency=low formatted time. * Fix issue with utf-8 in wikiname breaking session cookies, by entity-encoding the wikiname in the session cookie. + * Use the pure perl Data::Dumper when generating setup files to ensure that + utf-8 characters are written out as such, and not as the encoded perl + strings the C Data::Dumper produces. -- Joey Hess Fri, 17 Oct 2008 20:11:02 -0400 diff --git a/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn b/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn index 7c71ff0ff..5d5e90f7a 100644 --- a/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn +++ b/doc/bugs/unicode_chars_in_wikiname_break_auth.mdwn @@ -9,6 +9,8 @@ Replacing "·" with "-" in `wikiname` fixed this login issue. > the wikiname. But it doesn't seem to work, somehow the encoded utf-8 > value still doesn't make it through. (CGI::Session seems to have underermined utf-8 > issues too.) Seems like I will have to possibly break some sessions and -> entity-encode the wikiname in the cookie.. done. --[[Joey]] +> entity-encode the wikiname in the cookie.. [[done]]. --[[Joey]] (BTW, such a char was replaced by -I don't remember what encoding thingie- in my setup file, when running `ikiwiki-transition setupformat`.) + +> Thanks for the heads up, fixed that too. --[[Joey]] -- cgit v1.2.3