Roxen.git / server / modules / filters / url_rectifier.pike

version» Context lines:

Roxen.git/server/modules/filters/url_rectifier.pike:1:   // This is a roxen module. Copyright © 1999 - 2009, Roxen IS.   // This module implements an IE5/Macintosh fix; if no file is found, assume   // the url is UTF-8 or Macintosh encoded.      inherit "module";   #include <request_trace.h>    - constant cvs_version = "$Id: url_rectifier.pike,v 1.18 2009/05/07 14:15:54 mast Exp $"; + constant cvs_version = "$Id$";   constant thread_safe = 1;   constant module_type = MODULE_LAST;   constant module_name = "URL Rectifier";   constant module_doc = "If no file is found, assume the url is "    "UTF-8 or Macintosh encoded and try again.";      int unsuccessful = 0;   array(string) encodings = ({ "utf-8", "macintosh", "iso-2022" });   mapping(string:int) redirs = ([]);   mapping(string:function) decoders = ([]);      void start()   {    foreach( encodings, string enc )    if( enc == "utf-8" )    decoders[ enc ] = utf8_to_string;    else -  decoders[ enc ]= Roxen._charset_decoder(Locale.Charset.decoder(enc))->decode; +  decoders[ enc ]= Roxen._charset_decoder(Charset.decoder(enc))->decode;   }      string status()   {    int successful = sizeof(redirs)?`+(@values(redirs)):0;    int all = successful + unsuccessful;    return sprintf( "<p><b>%d%%</b> (%d out of %d) of all "    "potential 404:s were saved by this module.</p>"    "<table><tr><th>Encoding</th><th>Caught</th></tr>\n"    "%{<tr><td>%s</td><td>%d</td></tr>\n%}"