[ 
https://issues.apache.org/jira/browse/TS-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848340#action_12848340
 ] 

John Plevyak commented on TS-253:
---------------------------------

I tried to build a regression for this, but it didn't catch the problem, 
however I did fix another issue.
Backing out the URL change does fix it:

Index: URL.cc
===================================================================
--- URL.cc      (revision 926339)
+++ URL.cc      (working copy)
@@ -210,25 +210,9 @@
 void
 url_copy_onto(URLImpl * s_url, HdrHeap * s_heap, URLImpl * d_url, HdrHeap * 
d_heap, bool inherit_strs)
 {
-  if (s_url != d_url) {
-    obj_copy_data((HdrHeapObjImpl *) s_url, (HdrHeapObjImpl *) d_url);
-    if (inherit_strs && (s_heap != d_heap))
-      d_heap->inherit_string_heaps(s_heap);
-
-    // m_ptr_host is reused by the object if it has capacity and not
-    // reallocated on every url_host_set(); obj_copy_data() above does
-    // a "shallow" copy and inherit_string_heaps() inherits strings as
-    // "read-only" (see HdrHeap.cc). Hence we have to make sure the
-    // copied object uses a different buffer
-    if (s_url->m_ptr_host && (s_url->m_capacity_host > 0) && d_heap) {
-      d_url->m_ptr_host = d_heap->allocate_str(d_url->m_capacity_host);
-      if (d_url->m_ptr_host) {
-        memcpy(const_cast<char *>(d_url->m_ptr_host), s_url->m_ptr_host, 
s_url->m_capacity_host);
-      } else {
-        d_url->m_capacity_host = d_url->m_len_host = 0;
-      }
-    }
-  }
+  obj_copy_data((HdrHeapObjImpl *) s_url, (HdrHeapObjImpl *) d_url);
+  if (inherit_strs && (s_heap != d_heap))
+    d_heap->inherit_string_heaps(s_heap);
 }
 
 /*-------------------------------------------------------------------------
@@ -240,7 +224,7 @@
   d_url->m_len_scheme = 0;
   d_url->m_len_user = 0;
   d_url->m_len_password = 0;
-  d_url->m_len_host = d_url->m_capacity_host = 0;
+  d_url->m_len_host = 0;
   d_url->m_len_port = 0;
 
   d_url->m_ptr_scheme = NULL;


> HTTP Header Host ptr field not set
> ----------------------------------
>
>                 Key: TS-253
>                 URL: https://issues.apache.org/jira/browse/TS-253
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Core
>            Reporter: John Plevyak
>
> I noticed while lookup at cache scan that the host field of URLImpl is not 
> set correctly.
> the m_ptr_host field is 0x0 while the m_len_host is correct (14).
> here is what it looks like:
> $20 = {<HdrHeapObjImpl> = {m_type = 2, m_length = 120, m_obj_flags = 0}, 
> m_len_scheme = 4, 
>   m_len_user = 0, m_len_password = 0, m_len_host = 14, m_len_port = 0, 
> m_len_path = 0, 
>   m_len_params = 27, m_len_query = 0, m_len_fragment = 0, 
> m_len_printed_string = 0, 
>   m_ptr_scheme = 0x0, 
>   m_ptr_user = 0x7ffff2fe9d2f 
> "http://www.google.com/intl/en_ALL/images/logo.gif HTTP/1.1\r\nHost: 
> www.google.com\r\nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; 
> rv:1.9.2) Gecko/20100115 Firefox/3.6\r\nAccept: image/png,im"..., 
> m_ptr_password = 0x0, 
>   m_ptr_host = 0x0, 
>   m_ptr_port = 0x7ffff2fe9d36 "www.google.com/intl/en_ALL/images/logo.gif 
> HTTP/1.1\r\nHost: www.google.com\r\nUser-Agent: Mozilla/5.0 (Windows; U; 
> Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6\r\nAccept: 
> image/png,image/*;q"..., m_ptr_path = 0x0, 
>   m_ptr_params = 0x7ffff2fe9d45 "intl/en_ALL/images/logo.gif 
> HTTP/1.1\r\nHost: www.google.com\r\nUser-Agent: Mozilla/5.0 (Windows; U; 
> Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6\r\nAccept: 
> image/png,image/*;q=0.8,*/*;q=0.5\r"..., m_ptr_query = 0x0, 
>   m_ptr_fragment = 0x0, m_ptr_printed_string = 0x0, clean = false, 
> m_scheme_wks_idx = 0, 
>   m_port = 0, m_url_type = 0 '\000', m_type_code = 0 '\000', m_capacity_host 
> = 1}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to