trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r959102 - in /trafficserver/traffic/trunk: example/add-header/ example/append-transform/ example/basic-auth/ example/cache_plugin/ example/cache_scan/ example/gzip-transform/ example/redirect-1/ example/remap/ example/replace-header/ exampl...
Date Tue, 29 Jun 2010 21:10:25 GMT
Author: zwoop
Date: Tue Jun 29 21:10:24 2010
New Revision: 959102

URL: http://svn.apache.org/viewvc?rev=959102&view=rev
Log:
TS-266: Update all examples to use non-deprecated APIs.

Tested: FC13

Also moved some cache APIs over to a new ts/experimental.h file.

Modified:
    trafficserver/traffic/trunk/example/add-header/add-header.c
    trafficserver/traffic/trunk/example/append-transform/append-transform.c
    trafficserver/traffic/trunk/example/basic-auth/basic-auth.c
    trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc
    trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc
    trafficserver/traffic/trunk/example/gzip-transform/gunzip.c
    trafficserver/traffic/trunk/example/gzip-transform/gzip.c
    trafficserver/traffic/trunk/example/redirect-1/redirect-1.c
    trafficserver/traffic/trunk/example/remap/remap.cc
    trafficserver/traffic/trunk/example/replace-header/replace-header.c
    trafficserver/traffic/trunk/example/response-header-1/response-header-1.c
    trafficserver/traffic/trunk/example/session-1/session-1.c
    trafficserver/traffic/trunk/example/thread-pool/psi.c
    trafficserver/traffic/trunk/proxy/Makefile.am
    trafficserver/traffic/trunk/proxy/api/ts/ts.h
    trafficserver/traffic/trunk/proxy/api/ts/ts_private.h
    trafficserver/traffic/trunk/proxy/api/ts/ts_private_frozen.h

Modified: trafficserver/traffic/trunk/example/add-header/add-header.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/add-header/add-header.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/add-header/add-header.c (original)
+++ trafficserver/traffic/trunk/example/add-header/add-header.c Tue Jun 29 21:10:24 2010
@@ -215,7 +215,7 @@ INKPluginInit(int argc, const char *argv
       while (isspace(*p)) {
         p += 1;
       }
-      retval = INKMimeHdrFieldValueInsert(hdr_bufp, hdr_loc, field_loc, p, strlen(p), -1);
+      retval = INKMimeHdrFieldValueStringInsert(hdr_bufp, hdr_loc, field_loc, -1, p, strlen(p));
       if (retval == INK_ERROR) {
         INKError("[PluginInit] Error while inserting field value");
         goto error;

Modified: trafficserver/traffic/trunk/example/append-transform/append-transform.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/append-transform/append-transform.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/append-transform/append-transform.c (original)
+++ trafficserver/traffic/trunk/example/append-transform/append-transform.c Tue Jun 29 21:10:24
2010
@@ -269,25 +269,25 @@ transformable(INKHttpTxn txnp)
       return 0;
     }
 
-    value = INKMimeHdrFieldValueGet(bufp, hdr_loc, field_loc, 0, &val_length);
+    if (INKMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, 0, &value, &val_length)
== INK_SUCCESS) {
 #ifndef _WIN32
-    if (value && (strncasecmp(value, "text/html", sizeof("text/html") - 1) == 0))
{
+      if (value && (strncasecmp(value, "text/html", sizeof("text/html") - 1) == 0))
{
 #else
-    if (value && (strnicmp(value, "text/html", sizeof("text/html") - 1) == 0)) {
+      if (value && (strnicmp(value, "text/html", sizeof("text/html") - 1) == 0))
{
 #endif
-      ASSERT_SUCCESS(INKHandleStringRelease(bufp, field_loc, value));
-      ASSERT_SUCCESS(INKHandleMLocRelease(bufp, hdr_loc, field_loc));
-      ASSERT_SUCCESS(INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc));
+        ASSERT_SUCCESS(INKHandleStringRelease(bufp, field_loc, value));
+        ASSERT_SUCCESS(INKHandleMLocRelease(bufp, hdr_loc, field_loc));
+        ASSERT_SUCCESS(INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc));
+
+        return 1;
+      } else {
+        ASSERT_SUCCESS(INKHandleStringRelease(bufp, field_loc, value));
+        ASSERT_SUCCESS(INKHandleMLocRelease(bufp, hdr_loc, field_loc));
+        ASSERT_SUCCESS(INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc));
 
-      return 1;
-    } else {
-      ASSERT_SUCCESS(INKHandleStringRelease(bufp, field_loc, value));
-      ASSERT_SUCCESS(INKHandleMLocRelease(bufp, hdr_loc, field_loc));
-      ASSERT_SUCCESS(INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc));
-
-      return 0;
+        return 0;
+      }
     }
