You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2019/02/04 22:47:46 UTC

[trafficserver] branch master updated: Cleanup: Convert HTTPHdr::length_get to real method.

This is an automated email from the ASF dual-hosted git repository.

amc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ab930c  Cleanup: Convert HTTPHdr::length_get to real method.
2ab930c is described below

commit 2ab930c3e653af0a13c8b962bac94131940a5677
Author: Alan M. Carroll <am...@apache.org>
AuthorDate: Mon Feb 4 16:02:21 2019 -0600

    Cleanup: Convert HTTPHdr::length_get to real method.
---
 proxy/hdrs/HTTP.cc | 20 ++++++++++----------
 proxy/hdrs/HTTP.h  | 15 +--------------
 2 files changed, 11 insertions(+), 24 deletions(-)

diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc
index dabd584..6c41877 100644
--- a/proxy/hdrs/HTTP.cc
+++ b/proxy/hdrs/HTTP.cc
@@ -592,21 +592,21 @@ http_hdr_describe(HdrHeapObjImpl *raw, bool recurse)
   -------------------------------------------------------------------------*/
 
 int
-http_hdr_length_get(HTTPHdrImpl *hdr)
+HTTPHdr::length_get() const
 {
   int length = 0;
 
-  if (hdr->m_polarity == HTTP_TYPE_REQUEST) {
-    if (hdr->u.req.m_ptr_method) {
-      length = hdr->u.req.m_len_method;
+  if (m_http->m_polarity == HTTP_TYPE_REQUEST) {
+    if (m_http->u.req.m_ptr_method) {
+      length = m_http->u.req.m_len_method;
     } else {
       length = 0;
     }
 
     length += 1; // " "
 
-    if (hdr->u.req.m_url_impl) {
-      length += url_length_get(hdr->u.req.m_url_impl);
+    if (m_http->u.req.m_url_impl) {
+      length += url_length_get(m_http->u.req.m_url_impl);
     }
 
     length += 1; // " "
@@ -614,9 +614,9 @@ http_hdr_length_get(HTTPHdrImpl *hdr)
     length += 8; // HTTP/%d.%d
 
     length += 2; // "\r\n"
-  } else if (hdr->m_polarity == HTTP_TYPE_RESPONSE) {
-    if (hdr->u.resp.m_ptr_reason) {
-      length = hdr->u.resp.m_len_reason;
+  } else if (m_http->m_polarity == HTTP_TYPE_RESPONSE) {
+    if (m_http->u.resp.m_ptr_reason) {
+      length = m_http->u.resp.m_len_reason;
     } else {
       length = 0;
     }
@@ -632,7 +632,7 @@ http_hdr_length_get(HTTPHdrImpl *hdr)
     length += 2; // "\r\n"
   }
 
-  length += mime_hdr_length_get(hdr->m_fields_impl);
+  length += mime_hdr_length_get(m_http->m_fields_impl);
 
   return length;
 }
diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index e9718c3..a5fc4e6 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -423,9 +423,6 @@ inkcoreapi int http_hdr_print(HdrHeap *heap, HTTPHdrImpl *hh, char *buf, int buf
 
 void http_hdr_describe(HdrHeapObjImpl *obj, bool recurse = true);
 
-int http_hdr_length_get(HTTPHdrImpl *hh);
-// HTTPType               http_hdr_type_get (HTTPHdrImpl *hh);
-
 // int32_t                  http_hdr_version_get (HTTPHdrImpl *hh);
 inkcoreapi void http_hdr_version_set(HTTPHdrImpl *hh, int32_t ver);
 
@@ -520,7 +517,7 @@ public:
 
   int print(char *buf, int bufsize, int *bufindex, int *dumpoffset);
 
-  int length_get();
+  int length_get() const;
 
   HTTPType type_get() const;
 
@@ -846,16 +843,6 @@ HTTPHdr::print(char *buf, int bufsize, int *bufindex, int *dumpoffset)
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 
-inline int
-HTTPHdr::length_get()
-{
-  ink_assert(valid());
-  return http_hdr_length_get(m_http);
-}
-
-/*-------------------------------------------------------------------------
-  -------------------------------------------------------------------------*/
-
 inline void
 HTTPHdr::_test_and_fill_target_cache() const
 {