Branch: Tag:

2006-12-14

2006-12-14 13:06:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Backported option to disable RXML parsing from Roxen 4.6.

Rev: server/modules/filesystems/filesystem.pike:1.151

7:   inherit "module";   inherit "socket";    - constant cvs_version= "$Id: filesystem.pike,v 1.150 2005/12/13 15:45:54 anders Exp $"; + constant cvs_version= "$Id: filesystem.pike,v 1.151 2006/12/14 13:06:34 grubba Exp $";   constant thread_safe=1;      #include <module.h>
158:    LOCALE(24,"All directories containing any of these files will not be "    "browsable."));    +  defvar("no-parse", 0, LOCALE(0, "Raw files"), TYPE_FLAG|VAR_MORE, +  LOCALE(0, "If set files from this filesystem will be returned " +  "without any further processing. This disables eg RXML " +  "parsing of files."));       defvar("tilde", 0, LOCALE(25,"Show backup files"), TYPE_FLAG|VAR_MORE,    LOCALE(26,"If set, files ending with '~', '#' or '.bak' will "+
887:    id->realfile = norm_f;    TRACE_LEAVE("");    accesses++; -  TRACE_LEAVE("Normal return"); +     if( charset != "iso-8859-1" )    {    if( id->set_output_charset )    id->set_output_charset( charset, 2 );    id->misc->input_charset = charset;    } -  +  if (query("no-parse")) { +  TRACE_ENTER("Content-type mapping module", types_module); +  array(string) tmp = conf->type_from_filename(norm_f, 1); +  TRACE_LEAVE(tmp?sprintf("Returned type %s %s.", tmp[0], tmp[1]||"") +  : "Missing type."); +  TRACE_LEAVE("No parse return"); +  return Roxen.http_file_answer(o, tmp[0]) + ([ "encoding":tmp[1] ]); +  } +  TRACE_LEAVE("Normal return");    return o;    }    break;