Core-Gadget - Content-Rewriting
This is a DRAFT
<section title="Content Rewriting Feature">
<t>The Content Rewriting Feature defines a set of content
modification operations that a container can perform when
processing HTML and Proxied Content and defines rules that
allow developers to control which content the rewriter can
operate on.</t>
<t>The Content Rewriting Feature is specified within the <ModulePrefs>
with the feature name "content-rewrite" using either the <Optional>
or <Require> element. Multiple <Param> elements are used to
specify specific configuration options for the feature.
Containers MAY support the Content Rewriting Feature.</t>
<figure>
<preamble>For example:</preamble>
<artwork xml:space="preserve">
<Optional feature="content-rewrite">
<Param name="expires">86400</Param>
<Param name="include-url"></Param>
<Param name="exclude-url">excluded</Param>
<Param name="exclude-url">moreexcluded</Param>
<Param name="minify-css">true</Param>
<Param name="minify-js">true</Param>
<Param name="minify-html">true</Param>
</Optional>
</artwork>
</figure>
<t>The parameters supported by the "content-rewrite" feature are:
<list type="hanging">
<t hangText="expires">The duration in seconds to force as minimum HTTP
cache time for content fetched through the proxy via a rewritten URL.
The default is 86400 seconds.</t>
<t hangText="include-url">Any URL which contains this parameters value as a
case-insensitive substring is considered rewriteable. The literal string
"*" is a special case and implies all URLs. If not specified an entry
with the value "*" is assumed. This parameter MAY appear multiple times
within the <Optional> or <Require< tags.</t>
<t hangText="exclude-url">Any URL which contains this parameters value as a
case-insensitive substring is excluded from rewriting. The literal string
"*" implies all URLs and effectively disables all rewriting. This parameter
MAY appear multiple times within the <Optional> or <Require< tags.</t>
<t hangText="minify-css">Controls whether the container can attempt to
minify css in style tags and referenced css files. Valid values are
"true"|"false". Default is "true".</t>
<t hangText="minify-js">Controls whether the container can attempt to
minify JS in script tags and referenced JS files. Valid values are "true"
and "false". Default is "true".</t>
<t hangText="minify-html">Controls whether the container can attempt to minify
HTML content. Valid values are "true" and "false". Default is "true".</t>
</list></t>
<t>When values for both the "exclude-url" and "include-url" are specified,
Matches for "exclude-url" take precedence over matches for "include-url".</t>
<t>Note that the special use of "*" to denote all URLs should not be
interpreted as support for GLOB or RegEx matching on strings.</t>
<t>Containers are free to perform additional optimizations when rewriting
links including but not limited to:
<list type="symbols">
<t>Extracting @import directives from style tags and converting them into
link tags in the head tag of the containing HTML content.</t>
<t>Merging multiple CSS fetches from successive link tags into one link tag
that causes the proxy to concatenate the content fetched from the
individual URLs.</t>
<t>Merging contiguous <script src=xxx> tags into one concatenating
proxy fetch.</t>
</list></t>
<t>TODO: Need useful examples.. the ones currently in the spec aren't helpful.</t>
</section>
<!-- END CONTENT REWRITING -->