|
| 1 | +.. Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 | + contributor license agreements. See the NOTICE file distributed |
| 3 | + with this work for additional information regarding copyright |
| 4 | + ownership. The ASF licenses this file to you under the Apache |
| 5 | + License, Version 2.0 (the "License"); you may not use this file |
| 6 | + except in compliance with the License. You may obtain a copy of |
| 7 | + the License at |
| 8 | +
|
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +
|
| 11 | + Unless required by applicable law or agreed to in writing, software |
| 12 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 14 | + implied. See the License for the specific language governing |
| 15 | + permissions and limitations under the License. |
| 16 | +
|
| 17 | +.. include:: ../../../common.defs |
| 18 | + |
| 19 | +.. default-domain:: cpp |
| 20 | + |
| 21 | +TSHttpTxnCacheKeyDigestGet |
| 22 | +************************** |
| 23 | + |
| 24 | +Synopsis |
| 25 | +======== |
| 26 | + |
| 27 | +.. code-block:: cpp |
| 28 | +
|
| 29 | + #include <ts/ts.h> |
| 30 | +
|
| 31 | +.. function:: TSReturnCode TSHttpTxnCacheKeyDigestGet(TSHttpTxn txnp, char *buffer, int *length) |
| 32 | + |
| 33 | +Description |
| 34 | +=========== |
| 35 | + |
| 36 | +Get the effective cache key digest (cryptographic hash) that was used for |
| 37 | +cache lookup or storage on this transaction. This is the raw hash bytes, |
| 38 | +not a hex or base64 encoding. |
| 39 | + |
| 40 | +The digest size depends on the build configuration: 16 bytes for MD5 |
| 41 | +(default) or 32 bytes for SHA-256 (FIPS mode). A 32-byte buffer is |
| 42 | +sufficient for either mode: |
| 43 | + |
| 44 | +.. code-block:: c |
| 45 | +
|
| 46 | + char digest[32]; |
| 47 | + int digest_len = sizeof(digest); |
| 48 | + if (TSHttpTxnCacheKeyDigestGet(txnp, digest, &digest_len) == TS_SUCCESS) { |
| 49 | + // digest_len contains the actual number of bytes written |
| 50 | + } |
| 51 | +
|
| 52 | +Pass :code:`nullptr` for *buffer* to query the digest size without |
| 53 | +copying. |
| 54 | + |
| 55 | +Returns :enumerator:`TS_SUCCESS` if a cache key was computed for the |
| 56 | +transaction. Returns :enumerator:`TS_ERROR` if no cache lookup was |
| 57 | +performed, or if *buffer* is non-null and *\*length* is smaller than the |
| 58 | +digest size. In all cases *\*length* is set to the required digest size |
| 59 | +on return. |
| 60 | + |
| 61 | +See Also |
| 62 | +======== |
| 63 | + |
| 64 | +:func:`TSHttpTxnCacheLookupUrlGet` |
0 commit comments