You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/03/29 19:37:47 UTC

[trafficserver] branch 9.1.x updated: Expose URL element methods through HTTPHdr (#7628)

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

zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.1.x by this push:
     new c888b3b  Expose URL element methods through HTTPHdr (#7628)
c888b3b is described below

commit c888b3be266e0048535048bf9d010cc25d0fc707
Author: Susan Hinrichs <sh...@verizonmedia.com>
AuthorDate: Mon Mar 29 08:14:31 2021 -0500

    Expose URL element methods through HTTPHdr (#7628)
    
    (cherry picked from commit cd7fe0d90d049e2d9b2ba189ae1e87166e222aa2)
---
 proxy/hdrs/HTTP.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index 3da31a0..144255d 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -580,6 +580,27 @@ public:
   const char *path_get(int *length ///< Storage for path length.
   );
 
+  /** Get the URL matrix params.
+      This is a reference, not allocated.
+      @return A pointer to the matrix params or @c NULL if there is no valid URL.
+  */
+  const char *params_get(int *length ///< Storage for param length.
+  );
+
+  /** Get the URL query.
+      This is a reference, not allocated.
+      @return A pointer to the query or @c NULL if there is no valid URL.
+  */
+  const char *query_get(int *length ///< Storage for query length.
+  );
+
+  /** Get the URL fragment.
+      This is a reference, not allocated.
+      @return A pointer to the fragment or @c NULL if there is no valid URL.
+  */
+  const char *fragment_get(int *length ///< Storage for fragement length.
+  );
+
   /** Get the target host name.
       The length is returned in @a length if non-NULL.
       @note The results are cached so this is fast after the first call.
@@ -1312,6 +1333,27 @@ HTTPHdr::path_get(int *length)
 }
 
 inline const char *
+HTTPHdr::params_get(int *length)
+{
+  URL *url = this->url_get();
+  return url ? url->params_get(length) : nullptr;
+}
+
+inline const char *
+HTTPHdr::query_get(int *length)
+{
+  URL *url = this->url_get();
+  return url ? url->query_get(length) : nullptr;
+}
+
+inline const char *
+HTTPHdr::fragment_get(int *length)
+{
+  URL *url = this->url_get();
+  return url ? url->fragment_get(length) : nullptr;
+}
+
+inline const char *
 HTTPHdr::scheme_get(int *length)
 {
   URL *url = this->url_get();