You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Alan M. Carroll (JIRA)" <ji...@apache.org> on 2016/03/22 23:39:25 UTC

[jira] [Commented] (TS-1980) Provide API for a plugin to also specify which body factory template to use for errors

    [ https://issues.apache.org/jira/browse/TS-1980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15207448#comment-15207448 ] 

Alan M. Carroll commented on TS-1980:
-------------------------------------

Note to self - you had a pull request for this that was documentation only for API review. PR-272.

> 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
>            Assignee: Alan M. Carroll
>             Fix For: sometime
>
>
> 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)