Mercurial > hg > nginx-quic
view docs/xslt/content.xslt @ 4147:7f64de1cc2c0
Fix for double content when return is used in error_page handler.
Test case:
location / {
error_page 405 /nope;
return 405;
}
location /nope {
return 200;
}
This is expected to return 405 with empty body, but in 0.8.42+ will return
builtin 405 error page as well (though not counted in Content-Length, thus
breaking protocol).
Fix is to use status provided by rewrite script execution in case
it's less than NGX_HTTP_BAD_REQUEST even if r->error_status set. This
check is in line with one in ngx_http_script_return_code().
Note that this patch also changes behaviour for "return 302 ..." and
"rewrite ... redirect" used as error handler. E.g.
location / {
error_page 405 /redirect;
return 405;
}
location /redirect {
rewrite ^ http://example.com/;
}
will actually return redirect to "http://example.com/" instead of builtin 405
error page with meaningless Location header. This looks like correct change
and it's in line with what happens on e.g. directory redirects in error
handlers.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 27 Sep 2011 11:11:30 +0000 |
parents | dc1fa52222b4 |
children |
line wrap: on
line source
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="section[@id and @name]"> <a name="{@id}"/> <center> <h4> <xsl:value-of select="@name"/> </h4> </center> <xsl:apply-templates/> </xsl:template> <xsl:template match="section[not(@id) and @name]"> <center> <h4> <xsl:value-of select="@name"/> </h4> </center> <xsl:apply-templates/> </xsl:template> <xsl:template match="section[not(@id) and not(@name)]"> <xsl:apply-templates/> </xsl:template> <xsl:template match="para"> <p> <xsl:apply-templates/> </p> </xsl:template> <xsl:template match="c-def"> <code> <xsl:apply-templates/> </code> </xsl:template> <xsl:template match="c-func"> <code> <xsl:apply-templates/> <xsl:text>()</xsl:text> </code> </xsl:template> <xsl:template match="code"> <code> <xsl:apply-templates/> </code> </xsl:template> <xsl:template match="command"> <code> <xsl:apply-templates/> </code> </xsl:template> <xsl:template match="dq"> <xsl:text disable-output-escaping="yes">&ldquo;</xsl:text> <xsl:apply-templates/> <xsl:text disable-output-escaping="yes">&rdquo;</xsl:text> </xsl:template> <xsl:template match="example"> <blockquote> <pre> <xsl:apply-templates/> </pre> </blockquote> </xsl:template> <xsl:template match="emphasis"> <strong> <xsl:apply-templates/> </strong> </xsl:template> <xsl:template match="header"> <code> <xsl:apply-templates/> </code> </xsl:template> <xsl:template match="http-status"> <xsl:value-of select="@code"/> <xsl:text> (</xsl:text> <xsl:value-of select="@text"/> <xsl:text>)</xsl:text> </xsl:template> <xsl:template match="link[@url]"> <a href="{@url}"> <xsl:apply-templates/> </a> </xsl:template> <xsl:template match="link[@id and not(@doc)]"> <a href="#{@id}"> <xsl:apply-templates/> </a> </xsl:template> <xsl:template match="link[@doc and not(@id)]"> <a href="{substring-before(@doc, '.xml')}.html"> <xsl:apply-templates/> </a> </xsl:template> <xsl:template match="link[@id and @doc]"> <a href="{substring-before(@doc, '.xml')}.html#{@id}"> <xsl:apply-templates/> </a> </xsl:template> <xsl:template match="link"> <u> <xsl:apply-templates/> </u> </xsl:template> <xsl:template match="list[@type='bullet']"> <ul> <xsl:apply-templates/> </ul> </xsl:template> <xsl:template match="list[@type='enum']"> <ol> <xsl:apply-templates/> </ol> </xsl:template> <xsl:template match="listitem"> <li> <xsl:apply-templates/> </li> </xsl:template> <xsl:template match="list[@type='tag']"> <dl compact=""> <xsl:apply-templates/> </dl> </xsl:template> <xsl:template match="tag-name"> <dt> <xsl:apply-templates/> </dt> </xsl:template> <xsl:template match="tag-desc"> <dd> <xsl:apply-templates/> </dd> </xsl:template> <xsl:template match="pathname"> <code> <xsl:apply-templates/> </code> </xsl:template> <xsl:template match="argument"> <code> <i> <xsl:apply-templates/> </i> </code> </xsl:template> <xsl:template match="parameter"> <code> <xsl:apply-templates/> </code> </xsl:template> <xsl:template match="value"> <code> <xsl:apply-templates/> </code> </xsl:template> <xsl:template match="var"> <code> <xsl:apply-templates/> </code> </xsl:template> </xsl:stylesheet>