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 2014/01/06 03:45:14 UTC
git commit: TS-2235: two functions should be changed too
Updated Branches:
refs/heads/master daa10ebce -> 3b2b2afc7
TS-2235: two functions should be changed too
to be changed functions:
url_length_get()
url_to_string()
Signed-off-by: Zhao Yongming <mi...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3b2b2afc
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3b2b2afc
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3b2b2afc
Branch: refs/heads/master
Commit: 3b2b2afc7680069edf0b122a5da7aaacb0235ecc
Parents: daa10eb
Author: Yu Qing <zh...@taobao.com>
Authored: Tue Nov 19 11:51:51 2013 +0800
Committer: Zhao Yongming <mi...@gmail.com>
Committed: Mon Jan 6 10:44:01 2014 +0800
----------------------------------------------------------------------
proxy/hdrs/URL.cc | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b2b2afc/proxy/hdrs/URL.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
index f88ae55..976a9c4 100644
--- a/proxy/hdrs/URL.cc
+++ b/proxy/hdrs/URL.cc
@@ -776,19 +776,24 @@ url_length_get(URLImpl * url)
length += url->m_len_port + 1; // +1 for ":"
}
- if (url->m_ptr_path)
+ if (url->m_ptr_path) {
length += url->m_len_path + 1; // +1 for /
- else
+ }
+ else {
length += 1; // +1 for /
+ }
- if (url->m_ptr_params)
+ if (url->m_ptr_params && url->m_len_params > 0) {
length += url->m_len_params + 1; // +1 for ";"
+ }
- if (url->m_ptr_query)
+ if (url->m_ptr_query && url->m_len_query > 0) {
length += url->m_len_query + 1; // +1 for "?"
+ }
- if (url->m_ptr_fragment)
- length += url->m_len_fragment + 1; // +1 for "/"
+ if (url->m_ptr_fragment && url->m_len_fragment > 0) {
+ length += url->m_len_fragment + 1; // +1 for "#"
+ }
return length;
}
@@ -851,19 +856,19 @@ url_to_string(URLImpl * url, Arena * arena, int *length)
memcpy(&str[idx], url->m_ptr_path, url->m_len_path);
idx += url->m_len_path;
- if (url->m_ptr_params) {
+ if (url->m_ptr_params && url->m_len_params > 0) {
str[idx++] = ';';
memcpy(&str[idx], url->m_ptr_params, url->m_len_params);
idx += url->m_len_params;
}
- if (url->m_ptr_query) {
+ if (url->m_ptr_query && url->m_len_query > 0) {
str[idx++] = '?';
memcpy(&str[idx], url->m_ptr_query, url->m_len_query);
idx += url->m_len_query;
}
- if (url->m_ptr_fragment) {
+ if (url->m_ptr_fragment && url->m_len_fragment > 0) {
str[idx++] = '#';
memcpy(&str[idx], url->m_ptr_fragment, url->m_len_fragment);
idx += url->m_len_fragment;
Re: git commit: TS-2235: two functions should be changed too
Posted by James Peach <jp...@apache.org>.
On Jan 5, 2014, at 6:45 PM, zym@apache.org wrote:
> Updated Branches:
> refs/heads/master daa10ebce -> 3b2b2afc7
>
>
> TS-2235: two functions should be changed too
>
> to be changed functions:
> url_length_get()
> url_to_string()
It should be straight forward to write a regression test for this. Do you or Yu Quing want to take a crack at that?
>
> Signed-off-by: Zhao Yongming <mi...@gmail.com>
>
>
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3b2b2afc
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3b2b2afc
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3b2b2afc
>
> Branch: refs/heads/master
> Commit: 3b2b2afc7680069edf0b122a5da7aaacb0235ecc
> Parents: daa10eb
> Author: Yu Qing <zh...@taobao.com>
> Authored: Tue Nov 19 11:51:51 2013 +0800
> Committer: Zhao Yongming <mi...@gmail.com>
> Committed: Mon Jan 6 10:44:01 2014 +0800
>
> ----------------------------------------------------------------------
> proxy/hdrs/URL.cc | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b2b2afc/proxy/hdrs/URL.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
> index f88ae55..976a9c4 100644
> --- a/proxy/hdrs/URL.cc
> +++ b/proxy/hdrs/URL.cc
> @@ -776,19 +776,24 @@ url_length_get(URLImpl * url)
> length += url->m_len_port + 1; // +1 for ":"
> }
>
> - if (url->m_ptr_path)
> + if (url->m_ptr_path) {
> length += url->m_len_path + 1; // +1 for /
> - else
> + }
> + else {
> length += 1; // +1 for /
> + }
>
> - if (url->m_ptr_params)
> + if (url->m_ptr_params && url->m_len_params > 0) {
> length += url->m_len_params + 1; // +1 for ";"
> + }
>
> - if (url->m_ptr_query)
> + if (url->m_ptr_query && url->m_len_query > 0) {
> length += url->m_len_query + 1; // +1 for "?"
> + }
>
> - if (url->m_ptr_fragment)
> - length += url->m_len_fragment + 1; // +1 for "/"
> + if (url->m_ptr_fragment && url->m_len_fragment > 0) {
> + length += url->m_len_fragment + 1; // +1 for "#"
> + }
>
> return length;
> }
> @@ -851,19 +856,19 @@ url_to_string(URLImpl * url, Arena * arena, int *length)
> memcpy(&str[idx], url->m_ptr_path, url->m_len_path);
> idx += url->m_len_path;
>
> - if (url->m_ptr_params) {
> + if (url->m_ptr_params && url->m_len_params > 0) {
> str[idx++] = ';';
> memcpy(&str[idx], url->m_ptr_params, url->m_len_params);
> idx += url->m_len_params;
> }
>
> - if (url->m_ptr_query) {
> + if (url->m_ptr_query && url->m_len_query > 0) {
> str[idx++] = '?';
> memcpy(&str[idx], url->m_ptr_query, url->m_len_query);
> idx += url->m_len_query;
> }
>
> - if (url->m_ptr_fragment) {
> + if (url->m_ptr_fragment && url->m_len_fragment > 0) {
> str[idx++] = '#';
> memcpy(&str[idx], url->m_ptr_fragment, url->m_len_fragment);
> idx += url->m_len_fragment;
>
Re: git commit: TS-2235: two functions should be changed too
Posted by James Peach <jp...@apache.org>.
On Jan 5, 2014, at 6:45 PM, zym@apache.org wrote:
> Updated Branches:
> refs/heads/master daa10ebce -> 3b2b2afc7
>
>
> TS-2235: two functions should be changed too
>
> to be changed functions:
> url_length_get()
> url_to_string()
It should be straight forward to write a regression test for this. Do you or Yu Quing want to take a crack at that?
>
> Signed-off-by: Zhao Yongming <mi...@gmail.com>
>
>
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3b2b2afc
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3b2b2afc
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3b2b2afc
>
> Branch: refs/heads/master
> Commit: 3b2b2afc7680069edf0b122a5da7aaacb0235ecc
> Parents: daa10eb
> Author: Yu Qing <zh...@taobao.com>
> Authored: Tue Nov 19 11:51:51 2013 +0800
> Committer: Zhao Yongming <mi...@gmail.com>
> Committed: Mon Jan 6 10:44:01 2014 +0800
>
> ----------------------------------------------------------------------
> proxy/hdrs/URL.cc | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3b2b2afc/proxy/hdrs/URL.cc
> ----------------------------------------------------------------------
> diff --git a/proxy/hdrs/URL.cc b/proxy/hdrs/URL.cc
> index f88ae55..976a9c4 100644
> --- a/proxy/hdrs/URL.cc
> +++ b/proxy/hdrs/URL.cc
> @@ -776,19 +776,24 @@ url_length_get(URLImpl * url)
> length += url->m_len_port + 1; // +1 for ":"
> }
>
> - if (url->m_ptr_path)
> + if (url->m_ptr_path) {
> length += url->m_len_path + 1; // +1 for /
> - else
> + }
> + else {
> length += 1; // +1 for /
> + }
>
> - if (url->m_ptr_params)
> + if (url->m_ptr_params && url->m_len_params > 0) {
> length += url->m_len_params + 1; // +1 for ";"
> + }
>
> - if (url->m_ptr_query)
> + if (url->m_ptr_query && url->m_len_query > 0) {
> length += url->m_len_query + 1; // +1 for "?"
> + }
>
> - if (url->m_ptr_fragment)
> - length += url->m_len_fragment + 1; // +1 for "/"
> + if (url->m_ptr_fragment && url->m_len_fragment > 0) {
> + length += url->m_len_fragment + 1; // +1 for "#"
> + }
>
> return length;
> }
> @@ -851,19 +856,19 @@ url_to_string(URLImpl * url, Arena * arena, int *length)
> memcpy(&str[idx], url->m_ptr_path, url->m_len_path);
> idx += url->m_len_path;
>
> - if (url->m_ptr_params) {
> + if (url->m_ptr_params && url->m_len_params > 0) {
> str[idx++] = ';';
> memcpy(&str[idx], url->m_ptr_params, url->m_len_params);
> idx += url->m_len_params;
> }
>
> - if (url->m_ptr_query) {
> + if (url->m_ptr_query && url->m_len_query > 0) {
> str[idx++] = '?';
> memcpy(&str[idx], url->m_ptr_query, url->m_len_query);
> idx += url->m_len_query;
> }
>
> - if (url->m_ptr_fragment) {
> + if (url->m_ptr_fragment && url->m_len_fragment > 0) {
> str[idx++] = '#';
> memcpy(&str[idx], url->m_ptr_fragment, url->m_len_fragment);
> idx += url->m_len_fragment;
>