Eliminate string copies in the SDK
-----------------------------------
Key: TS-579
URL: https://issues.apache.org/jira/browse/TS-579
Project: Traffic Server
Issue Type: Bug
Components: TSAPI
Reporter: Leif Hedstrom
Fix For: 2.1.5
Attachments: TS-579.diff
There are a small'ish number of APIs, that (for legacy reasons I believe) makes
copies of the marshalled header strings, just to make them NULL terminated.
None of these APIs claim to guarantee the strings to be NULL terminated, and
all of our APIs pretty much says that you should never expect strings to be
NULL terminated.
Eliminating this string duplication will make the APIs easier to use (since now
TSHandleStringRelease() is completely unecessary), and will also make plugins
faster (no mallocs and frees for these strings).
The APIs that are affected, only by contract (no API changes) are
const char * TSUrlSchemeGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlUserGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlPasswordGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlHostGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlPathGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlHttpParamsGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlHttpQueryGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSUrlHttpFragmentGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSMimeHdrFieldNameGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc field, int
*length);
const char *TSHttpHdrMethodGet(TSMBuffer bufp, TSMLoc obj, int *length);
const char *TSHttpHdrReasonGet(TSMBuffer bufp, TSMLoc obj, int *length);
TSReturnCode TSMimeHdrFieldValueStringGet(TSMBuffer bufp, TSMLoc hdr, TSMLoc
field, int idx, const char **value_ptr, int *value_len_ptr);
>From now on, these will never be NULL terminated.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.