> On Jan 30, 2018, at 9:15 AM, Walt Karas <wka...@oath.com.INVALID> wrote: > > Revised: > > const char *TSRemapFromUrlStringGet(const TSHttpTxn txnp, int &length); > > const char *TSRemapToUrlStringGet(const TSHttpTxn txnp, int &length); > > These would return, from the transaction state object, > url_map.getFromURL() and url_map.getToURL() respectively, in strong > format. A null pointer would be returned if the values were empty. > The length of the string is returned in 'length'. (Nul-termination > should not be expected/presumed.) . The plugin must release the memory > for the string by calling TSFree().
This is C, so no reference parameters. Following the existing TSAPI conventions, I'd recommend TSReturnCode TSRemapFromUrlGet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj); char * TSRemapFromUrlStringGet(TSHttpTxn txnp, int *length); TSReturnCode TSRemapToUrlGet(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc obj); char * TSRemapToUrlStringGet(TSHttpTxn txnp, int *length); In the documentation, please be sure to specify which hooks these APIs may be called from. Consider writing an example plugin that can be consumed by tests and included in the documentation. I'm a not that fazed by the StringGet() APIs proposed here, but we should consider whether we want to continue this API pattern, or defer the stringification to TSUrlStringGet(). > On Mon, Jan 29, 2018 at 4:55 PM, Walt Karas <wka...@oath.com> wrote: >> The plugin would own them and would have to call TSFree() when done >> with them. They would be nul terminated. >> >> On Mon, Jan 29, 2018 at 4:52 PM, Alan Carroll >> <solidwallofc...@oath.com.invalid> wrote: >>> What are the ownership properties of the memory indicated by the returned >>> pointers? Are these strings guaranteed to be null terminated or is a length >>> needed? >>> >>> On Mon, Jan 29, 2018 at 3:53 PM, Shu Kit Chan <chanshu...@gmail.com> wrote: >>> >>>> What does the "I" stand for in "TSIRemapFromUrlStringGet" ? >>>> >>>> On Mon, Jan 29, 2018 at 10:02 AM, Walt Karas <wka...@oath.com.invalid> >>>> wrote: >>>>> const char *TSIRemapFromUrlStringGet(const TSHttpTxn txnp); >>>>> >>>>> const char *TSIRemapToUrlStringGet(const TSHttpTxn txnp); >>>>> >>>>> These would return, from the transaction state object, >>>>> url_map.getFromURL() and url_map.getToURL() respectively, in strong >>>>> format. A null pointer would be returned if the values were empty. >>>>