-
   }
 
   return 0;                     /* not a 200 */

Modified: trafficserver/traffic/trunk/example/basic-auth/basic-auth.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/basic-auth/basic-auth.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/basic-auth/basic-auth.c (original)
+++ trafficserver/traffic/trunk/example/basic-auth/basic-auth.c Tue Jun 29 21:10:24 2010
@@ -141,14 +141,13 @@ handle_dns(INKHttpTxn txnp, INKCont cont
     goto done;
   }
 
-  ptr = val = INKMimeHdrFieldValueGet(bufp, hdr_loc, field_loc, 0, &authval_length);
-
-  if (!val) {
+  if (INKMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, 0, &val, &authval_length)
!= INK_SUCCESS) {
     INKError("no value in Proxy-Authorization field\n");
     INKHandleMLocRelease(bufp, hdr_loc, field_loc);
     INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
     goto done;
   }
+  ptr = val;
 
   if (strncmp(ptr, "Basic", 5) != 0) {
     INKError("no Basic auth type in Proxy-Authorization\n");
@@ -218,8 +217,8 @@ handle_response(INKHttpTxn txnp)
 
   field_loc = INKMimeHdrFieldCreate(bufp, hdr_loc);
   INKMimeHdrFieldNameSet(bufp, hdr_loc, field_loc, INK_MIME_FIELD_PROXY_AUTHENTICATE, INK_MIME_LEN_PROXY_AUTHENTICATE);
-  INKMimeHdrFieldValueInsert(bufp, hdr_loc, field_loc, insert, len, -1);
-  INKMimeHdrFieldInsert(bufp, hdr_loc, field_loc, -1);
+  INKMimeHdrFieldValueStringInsert(bufp, hdr_loc, field_loc, -1,  insert, len);
+  INKMimeHdrFieldAppend(bufp, hdr_loc, field_loc);
 
   INKHandleMLocRelease(bufp, hdr_loc, field_loc);
   INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);

Modified: trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc (original)
+++ trafficserver/traffic/trunk/example/cache_plugin/cache_plugin.cc Tue Jun 29 21:10:24 2010
@@ -22,6 +22,7 @@
  */
 
 #include <ts/ts.h>
+#include <ts/experimental.h>
 #include <iostream>
 #include <map>
 #include <string>

Modified: trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc (original)
+++ trafficserver/traffic/trunk/example/cache_scan/cache_scan.cc Tue Jun 29 21:10:24 2010
@@ -31,6 +31,7 @@
 #include <limits.h>
 #include <stdlib.h>
 #include <ts/ts.h>
+#include <ts/experimental.h>
 
 static INKCont global_contp;
 

Modified: trafficserver/traffic/trunk/example/gzip-transform/gunzip.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/gzip-transform/gunzip.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/gzip-transform/gunzip.c (original)
+++ trafficserver/traffic/trunk/example/gzip-transform/gunzip.c Tue Jun 29 21:10:24 2010
@@ -443,7 +443,12 @@ gzip_transformable(INKHttpTxn txnp, int 
     return -4;
   }
 
