You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Leif Hedstrom (JIRA)" <ji...@apache.org> on 2011/05/15 07:52:47 UTC

[jira] [Updated] (TS-686) Change location in the APIs to be type specific

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

Leif Hedstrom updated TS-686:
-----------------------------

    Fix Version/s:     (was: 2.1.9)
                   sometime

Moving out, probably for a v3.99 release (pre-4.0). Please move back if you wish to work on this for v2.1.9 in the next week or two.

> Change location in the APIs to be type specific
> -----------------------------------------------
>
>                 Key: TS-686
>                 URL: https://issues.apache.org/jira/browse/TS-686
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: TS API
>    Affects Versions: 2.1.6
>            Reporter: Bryan Call
>            Priority: Minor
>             Fix For: sometime
>
>
> Change arguments for APIs to use type specific combinations of buffer and location instead of having generic types (e.g., TSMBuffer, TSMLoc) that can be interchanged.
> Leif and I talked about this more after I sent and email to dev@ and we agreed that combining the buffer and location would be better unless there are a lot of APIs that require then to passed in separately.  Looking over the APIs I don't think this is the case.
> Also, we talked about possibly having request and response being the same type, so there wouldn't be two version of some of the APIs (e.g., TSHttpHdrUrlGet())
> Parts of my email to dev@:
> Looking at the three APIs below it is hard to tell the location/offset 
> really point to:
>   tsapi TSReturnCode TSHttpTxnClientReqGet(TSHttpTxn txnp, TSMBuffer* 
> bufp, TSMLoc* offset);
>   tsapi TSReturnCode TSHttpHdrUrlGet(TSMBuffer bufp, TSMLoc offset, 
> TSMLoc* locp);
>   tsapi const char* TSUrlSchemeGet(TSMBuffer bufp, TSMLoc offset, int 
> *length);
> In a specific case that happened last week a person was taking bufp and 
> offset from TSHttpTxnClientReqGet() and passing the values to 
> TSUrlSchemeGet().  Since it didn't give him compile errors he only saw 
> the problem when the server was under load and it would core dump.
> One way to fix this would be to change locations to specific types.  If 
> we want to take it a step further the buffer and location could be 
> combined and given a specific type simplifying the APIs.
> Example of combining buffer and location and making specific types (IMO 
> cleaner):
>   tsapi TSReturnCode TSHttpTxnClientReqGet(TSHttpTxn txnp, TSRequest 
> *request);
>   tsapi TSReturnCode TSHttpHdrUrlGet(TSRequest request, TSUrl *url);
>   tsapi const char* TSUrlSchemeGet(TSUrl url, int *length);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira