logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

TSHttpTxnServerRespGet - TSHttpTxnServerRespGet API function

Description

       Get  the  response  header  sent by the upstream server. This will only be useful in a callback on a hook
       that is called after the upstream responds, and if there was an upstream response. For instance,  if  the
       inbound  request has no remap rule and remapisrequired then there will be no server response because no
       outbound connection was made. In this case the function will return TS_ERROR.

       The response header is returned in bufp and offset. bufp is the heap in which  the  header  resides,  and
       offset  is the location in that heap. These will be used in subsequent calls to retrieve information from
       the header.

          int get_response_status(TSHttpTxn txn) {
             TSMBuffer resp_heap = nullptr;
             TSMLoc resp_hdr = nullptr;
             if (TS_SUCCESS == TSHttpTxnServerRespGet(tnx, &resp_heap, &resp_hdr)) {
                return TSHttpHdrStatusGet(resp_headp, resp_hdr);
             }
             return HTTP_STATUS_NONE;
          }

Name

       TSHttpTxnServerRespGet - TSHttpTxnServerRespGet API function

Synopsis

          #include <ts/ts.h>

       TSReturnCodeTSHttpTxnServerRespGet(TSHttpTxntxnp,TSMBuffer*bufp,TSMLoc*offset)

See Also