Copilot commented on code in PR #13238:
URL: https://github.com/apache/trafficserver/pull/13238#discussion_r3360426978


##########
plugins/prefetch/plugin.cc:
##########
@@ -521,9 +520,10 @@ contHandleFetch(const TSCont contp, TSEvent event, void 
*edata)
   }
 
   switch (event) {
-  case TS_EVENT_HTTP_POST_REMAP: {
-    /* Use the cache key since this has better lookup behavior when using 
plugins like the cachekey plugin,
-     * for example multiple URIs can match a single cache key */
+  case TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE: {
+    /* CACHE_LOOKUP_COMPLETE is the earliest hook at which 
TSHttpTxnCacheLookupUrlGet is
+     * guaranteed to return a populated URL: the core does not initialize the 
cache lookup
+     * URL until HttpTransact::HandleRequest runs, which happens after 
POST_REMAP returns. */
     if (data->frontend() && data->secondPass()) {

Review Comment:
   In this CACHE_LOOKUP_COMPLETE path, TSHttpTxnClientReqGet() has already 
succeeded, but if appendCacheKey() fails the handler returns early and the 
client request MLoc is not released (the TSHandleMLocRelease call is at the end 
of the handler). This leaks reqHdrLoc for the transaction.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to