trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1031370 - /trafficserver/plugins/stats/stats.c
Date Fri, 05 Nov 2010 00:22:44 GMT
Author: zwoop
Date: Fri Nov  5 00:22:44 2010
New Revision: 1031370

URL: http://svn.apache.org/viewvc?rev=1031370&view=rev
Log:
Fix the multiple reenables, and some more checks and cleanup.

Modified:
    trafficserver/plugins/stats/stats.c

Modified: trafficserver/plugins/stats/stats.c
URL: http://svn.apache.org/viewvc/trafficserver/plugins/stats/stats.c?rev=1031370&r1=1031369&r2=1031370&view=diff
==============================================================================
--- trafficserver/plugins/stats/stats.c (original)
+++ trafficserver/plugins/stats/stats.c Fri Nov  5 00:22:44 2010
@@ -246,18 +246,22 @@ stats_origin(INKCont contp, INKEvent eve
   INKMBuffer reqp;
   INKMLoc hdr_loc = NULL, field = NULL;
   int host_header_len;
-  const char *host_header_ptr;
+  const char *host_header_ptr = NULL;
+  INKEvent reenable = INK_EVENT_HTTP_CONTINUE;
 
   INKDebug("istats", "in the read stuff");
  
-  INKHttpTxnClientReqGet(txnp, &reqp, &hdr_loc); 
+  if (!INKHttpTxnClientReqGet(txnp, &reqp, &hdr_loc))
+    goto cleanup;
+
   field = INKMimeHdrFieldFind(reqp, hdr_loc,
                               INK_MIME_FIELD_HOST, INK_MIME_LEN_HOST);
   if(field) {
-    INKMimeHdrFieldValueStringGet(reqp, hdr_loc, field, 0,
-                                  &host_header_ptr, &host_header_len);
-    if(host_header_len != 7 || memcmp(host_header_ptr, "[stats]", 7))
-      goto notforme;
+    if (INK_SUCCESS == INKMimeHdrFieldValueStringGet(reqp, hdr_loc, field, 0,
+                                                     &host_header_ptr, &host_header_len))
{
+      if(host_header_len != 7 || memcmp(host_header_ptr, "[stats]", 7))
+        goto notforme;
+    }
   }
 
   /* This is us -- register our intercept */
@@ -274,15 +278,17 @@ stats_origin(INKCont contp, INKEvent eve
  error:
   INKError("[PluginInit] Error while intercepting stuff");
   INKContDestroy(icontp);
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_ERROR);
+  reenable = INK_EVENT_HTTP_ERROR;
   goto cleanup;
 
  notforme:
 
  cleanup:
-  INKHttpTxnReenable(txnp, INK_EVENT_HTTP_CONTINUE);
+  if(host_header_ptr) INKHandleStringRelease(reqp, hdr_loc, host_header_ptr);
   if(hdr_loc) INKHandleMLocRelease(reqp, INK_NULL_MLOC, hdr_loc);
   if(field) INKHandleMLocRelease(reqp, INK_NULL_MLOC, field);
+
+  INKHttpTxnReenable(txnp, reenable);
   return 0;
 }
 



Mime
View raw message