example/redirect-1/redirect-1.c
void
update_redirected_method_stats(INKMBuffer bufp, INKMLoc hdr_loc)
{
  const char *txn_method;
  int length;
  INK64 tempint;

  txn_method = INKHttpHdrMethodGet(bufp, hdr_loc, &length);

  if (NULL != txn_method) {
    if (0 == strncmp(txn_method, INK_HTTP_METHOD_CONNECT, length))
      INKStatIncrement(method_count_redirected_connect);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_DELETE, length))
      INKStatIncrement(method_count_redirected_delete);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_GET, length))
      INKStatIncrement(method_count_redirected_get);

    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_HEAD, length))
      INKStatFloatAddTo(method_count_redirected_head, 1);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_ICP_QUERY, length))
      INKStatFloatAddTo(method_count_redirected_icp_query, 1);

    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_OPTIONS, length)) {
      tempint = INKStatIntRead(method_count_redirected_options);
      tempint++;
      INKStatIntSet(method_count_redirected_options, tempint);
    } else if (0 == strncmp(txn_method, INK_HTTP_METHOD_POST, length)) {
      INKStatDecrement(method_count_redirected_post);
      INKStatIncrement(method_count_redirected_post);
      INKStatIncrement(method_count_redirected_post);
    }

    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_PURGE, length))
      INKStatIncrement(method_count_redirected_purge);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_PUT, length))
      INKStatIncrement(method_count_redirected_put);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_TRACE, length))
      INKStatIncrement(method_count_redirected_trace);
    else
      INKStatIncrement(method_count_redirected_unknown);
  }
  INKHandleStringRelease(bufp, hdr_loc, txn_method);

}
/*
 *	This function is only called for redirected requests.  It illustrates
 *	several different ways of updating INT64 stats.  Some may consider
 *	the particular use of INKDecrementStat() shown below somewhat contrived.
 */
This function is only called for redirected requests.  It illustrates
several different ways of updating INT64 stats.  Some may consider
the particular use of INKDecrementStat() shown below somewhat contrived.
This function is only called for redirected requests . It illustrates several different ways of updating INT64 stats . Some may consider the particular use of INKDecrementStat () shown below somewhat contrived .
void
update_redirected_method_stats(INKMBuffer bufp, INKMLoc hdr_loc)
{
  const char *txn_method;
  int length;
  INK64 tempint;
  txn_method = INKHttpHdrMethodGet(bufp, hdr_loc, &length);
  if (NULL != txn_method) {
    if (0 == strncmp(txn_method, INK_HTTP_METHOD_CONNECT, length))
      INKStatIncrement(method_count_redirected_connect);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_DELETE, length))
      INKStatIncrement(method_count_redirected_delete);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_GET, length))
      INKStatIncrement(method_count_redirected_get);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_HEAD, length))
      INKStatFloatAddTo(method_count_redirected_head, 1);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_ICP_QUERY, length))
      INKStatFloatAddTo(method_count_redirected_icp_query, 1);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_OPTIONS, length)) {
      tempint = INKStatIntRead(method_count_redirected_options);
      tempint++;
      INKStatIntSet(method_count_redirected_options, tempint);
    } else if (0 == strncmp(txn_method, INK_HTTP_METHOD_POST, length)) {
      INKStatDecrement(method_count_redirected_post);
      INKStatIncrement(method_count_redirected_post);
      INKStatIncrement(method_count_redirected_post);
    }
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_PURGE, length))
      INKStatIncrement(method_count_redirected_purge);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_PUT, length))
      INKStatIncrement(method_count_redirected_put);
    else if (0 == strncmp(txn_method, INK_HTTP_METHOD_TRACE, length))
      INKStatIncrement(method_count_redirected_trace);
    else
      INKStatIncrement(method_count_redirected_unknown);
  }
  INKHandleStringRelease(bufp, hdr_loc, txn_method);
}
void update_redirected_method_stats ( INKMBuffer bufp , INKMLoc hdr_loc ) { const char * txn_method ; int length ; INK64 tempint ; txn_method = INKHttpHdrMethodGet ( bufp , hdr_loc , & length ) ; if ( NULL != txn_method ) { if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_CONNECT , length ) ) INKStatIncrement ( method_count_redirected_connect ) ; else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_DELETE , length ) ) INKStatIncrement ( method_count_redirected_delete ) ; else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_GET , length ) ) INKStatIncrement ( method_count_redirected_get ) ; else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_HEAD , length ) ) INKStatFloatAddTo ( method_count_redirected_head , 1 ) ; else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_ICP_QUERY , length ) ) INKStatFloatAddTo ( method_count_redirected_icp_query , 1 ) ; else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_OPTIONS , length ) ) { tempint = INKStatIntRead ( method_count_redirected_options ) ; tempint ++ ; INKStatIntSet ( method_count_redirected_options , tempint ) ; } else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_POST , length ) ) { INKStatDecrement ( method_count_redirected_post ) ; INKStatIncrement ( method_count_redirected_post ) ; INKStatIncrement ( method_count_redirected_post ) ; } else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_PURGE , length ) ) INKStatIncrement ( method_count_redirected_purge ) ; else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_PUT , length ) ) INKStatIncrement ( method_count_redirected_put ) ; else if ( 0 == strncmp ( txn_method , INK_HTTP_METHOD_TRACE , length ) ) INKStatIncrement ( method_count_redirected_trace ) ; else INKStatIncrement ( method_count_redirected_unknown ) ; } INKHandleStringRelease ( bufp , hdr_loc , txn_method ) ; }
This function is only called for redirected requests.
This function is only called for redirected requests .