If the API to parse a URL from a string handles that, then that's how you would do it. Basically the same as what the current API does under the hood.
However, what if expect the use of this new API is to clone the request URL and then modify e.g. The path . -- Leif > On May 4, 2015, at 4:29 PM, Bryan Call <[email protected]> wrote: > > Can you show an example of using the new API setting the cache key to some > arbitrary string (e.g. “asdf”)? > > -Bryan > > > > >> On May 4, 2015, at 1:03 PM, Leif Hedstrom <[email protected]> wrote: >> >> This new API is the inverse of an existing API, >> TSHttpTxnCacheLookupUrlGet(). It also works similar to another existing API, >> TSCacheUrlSet(). The main difference between this new API and >> TSCacheUrlSet() is that we work on normal URL objects. This can in some >> cases avoid unnecessary string conversion + string parsing -> URL that >> happens with TSCacheUrlSet(). >> >> This new API has the prototype >> >> TSReturnCode TSHttpTxnCacheLookupUrlSet(TSHttpTxn txnp, TSMBuffer bufp, >> TSMLoc obj); >> >> >> The typical usage for this API is to modify the cache-key as used by the >> core. As such, it should work identical to TSCacheUrlSet(), except it avoids >> the string creation / parsing phase. >> >> >> The related Jira is TS-3555. There is no ABI / API incompatibility here, >> since this is a new API. Docs “diff” is attached below. >> >> Cheers, >> >> — leif >> >> >> +TSHttpTxnCacheLookupUrlSet >> +========================== >> + >> +Synopsis >> +-------- >> + >> +`#include <ts/ts.h>` >> + >> +.. c:function:: TSReturnCode TSHttpTxnCacheLookupUrlSet(TSHttpTxn txnp, >> TSMBuffer bufp, TSMLoc offset) >> + >> + >> +Description >> +----------- >> + >> +Set the current cache key URL, also referred to as the lookup URL. This must >> +be stored in a properly allocated URL object, typically created with a >> +:c:func:`TSUrlCreate()` or :c:func:`TSUrlClone()`. >
