[ 
https://issues.apache.org/jira/browse/TS-1980?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Susan Hinrichs updated TS-1980:
-------------------------------
    Fix Version/s:     (was: 5.2.0)
                   6.0.0

> 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
>             Fix For: 6.0.0
>
>
> 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to