Leif Hedstrom created TS-1980:
---------------------------------
Summary: Provide API for a plugin to also specify which body
factory template to use for errors
Key: TS-1980
URL: https://issues.apache.org/jira/browse/TS-1980
Project: Traffic Server
Issue Type: New Feature
Components: TS API
Reporter: Leif Hedstrom
Right now, there are only two APIs that allows plugins to set the HTTP status
code and body message:
{code}
tsapi void TSHttpTxnSetHttpRetBody(TSHttpTxn txnp, const char* body_msg, int
plain_msg);
tsapi void TSHttpTxnSetHttpRetStatus(TSHttpTxn txnp, TSHttpStatus
http_retstatus);
{code}
Since the body factory ("templates") are now the only way to produce error
messages from within ATS itself, these APIs are now lacking a way to specify
which template to use. I imagine three possibilities (at least):
1) Make the last argument to TSHttpTxnSetHttpRetBody() be a multi-value
variable, with the semantics of
0 - body is HTML
1 - body is plain text
2 - body is a factory template name (e.g. "access#denied" or "shrek#ogre").
This is probably pretty safe, but perhaps not super pretty.
2) Make TSHttpTxnSetHttpRetStatus() also take a body factory argument, e.g.
{code}
tsapi void TSHttpTxnSetHttpRetStatus(TSHttpTxn txnp, TSHttpStatus
http_retstatus, const char* factory);
{code}
factory should probably be a string here, and not constants, because users can
put in arbitrary file names into the body factory. The string really is the
filename. This would break compatibility of the APIs I think.
3) We add a new API, e.g.
{code}
tsapi void TSHttpTxnSetHttpFactory(TSHttpTxn txnp, const char* factory);
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira