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/03/16 21:42:29 UTC
[jira] Commented: (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:comment-tabpanel&focusedCommentId=13007685#comment-13007685 ]
Leif Hedstrom commented on TS-686:
----------------------------------
As an observation:
many of the "getter" functions, that currently take a TSMBuffer parameter (bufp), really don't need it. In general, only the "setters" needs the bufp. This is true for APIs such as
{code}
TSUrlHostGet()
TSUrlPathGet()
{code}
etc. I think this is an argument for merging the "TSMBuffer" in with the new object specific "MLocs". That way, it can be hidden away that TSUrlHostGet() doesn't need a bufp, and yet we can keep the signatures for getters and setters the same.
> 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: 2.1.8
>
>
> 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