-  value = INKMimeFieldValueGet(bufp, field_loc, 0, NULL);
+  if (INKMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, 0, &value, NULL) == INK_ERROR)
{
+    INKHandleMLocRelease(bufp, hdr_loc, field_loc);
+    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    return -5;
+  }
+
   if (value && (strncasecmp(value, "deflate", sizeof("deflate") - 1) == 0)) {
     INKHandleMLocRelease(bufp, hdr_loc, field_loc);
     INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
@@ -487,8 +492,8 @@ transform_plugin(INKCont contp, INKEvent
       INKHttpTxnClientReqGet(txnp, &bufp, &hdr_loc);
       ae_loc = INKMimeHdrFieldCreate(bufp, hdr_loc);
       INKMimeHdrFieldNameSet(bufp, hdr_loc, ae_loc, "Accept-Encoding", -1);
-      INKMimeHdrFieldValueInsert(bufp, hdr_loc, ae_loc, "deflate", -1, -1);
-      INKMimeHdrFieldInsert(bufp, hdr_loc, ae_loc, -1);
+      INKMimeHdrFieldValueAppend(bufp, hdr_loc, ae_loc, -1, "deflate", -1);
+      INKMimeHdrFieldAppend(bufp, hdr_loc, ae_loc);
       INKHandleMLocRelease(bufp, hdr_loc, ae_loc);
       INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
 
@@ -505,7 +510,7 @@ transform_plugin(INKCont contp, INKEvent
 
       INKHttpTxnServerRespGet(txnp, &bufp, &hdr_loc);
       field_loc = INKMimeHdrFieldFind(bufp, hdr_loc, "Content-Encoding", -1);
-      INKMimeHdrFieldDelete(bufp, hdr_loc, field_loc);
+      INKMimeHdrFieldDestroy(bufp, hdr_loc, field_loc);
       INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
 
       INKDebug("gunzip-transform", "server content transformable");

Modified: trafficserver/traffic/trunk/example/gzip-transform/gzip.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/gzip-transform/gzip.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/gzip-transform/gzip.c (original)
+++ trafficserver/traffic/trunk/example/gzip-transform/gzip.c Tue Jun 29 21:10:24 2010
@@ -175,8 +175,8 @@ gzip_transform_init(INKCont contp, GzipD
   INKHttpTxnTransformRespGet(data->txn, &bufp, &hdr_loc);
   ce_loc = INKMimeHdrFieldCreate(bufp, hdr_loc);
   INKMimeHdrFieldNameSet(bufp, hdr_loc, ce_loc, "Content-Encoding", -1);
-  INKMimeHdrFieldValueInsert(bufp, hdr_loc, ce_loc, "deflate", -1, -1);
-  INKMimeHdrFieldInsert(bufp, hdr_loc, ce_loc, -1);
+  INKMimeHdrFieldValueStringInsert(bufp, hdr_loc, ce_loc, -1, "deflate", -1);
+  INKMimeHdrFieldAppend(bufp, hdr_loc, ce_loc);
   INKHandleMLocRelease(bufp, hdr_loc, ce_loc);
   INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
 
@@ -496,7 +496,7 @@ gzip_transformable(INKHttpTxn txnp, int 
   cfield = INKMimeHdrFieldFind(cbuf, chdr, INK_MIME_FIELD_ACCEPT_ENCODING, -1);
   if (cfield) {
     nvalues = INKMimeHdrFieldValuesCount(cbuf, chdr, cfield);
-    value = INKMimeHdrFieldValueGet(cbuf, chdr, cfield, 0, NULL);
+    INKMimeHdrFieldValueStringGet(cbuf, chdr, cfield, 0, &value, NULL);
     deflate_flag = 0;
     i = 0;
     while (nvalues > 0) {
@@ -505,7 +505,7 @@ gzip_transformable(INKHttpTxn txnp, int 
         break;
       }
       i++;
-      value = INKMimeHdrFieldValueGet(cbuf, chdr, cfield, i, NULL);
+      INKMimeHdrFieldValueStringGet(cbuf, chdr, cfield, i, &value, NULL);
       nvalues--;
     }
     if (!deflate_flag) {
@@ -544,21 +544,24 @@ gzip_transformable(INKHttpTxn txnp, int 
     return -4;
   }
 
-  value = INKMimeHdrFieldValueGet(bufp, hdr_loc, field_loc, 0, NULL);
+  if (INKMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, 0, &value, NULL) == INK_ERROR)
{
+    INKHandleMLocRelease(bufp, hdr_loc, field_loc);
+    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    return -5;
+  }
+
   if (value && (strncasecmp(value, "text/", sizeof("text/") - 1) == 0)) {
     INKHandleMLocRelease(bufp, hdr_loc, field_loc);
     INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
     return 0;
+  } else if (value && (strncasecmp(value, "application/x-javascript", (sizeof("application/x-javascript")
- 1)) == 0)) {
+    INKHandleMLocRelease(bufp, hdr_loc, field_loc);
+    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    return 0;
   } else {
-    if (value && (strncasecmp(value, "application/x-javascript", (sizeof("application/x-javascript")
- 1)) == 0)) {
-      INKHandleMLocRelease(bufp, hdr_loc, field_loc);
-      INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
-      return 0;
-    } else {
-      INKHandleMLocRelease(bufp, hdr_loc, field_loc);
-      INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
-      return -5;
-    }
+    INKHandleMLocRelease(bufp, hdr_loc, field_loc);
+    INKHandleMLocRelease(bufp, INK_NULL_MLOC, hdr_loc);
+    return -5;
   }
 }
 

Modified: trafficserver/traffic/trunk/example/redirect-1/redirect-1.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/redirect-1/redirect-1.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/redirect-1/redirect-1.c (original)
+++ trafficserver/traffic/trunk/example/redirect-1/redirect-1.c Tue Jun 29 21:10:24 2010
@@ -232,8 +232,8 @@ handle_response(INKHttpTxn txnp)
 
   newfield_loc = INKMimeHdrFieldCreate(bufp, hdr_loc);
   INKMimeHdrFieldNameSet(bufp, hdr_loc, newfield_loc, INK_MIME_FIELD_LOCATION, INK_MIME_LEN_LOCATION);
-  INKMimeHdrFieldValueInsert(bufp, hdr_loc, newfield_loc, uri_redirect, strlen(uri_redirect),
-1);
-  INKMimeHdrFieldInsert(bufp, hdr_loc, newfield_loc, -1);
+  INKMimeHdrFieldValueStringInsert(bufp, hdr_loc, newfield_loc, -1, uri_redirect, strlen(uri_redirect));
+  INKMimeHdrFieldAppend(bufp, hdr_loc, newfield_loc);
 
 
   /*
@@ -334,7 +334,7 @@ update_redirected_method_stats(INKMBuffe
       INKStatFloatAddTo(method_count_redirected_icp_query, 1);
 
     else if (0 == strncmp(txn_method, INK_HTTP_METHOD_OPTIONS, length)) {
-      tempint = INKStatIntRead(method_count_redirected_options);
+      INKStatIntGet(method_count_redirected_options, &tempint);
       tempint++;
       INKStatIntSet(method_count_redirected_options, tempint);
     } else if (0 == strncmp(txn_method, INK_HTTP_METHOD_POST, length)) {

Modified: trafficserver/traffic/trunk/example/remap/remap.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/remap/remap.cc?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/remap/remap.cc (original)
+++ trafficserver/traffic/trunk/example/remap/remap.cc Tue Jun 29 21:10:24 2010
@@ -330,13 +330,13 @@ tsremap_remap(ihandle ih, rhandle rh, TS
     const char *value;
     if ((cfield = INKMimeHdrFieldFind(cbuf, chdr, INK_MIME_FIELD_DATE, -1)) != NULL) {
       fprintf(stderr, "We have \"Date\" header in request\n");
-      if ((value = INKMimeHdrFieldValueGet(cbuf, chdr, cfield, 0, NULL)) != NULL) {
+      if (INKMimeHdrFieldValueStringGet(cbuf, chdr, cfield, 0, &value, NULL) != INK_ERROR)
{
         fprintf(stderr, "Header value: %s\n", value);
       }
     }
     if ((cfield = INKMimeHdrFieldFind(cbuf, chdr, "MyHeader", sizeof("MyHeader") - 1)) !=
NULL) {
       fprintf(stderr, "We have \"MyHeader\" header in request\n");
-      if ((value = INKMimeHdrFieldValueGet(cbuf, chdr, cfield, 0, NULL)) != NULL) {
+      if (INKMimeHdrFieldValueStringGet(cbuf, chdr, cfield, 0, &value, NULL) != INK_ERROR)
{
         fprintf(stderr, "Header value: %s\n", value);
       }
     }

Modified: trafficserver/traffic/trunk/example/replace-header/replace-header.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/replace-header/replace-header.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/replace-header/replace-header.c (original)
+++ trafficserver/traffic/trunk/example/replace-header/replace-header.c Tue Jun 29 21:10:24
2010
@@ -56,16 +56,16 @@ replace_header(INKHttpTxn txnp, INKCont 
     /* set its name */
     INKMimeHdrFieldNameSet(resp_bufp, resp_loc, field_loc, INK_MIME_FIELD_ACCEPT_RANGES,
INK_MIME_LEN_ACCEPT_RANGES);
     /* set its value */
-    INKMimeHdrFieldValueInsert(resp_bufp, resp_loc, field_loc, "none", 4, -1);
+    INKMimeHdrFieldValueAppend(resp_bufp, resp_loc, field_loc, -1, "none", 4);
     /* insert it into the header */
-    INKMimeHdrFieldInsert(resp_bufp, resp_loc, field_loc, -1);
+    INKMimeHdrFieldAppend(resp_bufp, resp_loc, field_loc);
     INKHandleMLocRelease(resp_bufp, resp_loc, field_loc);
     INKHandleMLocRelease(resp_bufp, INK_NULL_MLOC, resp_loc);
   } else {
     /* clear the field */
     INKMimeHdrFieldValuesClear(resp_bufp, resp_loc, field_loc);
     /* set the value to "none" */
-    INKMimeHdrFieldValueInsert(resp_bufp, resp_loc, field_loc, "none", 4, -1);
+    INKMimeHdrFieldValueStringInsert(resp_bufp, resp_loc, field_loc, -1, "none", 4);
     INKHandleMLocRelease(resp_bufp, resp_loc, field_loc);
     INKHandleMLocRelease(resp_bufp, INK_NULL_MLOC, resp_loc);
   }

Modified: trafficserver/traffic/trunk/example/response-header-1/response-header-1.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/response-header-1/response-header-1.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/response-header-1/response-header-1.c (original)
+++ trafficserver/traffic/trunk/example/response-header-1/response-header-1.c Tue Jun 29 21:10:24
2010
@@ -105,27 +105,27 @@ modify_header(INKHttpTxn txnp, INKCont c
     INKMimeHdrFieldCopy(resp_bufp, resp_loc, new_field_loc, hdr_bufp, hdr_loc, field_loc);
 
         /*********** Unclear why this is needed **************/
-    INKMimeHdrFieldInsert(resp_bufp, resp_loc, new_field_loc, -1);
+    INKMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
 
 
     /* Cache-Control: Public */
     new_field_loc = INKMimeHdrFieldCreate(resp_bufp, resp_loc);
     INKDebug("resphdr", "Created new resp field with loc %d", new_field_loc);
-    INKMimeHdrFieldInsert(resp_bufp, resp_loc, new_field_loc, -1);
+    INKMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
     INKMimeHdrFieldNameSet(resp_bufp, resp_loc, new_field_loc,
                            INK_MIME_FIELD_CACHE_CONTROL, INK_MIME_LEN_CACHE_CONTROL);
-    INKMimeHdrFieldValueInsert(resp_bufp, resp_loc, new_field_loc,
-                               INK_HTTP_VALUE_PUBLIC, strlen(INK_HTTP_VALUE_PUBLIC), -1);
+    INKMimeHdrFieldValueStringInsert(resp_bufp, resp_loc, new_field_loc,
+                                     -1, INK_HTTP_VALUE_PUBLIC, INK_HTTP_LEN_PUBLIC);
 
     /*
      * mimehdr2_name  = INKstrdup( "x-date-200-recvd" ) : CurrentDateTime
      */
     new_field_loc = INKMimeHdrFieldCreate(resp_bufp, resp_loc);
     INKDebug("resphdr", "Created new resp field with loc %d", new_field_loc);
-    INKMimeHdrFieldInsert(resp_bufp, resp_loc, new_field_loc, -1);
+    INKMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
     INKMimeHdrFieldNameSet(resp_bufp, resp_loc, new_field_loc, mimehdr2_name, strlen(mimehdr2_name));
     recvd_time = time(NULL);
-    INKMimeHdrFieldValueInsertDate(resp_bufp, resp_loc, new_field_loc, recvd_time, -1);
+    INKMimeHdrFieldValueDateInsert(resp_bufp, resp_loc, new_field_loc, recvd_time);
 
     INKHandleMLocRelease(resp_bufp, resp_loc, new_field_loc);
     INKHandleMLocRelease(resp_bufp, INK_NULL_MLOC, resp_loc);
@@ -155,9 +155,8 @@ modify_header(INKHttpTxn txnp, INKCont c
     }
 
     /* Get the cached MIME value for this name in this HTTP header */
-    chkptr = INKMimeHdrFieldValueGet(cached_bufp, cached_loc, cached_field_loc, 0, &chklength);
-
-    if (NULL == chkptr || !chklength) {
+    if (INKMimeHdrFieldValueStringGet(cached_bufp, cached_loc, cached_field_loc, 0, &chkptr,
&chklength) == INK_ERROR ||
+        NULL == chkptr || !chklength) {
       INKError("Could not find value for cached MIME field name %s", mimehdr1_name);
       INKHandleMLocRelease(resp_bufp, INK_NULL_MLOC, resp_loc);
       INKHandleMLocRelease(cached_bufp, INK_NULL_MLOC, cached_loc);
@@ -200,10 +199,10 @@ modify_header(INKHttpTxn txnp, INKCont c
 
     /* mimehdr1_name : INKstrdup( "x-num-served-from-cache" ) ; */
 
-    INKMimeHdrFieldInsert(resp_bufp, resp_loc, new_field_loc, -1);
+    INKMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
     INKMimeHdrFieldNameSet(resp_bufp, resp_loc, new_field_loc, mimehdr1_name, strlen(mimehdr1_name));
 
-    INKMimeHdrFieldValueInsertUint(resp_bufp, resp_loc, new_field_loc, num_refreshes, -1);
+    INKMimeHdrFieldValueUintInsert(resp_bufp, resp_loc, new_field_loc, -1, num_refreshes);
 
     INKHandleStringRelease(cached_bufp, cached_loc, chkptr);
     INKHandleMLocRelease(resp_bufp, resp_loc, new_field_loc);
@@ -317,9 +316,9 @@ INKPluginInit(int argc, const char *argv
   INKDebug("resphdr", "Inserting header %s with value %s into init buffer", mimehdr1_name,
mimehdr1_value);
 
   field_loc = INKMimeHdrFieldCreate(hdr_bufp, hdr_loc);
-  INKMimeHdrFieldInsert(hdr_bufp, hdr_loc, field_loc, -1);
+  INKMimeHdrFieldAppend(hdr_bufp, hdr_loc, field_loc);
   INKMimeHdrFieldNameSet(hdr_bufp, hdr_loc, field_loc, mimehdr1_name, strlen(mimehdr1_name));
-  INKMimeHdrFieldValueInsert(hdr_bufp, hdr_loc, field_loc, mimehdr1_value, strlen(mimehdr1_value),
-1);
+  INKMimeHdrFieldValueStringInsert(hdr_bufp, hdr_loc, field_loc, -1, mimehdr1_value, strlen(mimehdr1_value));
   INKDebug("resphdr", "init buffer hdr, field and value locs are %d, %d and %d", hdr_loc,
field_loc, value_loc);
   init_buffer_status = 1;
 

Modified: trafficserver/traffic/trunk/example/session-1/session-1.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/session-1/session-1.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/session-1/session-1.c (original)
+++ trafficserver/traffic/trunk/example/session-1/session-1.c Tue Jun 29 21:10:24 2010
@@ -40,9 +40,10 @@ static INKStat av_transaction;
 static void
 txn_handler(INKHttpTxn txnp, INKCont contp)
 {
-  int num_txns;
+  INK64 num_txns = 0;
+
   INKStatIncrement(transaction_count);
-  num_txns = INKStatIntRead(transaction_count);
+  INKStatIntGet(transaction_count, &num_txns);
   INKDebug("tag_session", "The number of transactions is %d\n", num_txns);
 
 }
@@ -51,10 +52,10 @@ txn_handler(INKHttpTxn txnp, INKCont con
 static void
 handle_session(INKHttpSsn ssnp, INKCont contp)
 {
-  int num_ssn;
+  INK64 num_ssn = 0;
 
   INKStatIncrement(session_count);
-  num_ssn = INKStatIntRead(session_count);
+  INKStatIntGet(session_count, &num_ssn);
   INKDebug("tag_session", "The number of sessions is %d\n", num_ssn);
   INKHttpSsnHookAdd(ssnp, INK_HTTP_TXN_START_HOOK, contp);
 }

Modified: trafficserver/traffic/trunk/example/thread-pool/psi.c
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/example/thread-pool/psi.c?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/example/thread-pool/psi.c (original)
+++ trafficserver/traffic/trunk/example/thread-pool/psi.c Tue Jun 29 21:10:24 2010
@@ -904,7 +904,7 @@ transform_handler(INKCont contp, INKEven
   /* This section will be called by both TS internal
      and the thread. Protect it with a mutex to avoid
      concurrent calls. */
-  lock = INKMutexTryLock(INKContMutexGet(contp));
+  INKMutexLockTry(INKContMutexGet(contp), &lock);
 
   /* Handle TryLock result */
   if (!lock) {
@@ -1049,8 +1049,7 @@ transformable(INKHttpTxn txnp)
     return 0;
   }
 
-  value = INKMimeHdrFieldValueGet(bufp, hdr_loc, field_loc, 0, NULL);
-  if (value == INK_ERROR_PTR) {
+  if (INKMimeHdrFieldValueStringGet(bufp, hdr_loc, field_loc, 0, &value, NULL) == INK_ERROR)
{
     INKError("[transformable] Error while getting Content-Type field value");
   }
   if ((value == INK_ERROR_PTR) || (value == NULL) || (strncasecmp(value, "text/", sizeof("text/")
- 1) != 0)) {

Modified: trafficserver/traffic/trunk/proxy/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/Makefile.am?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/Makefile.am (original)
+++ trafficserver/traffic/trunk/proxy/Makefile.am Tue Jun 29 21:10:24 2010
@@ -53,6 +53,7 @@ includedir=$(prefix)/include/ts
 include_HEADERS = \
   api/ts/ts.h \
   api/ts/remap.h \
+  api/ts/experimental.h \
   api/ts/ts_private.h \
   api/ts/ts_private_frozen.h
 

Modified: trafficserver/traffic/trunk/proxy/api/ts/ts.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts.h?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts.h Tue Jun 29 21:10:24 2010
@@ -2840,35 +2840,6 @@ extern "C"
   /** @deprecated Use INKMimeHdrFieldDestroy() instead */
   inkapi INK_DEPRECATED INKReturnCode INKMimeHdrFieldDelete(INKMBuffer bufp, INKMLoc hdr,
INKMLoc field);
 
-  /** @deprecated */
-  inkapi INK_DEPRECATED INKReturnCode INKCacheBufferInfoGet(INKCacheTxn txnp, INKU64 * length,
INKU64 * offset);
-
-  /* --------------------------------------------------------------------------
-     cache http info APIs */
-
-  /** @deprecated */
-  inkapi INK_DEPRECATED INKCacheHttpInfo INKCacheHttpInfoCreate();
-
-  /** @deprecated */
-  inkapi INK_DEPRECATED void INKCacheHttpInfoReqGet(INKCacheHttpInfo infop, INKMBuffer *
bufp, INKMLoc * obj);
-
-  /** @deprecated */
-  inkapi INK_DEPRECATED void INKCacheHttpInfoRespGet(INKCacheHttpInfo infop, INKMBuffer *
bufp, INKMLoc * obj);
-
-  /** @deprecated */
-  inkapi INK_DEPRECATED void INKCacheHttpInfoReqSet(INKCacheHttpInfo infop, INKMBuffer bufp,
INKMLoc obj);
-
-  /** @deprecated */
-  inkapi INK_DEPRECATED void INKCacheHttpInfoRespSet(INKCacheHttpInfo infop, INKMBuffer bufp,
INKMLoc obj);
-
-  /** @deprecated */
-  inkapi INK_DEPRECATED void INKCacheHttpInfoKeySet(INKCacheHttpInfo infop, INKCacheKey key);
-
-  /** @deprecated */
-  inkapi INK_DEPRECATED void INKCacheHttpInfoSizeSet(INKCacheHttpInfo infop, INKU64 size);
-
-  /** @deprecated */
-  inkapi INK_DEPRECATED int INKCacheHttpInfoVector(INKCacheHttpInfo infop, void *data, int
length);
 
 #ifdef __cplusplus
 }

Modified: trafficserver/traffic/trunk/proxy/api/ts/ts_private.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts_private.h?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts_private.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts_private.h Tue Jun 29 21:10:24 2010
@@ -21,16 +21,14 @@
   limitations under the License.
  */
 
-/*  ts_private.h
- *
- *
+/*
  *   Interfaces in this header file are experimental, undocumented and
  *   are subject to change even across minor releases of Traffic Server.
  *   None of the interfaces in this file are committed to be stable
  *   unless they are migrated to ts/ts.h  If you require stable APIs to
  *   Traffic Server, DO NOT USE anything in this file.
  *
- *   $Revision: 1.3 $ $Date: 2003-06-01 18:36:51 $
+ *   TODO: We should clean this up, and reorganize properly.
  */
 
 #ifndef __INK_API_PRIVATE_H__

Modified: trafficserver/traffic/trunk/proxy/api/ts/ts_private_frozen.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/api/ts/ts_private_frozen.h?rev=959102&r1=959101&r2=959102&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/api/ts/ts_private_frozen.h (original)
+++ trafficserver/traffic/trunk/proxy/api/ts/ts_private_frozen.h Tue Jun 29 21:10:24 2010
@@ -27,6 +27,8 @@
  *   None of the interfaces in this file are committed to be stable
  *   unless they are migrated to ts/ts.h  If you require stable APIs to
  *   Traffic Server, DO NOT USE anything in this file.
+ *
+ *   TODO: We should clean this up, and reorganize properly.
  */
 
 #ifndef __INK_API_PRIVATE_FROZEN_H__



Mime
View raw message