From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Fri, 15 May 2015 14:34:45 +0100 Subject: Troubles using special characters in links with lighttpd In-Reply-To: <1431695573.7047.2.camel@gmail.com> References: <1431691703.5085.4.camel@gmail.com> <20150515122429.GD10518@serenity.lan> <20150515123910.GE10518@serenity.lan> <1431695573.7047.2.camel@gmail.com> Message-ID: <20150515133445.GF10518@serenity.lan> On Fri, May 15, 2015 at 03:12:53PM +0200, David Demelier wrote: > On Fri, 2015-05-15 at 13:39 +0100, John Keeping wrote: > > On Fri, May 15, 2015 at 01:24:29PM +0100, John Keeping wrote: > > > > C > > > > So I think what's happening is that you rewrite the URL from: > > > > /code/tree/C++ > > > > to: > > > > /cgit.cgi?url=code/tree/C++ > > > > but now the path is in the query part not the path part and the escaping > > rules are different, so "+" translates to " ". > > > > Thanks for your quick answer! > > Okay, I understand the problem. I can't remember where do I saw the > usage of url parameter instead. > > I've switched to this instead : > $HTTP["host"] == "git.malikania.fr" { > server.errorlog = > "/var/log/lighttpd/cgit-error.log" > accesslog.filename = "/var/log/lighttpd/cgit-access.log" > > server.document-root = "/usr/local/www/cgit" > cgi.assign = ( ".cgi" => "/usr/local/www/cgit/cgit.cgi" ) > index-file.names = ( "cgit.cgi" ) > > $HTTP["url"] =~ "^/(.*)\.git" { > url.rewrite-once = ( > "^(.*)?$" => "/cgit.cgi/$1" > ) > } > } > > I conditionnaly rewrite links only when searching for a directory > starting with .git (so that the cgit.css is not broken). > > Works correctly now :-) > > Only have to name my repositories with trailing .git though, if you have > an idea how I can improve that. With Apache I have: RewriteCond %{REQUEST_FILENAME} !-f so that any request that doesn't match a file gets rewritten and passed to CGit. I suspect you can do something similar in lighttpd providing you don't need to serve anything that is neither a file nor a CGit request.