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

ASF GitHub Bot commented on TS-3726:
------------------------------------

Github user zwoop commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/772#discussion_r69379523
  
    --- Diff: proxy/api/ts/ts.h ---
    @@ -2336,6 +2336,35 @@ tsapi uint64_t TSHttpTxnIdGet(TSHttpTxn txnp);
     tsapi TSReturnCode TSBase64Decode(const char *str, size_t str_len, 
unsigned char *dst, size_t dst_size, size_t *length);
     tsapi TSReturnCode TSBase64Encode(const char *str, size_t str_len, char 
*dst, size_t dst_size, size_t *length);
     
    +/* Expose internal build_error_response function */
    +/**
    +   This method sets the requires state for an error reply, including
    +   the error text, status code, reason phrase, and reply headers.
    +
    +   The caller calls the method with the TSHttpTxn <txnp>, the
    +   HTTP status code <status_code>, a user-specified reason phrase
    +   string (or NULL) <reason_phrase_or_null>, and a printf-like
    +   text format and arguments which are appended to the error text.
    +
    +   @param txnp the transaction pointer
    +   @param status_code the HTTP status code
    +   @param reason_phrase_or_null a user-specified reason phrase string. If 
it
    +          is NULL, the default HTTP reason phrase is used.
    +   @param error_body_type the error message type, as specified by the 
HttpBodyFactory
    +          customized error page system. Get the list by command:
    +             "ls -al etc/trafficserver/body_factory/default/"
    +
    +   @param format If it is not NULL or "", it is also added to the error 
text 
    +          body as descriptive text in the error body.
    +
    +   @note reference from build_error_response: 
    +         This routine DOES NOT check for buffer overflows.  The caller 
should keep
    --- End diff --
    
    I agree. My thoughts was that we'd first cleanup the underlying body 
factory code (separate Jira's for that), such that we get clean and efficient 
APIs. And then we add public plugin APIs on top of that
    
    So, I agree that for now, we probably shouldn't commit this, but once you 
(Jari) are done with the body factory changes, you can perhaps work with Oknet 
on getting this merged?
    
    I hope that make sense?


> Expose build_error_response in order to making a formated error response in 
> plugin
> ----------------------------------------------------------------------------------
>
>                 Key: TS-3726
>                 URL: https://issues.apache.org/jira/browse/TS-3726
>             Project: Traffic Server
>          Issue Type: New Feature
>          Components: TS API
>            Reporter: Oknet Xu
>            Assignee: Oknet Xu
>              Labels: API, review
>             Fix For: 7.0.0
>
>         Attachments: TSHttpTxnErrorpageSet.patch
>
>
> expose build_error_response in order to making a formated error response in 
> plugin.
> ATS support multi-language error response page by body_factory.
> In the ATS internal, build_error_response used to generating it.
> I wrote a patch to expose build_error_response function for plugin.
> and modified example/basic_auth for a sample usage.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to