You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zy...@apache.org on 2013/10/31 11:57:06 UTC

git commit: TS-2235: url_print should NOT output "?" for empty query string

Updated Branches:
  refs/heads/master 6cb58be3e -> 1ab59b435


TS-2235: url_print should NOT output "?" for empty query string

the same problem with params and fragment, when plugins removed
all the query strings, we should remote the "?" too.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/1ab59b43
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/1ab59b43
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/1ab59b43

Branch: refs/heads/master
Commit: 1ab59b435498e1c77fce9463d6072778edaa2798
Parents: 6cb58be
Author: Yu Qing <zh...@taobao.com>
Authored: Tue Sep 17 17:30:04 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Thu Oct 31 18:56:01 2013 +0800

----------------------------------------------------------------------
 CHANGES           | 3 +++
 proxy/hdrs/URL.cc | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1ab59b43/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3aa3b75..f84b13c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 Changes with Apache Traffic Server 4.1.0
 
 
+  *) [TS-2235] url_print should NOT output "?" for empty query string.
+   Author: Yu Qing
+
   *) [TS-2292] the version of records.config increases unexpectly.
    Author: Yu Qing
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1ab59b43/proxy/hdrs/URL.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
index 7f082e7..f88ae55 100644
--- a/proxy/hdrs/URL.cc
+++ b/proxy/hdrs/URL.cc
@@ -1468,19 +1468,19 @@ url_print(URLImpl * url, char *buf_start, int buf_length, int *buf_index_inout,
                        buf_length, buf_index_inout, buf_chars_to_skip_inout));
   }
 
-  if (url->m_ptr_params) {
+  if (url->m_ptr_params && url->m_len_params > 0) {
     TRY(mime_mem_print(";", 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout));
     TRY(mime_mem_print(url->m_ptr_params, url->m_len_params,
                        buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout));
   }
 
-  if (url->m_ptr_query) {
+  if (url->m_ptr_query && url->m_len_query > 0) {
     TRY(mime_mem_print("?", 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout));
     TRY(mime_mem_print(url->m_ptr_query, url->m_len_query,
                        buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout));
   }
 
-  if (url->m_ptr_fragment) {
+  if (url->m_ptr_fragment && url->m_len_fragment > 0) {
     TRY(mime_mem_print("#", 1, buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout));
     TRY(mime_mem_print(url->m_ptr_fragment, url->m_len_fragment,
                        buf_start, buf_length, buf_index_inout, buf_chars_to_skip_inout));