Sophie

Sophie

distrib > Mageia > 3 > x86_64 > by-pkgid > 334c73eb2cbee096307b926bf8d6e67a > files > 150

ocaml-pxp-devel-1.2.3-5.mga3.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Pxp_reader.norm_system_id-c.html">
<link rel="next" href="Pxp_reader.combine-c.html">
<link rel="Up" href="Pxp_reader.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of class types" rel=Appendix href="index_class_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Pxp_types" rel="Chapter" href="Pxp_types.html">
<link title="Pxp_document" rel="Chapter" href="Pxp_document.html">
<link title="Pxp_dtd" rel="Chapter" href="Pxp_dtd.html">
<link title="Pxp_tree_parser" rel="Chapter" href="Pxp_tree_parser.html">
<link title="Pxp_core_types" rel="Chapter" href="Pxp_core_types.html">
<link title="Pxp_ev_parser" rel="Chapter" href="Pxp_ev_parser.html">
<link title="Pxp_event" rel="Chapter" href="Pxp_event.html">
<link title="Pxp_dtd_parser" rel="Chapter" href="Pxp_dtd_parser.html">
<link title="Pxp_codewriter" rel="Chapter" href="Pxp_codewriter.html">
<link title="Pxp_marshal" rel="Chapter" href="Pxp_marshal.html">
<link title="Pxp_yacc" rel="Chapter" href="Pxp_yacc.html">
<link title="Pxp_reader" rel="Chapter" href="Pxp_reader.html">
<link title="Intro_trees" rel="Chapter" href="Intro_trees.html">
<link title="Intro_extensions" rel="Chapter" href="Intro_extensions.html">
<link title="Intro_namespaces" rel="Chapter" href="Intro_namespaces.html">
<link title="Intro_events" rel="Chapter" href="Intro_events.html">
<link title="Intro_resolution" rel="Chapter" href="Intro_resolution.html">
<link title="Intro_getting_started" rel="Chapter" href="Intro_getting_started.html">
<link title="Intro_advanced" rel="Chapter" href="Intro_advanced.html">
<link title="Intro_preprocessor" rel="Chapter" href="Intro_preprocessor.html">
<link title="Example_readme" rel="Chapter" href="Example_readme.html"><title>PXP Reference : Pxp_reader.rewrite_system_id</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Pxp_reader.norm_system_id-c.html" title="Pxp_reader.norm_system_id">Previous</a>
&nbsp;<a class="up" href="Pxp_reader.html" title="Pxp_reader">Up</a>
&nbsp;<a class="post" href="Pxp_reader.combine-c.html" title="Pxp_reader.combine">Next</a>
</div>
<h1>Class <a href="type_Pxp_reader.rewrite_system_id.html">Pxp_reader.rewrite_system_id</a></h1>
<pre><span name="TYPErewrite_system_id"><span class="keyword">class</span> rewrite_system_id</span> : <code class="type">?forward_unmatching_urls:bool -> (string * string) list -> <a href="Pxp_reader.resolver-c.html">resolver</a> -> </code><code class="type"><a href="Pxp_reader.resolver-c.html">resolver</a></code></pre>Rewrites the URL's according to the list of pairs. The left
 component is the pattern, the right component is the substitute.
 For example,
<p>

 <code class="code">&nbsp;<span class="keyword">new</span>&nbsp;rewrite_system_id<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&nbsp;<span class="string">"http://host/foo/"</span>,&nbsp;<span class="string">"file:///dir/"</span>&nbsp;]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r<br>
&nbsp;</code>
<p>

 rewrites all URLs beginning with <code class="code">http://host/foo/</code> to <code class="code">file:///dir/</code>,
 e.g. <code class="code">http://host/foo/x</code> becomes <code class="code">file:///dir/x</code>.
<p>

 If the pattern ends with a slash (as in the example), a prefix match
 is performed, i.e. the whole directory hierarchy is rewritten.
 If the pattern does not end with a slash, an exact match is performed,
 i.e. only a single URL is rewritten.
<p>

 The class normalizes URLs as <code class="code">norm_system_id</code> does, before the match
 is tried.
<p>

 By default, URLs that do not match any pattern are rejected
 (<code class="code"><span class="constructor">Not_competent</span></code>).
<p>

 The rewritten URL is only visible within the passed subresolver.
 If the opened entity accesses other entities by relative URLs,
 these will be resolved relative to the original URL as it was before
 rewriting it. This gives some protection against unwanted accesses.
 For example, if you map <code class="code">http://host/contents</code> to <code class="code">file:///data/contents</code>,
 it will not be possible to access files outside this directory,
 even if tricks are used like opening <code class="code">../../etc/passwd</code> relative to
 <code class="code">http://host/contents</code>.  Of course, this protection works only if
 the resolver opening the file is a subresolver of <code class="code">rewrite_system_id</code>.
<p>

 Another application of this class is to use the identity as rewriting
 rule. This resolver
<p>

 <code class="code">&nbsp;<span class="keyword">new</span>&nbsp;rewrite_system_id<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[&nbsp;<span class="string">"file:///data/"</span>,&nbsp;<span class="string">"file:///data/"</span>&nbsp;]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;<span class="keyword">new</span>&nbsp;resolve_as_file()&nbsp;)<br>
&nbsp;</code>
<p>

 has the effect that only files under <code class="code">/data</code> can be accessed, and
 other such as <code class="code">/etc/passwd</code> cannot.
<p>

 Option <code class="code">forward_unmatching_urls</code>: If true, URLs that do not match any
   pattern are forwarded to the inner resolver. These URLs are not
   rewritten. <b>Note that the mentioned access restrictions do not
   work anymore if this option is turned on.</b><br>
<hr width="100%">
</body></html>