[trafficserver] branch 8.1.x updated: Reverting to old negative_caching conditional behavior (#7401)

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/8.1.x by this push:
 new fa234b2  Reverting to old negative_caching conditional behavior (#7401)
fa234b2 is described below

commit fa234b2b85f135d9e659d9ee6c026d2d1b1ef8e3
Author: Shinya Kawano 
AuthorDate: Wed Dec 23 13:32:54 2020 +0900

Reverting to old negative_caching conditional behavior (#7401)

https://github.com/apache/trafficserver/pull/7361 fixed negative caching
for non-cacheable negative responses, but it broke certain logic
concerning checks for whether a given response was cacheable because of
negative caching configuration. This fixes the latter behavior so it now
behaves as it did before.

Co-authored-by: bneradt 
(cherry picked from commit 80f2c3f40133a59c00db05d8d3a6bc428b4d20f0)
---
 proxy/http/HttpSM.cc   |  8 
 proxy/http/HttpTransact.cc | 10 +-
 proxy/http/HttpTransact.h  | 22 +++---
 3 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 0f737fa..322f04a 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2941,7 +2941,7 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer *p)
   // the reason string being written to the client and a bad CL when 
reading from cache.
   // I didn't find anywhere this appended reason is being used, so 
commenting it out.
   /*
-if (t_state.is_cacheable_and_negative_caching_is_enabled && 
p->bytes_read == 0) {
+if (t_state.is_cacheable_due_to_negative_caching_configuration && 
p->bytes_read == 0) {
 int reason_len;
 const char *reason = 
t_state.hdr_info.server_response.reason_get(_len);
 if (reason == NULL)
@@ -2996,8 +2996,8 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer *p)
   }
 
   // turn off negative caching in case there are multiple server contacts
-  if (t_state.is_cacheable_and_negative_caching_is_enabled) {
-t_state.is_cacheable_and_negative_caching_is_enabled = false;
+  if (t_state.is_cacheable_due_to_negative_caching_configuration) {
+t_state.is_cacheable_due_to_negative_caching_configuration = false;
   }
 
   // If we had a ground fill, check update our status
@@ -6579,7 +6579,7 @@ HttpSM::setup_server_transfer()
 
   nbytes = server_transfer_init(buf, hdr_size);
 
-  if (t_state.is_cacheable_and_negative_caching_is_enabled &&
+  if (t_state.is_cacheable_due_to_negative_caching_configuration &&
   t_state.hdr_info.server_response.status_get() == HTTP_STATUS_NO_CONTENT) 
{
 int s = sizeof("No Content") - 1;
 buf->write("No Content", s);
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 66d96af..3801774 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -4202,7 +4202,7 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
 client_response_code = server_response_code;
 base_response= >hdr_info.server_response;
 
-s->is_cacheable_and_negative_caching_is_enabled = cacheable && 
s->txn_conf->negative_caching_enabled;
+s->is_cacheable_due_to_negative_caching_configuration = cacheable && 
is_negative_caching_appropriate(s);
 
 // determine the correct cache action given the original cache action,
 // cacheability of server response, and request method
@@ -4264,7 +4264,7 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
 //   before issuing a 304
 if (s->cache_info.action == CACHE_DO_WRITE || s->cache_info.action == 
CACHE_DO_NO_ACTION ||
 s->cache_info.action == CACHE_DO_REPLACE) {
-  if (s->is_cacheable_and_negative_caching_is_enabled) {
+  if (s->is_cacheable_due_to_negative_caching_configuration) {
 HTTPHdr *resp;
 s->cache_info.object_store.create();
 s->cache_info.object_store.request_set(>hdr_info.client_request);
@@ -4300,8 +4300,8 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
   SET_VIA_STRING(VIA_PROXY_RESULT, VIA_PROXY_SERVER_REVALIDATED);
 }
   }
-} else if (s->is_cacheable_and_negative_caching_is_enabled) {
-  s->is_cacheable_and_negative_caching_is_enabled = false;
+} else if (s->is_cacheable_due_to_negative_caching_configuration) {
+  s->is_cacheable_due_to_negative_caching_configuration = false;
 }
 
 break;
@@ -4711,7 +4711,7 @@ HttpTransact::set_headers_for_cache_write(State *s, 
HTTPInfo *cache_info, HTTPHd
  sites yields no insight. So the assert is removed and we keep the 
behavior that if the response
  in @a cache_info is already set, we don't override it.
   */
-  if (!s->is_cacheable_and_negative_caching_is_enabled || 
!cache_info->response_get()->valid()) {
+  if 

[trafficserver] branch master updated (111f32a -> 0b36ba4)

2021-01-07 Thread kichan
This is an automated email from the ASF dual-hosted git repository.

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


from 111f32a  Make places to bind/unbind SSL object with/from NetVC (#7399)
 add 0b36ba4  Improvement to lua plugin (#7413)

No new revisions were added by this update.

Summary of changes:
 doc/admin-guide/plugins/lua.en.rst | 27 ++-
 plugins/lua/ts_lua_fetch.c | 10 ++
 plugins/lua/ts_lua_http.c  | 17 +
 plugins/lua/ts_lua_mgmt.c  | 20 
 4 files changed, 73 insertions(+), 1 deletion(-)



[trafficserver] branch 8.1.x updated: Updated ChangeLog

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/8.1.x by this push:
 new 04491c2  Updated ChangeLog
04491c2 is described below

commit 04491c29b0b618f7fcf8e019663d89eae6236b02
Author: Leif Hedstrom 
AuthorDate: Thu Jan 7 14:20:57 2021 -0700

Updated ChangeLog
---
 CHANGELOG-8.1.2 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/CHANGELOG-8.1.2 b/CHANGELOG-8.1.2
index 3af30eb..2683b77 100644
--- a/CHANGELOG-8.1.2
+++ b/CHANGELOG-8.1.2
@@ -1,3 +1,2 @@
 Changes with Apache Traffic Server 8.1.2
   #7352 - Clear call_sm on tunnel reset
-  #7401 - Fix unnecessary addition of Expires header



[trafficserver] branch 8.1.x updated: Revert "Reverting to old negative_caching conditional behavior (#7401)"

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/8.1.x by this push:
 new 8b75139  Revert "Reverting to old negative_caching conditional 
behavior (#7401)"
8b75139 is described below

commit 8b751390c9b00c97253b48c27355403ef907ab98
Author: Leif Hedstrom 
AuthorDate: Thu Jan 7 14:19:24 2021 -0700

Revert "Reverting to old negative_caching conditional behavior (#7401)"

This reverts commit f2f7be7ac59a25c420038a614b7df684d6ab20ff.

This does not apply, as is, on 8.1.x it seems.
---
 proxy/http/HttpSM.cc   |  8 
 proxy/http/HttpTransact.cc | 10 +-
 proxy/http/HttpTransact.h  | 22 +++---
 3 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 322f04a..0f737fa 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2941,7 +2941,7 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer *p)
   // the reason string being written to the client and a bad CL when 
reading from cache.
   // I didn't find anywhere this appended reason is being used, so 
commenting it out.
   /*
-if (t_state.is_cacheable_due_to_negative_caching_configuration && 
p->bytes_read == 0) {
+if (t_state.is_cacheable_and_negative_caching_is_enabled && 
p->bytes_read == 0) {
 int reason_len;
 const char *reason = 
t_state.hdr_info.server_response.reason_get(_len);
 if (reason == NULL)
@@ -2996,8 +2996,8 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer *p)
   }
 
   // turn off negative caching in case there are multiple server contacts
-  if (t_state.is_cacheable_due_to_negative_caching_configuration) {
-t_state.is_cacheable_due_to_negative_caching_configuration = false;
+  if (t_state.is_cacheable_and_negative_caching_is_enabled) {
+t_state.is_cacheable_and_negative_caching_is_enabled = false;
   }
 
   // If we had a ground fill, check update our status
@@ -6579,7 +6579,7 @@ HttpSM::setup_server_transfer()
 
   nbytes = server_transfer_init(buf, hdr_size);
 
-  if (t_state.is_cacheable_due_to_negative_caching_configuration &&
+  if (t_state.is_cacheable_and_negative_caching_is_enabled &&
   t_state.hdr_info.server_response.status_get() == HTTP_STATUS_NO_CONTENT) 
{
 int s = sizeof("No Content") - 1;
 buf->write("No Content", s);
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 3801774..66d96af 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -4202,7 +4202,7 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
 client_response_code = server_response_code;
 base_response= >hdr_info.server_response;
 
-s->is_cacheable_due_to_negative_caching_configuration = cacheable && 
is_negative_caching_appropriate(s);
+s->is_cacheable_and_negative_caching_is_enabled = cacheable && 
s->txn_conf->negative_caching_enabled;
 
 // determine the correct cache action given the original cache action,
 // cacheability of server response, and request method
@@ -4264,7 +4264,7 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
 //   before issuing a 304
 if (s->cache_info.action == CACHE_DO_WRITE || s->cache_info.action == 
CACHE_DO_NO_ACTION ||
 s->cache_info.action == CACHE_DO_REPLACE) {
-  if (s->is_cacheable_due_to_negative_caching_configuration) {
+  if (s->is_cacheable_and_negative_caching_is_enabled) {
 HTTPHdr *resp;
 s->cache_info.object_store.create();
 s->cache_info.object_store.request_set(>hdr_info.client_request);
@@ -4300,8 +4300,8 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
   SET_VIA_STRING(VIA_PROXY_RESULT, VIA_PROXY_SERVER_REVALIDATED);
 }
   }
-} else if (s->is_cacheable_due_to_negative_caching_configuration) {
-  s->is_cacheable_due_to_negative_caching_configuration = false;
+} else if (s->is_cacheable_and_negative_caching_is_enabled) {
+  s->is_cacheable_and_negative_caching_is_enabled = false;
 }
 
 break;
@@ -4711,7 +4711,7 @@ HttpTransact::set_headers_for_cache_write(State *s, 
HTTPInfo *cache_info, HTTPHd
  sites yields no insight. So the assert is removed and we keep the 
behavior that if the response
  in @a cache_info is already set, we don't override it.
   */
-  if (!s->is_cacheable_due_to_negative_caching_configuration || 
!cache_info->response_get()->valid()) {
+  if (!s->is_cacheable_and_negative_caching_is_enabled || 
!cache_info->response_get()->valid()) {
 cache_info->response_set(response);
   }
 
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index 8e618d1..800c10e 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -763,15 

[trafficserver] branch 9.0.x updated: Updated ChangeLog

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 6f32241  Updated ChangeLog
6f32241 is described below

commit 6f322419c953763d565d9315f92a88f5cc551f14
Author: Leif Hedstrom 
AuthorDate: Thu Jan 7 14:05:10 2021 -0700

Updated ChangeLog
---
 CHANGELOG-9.0.1 | 4 
 1 file changed, 4 insertions(+)

diff --git a/CHANGELOG-9.0.1 b/CHANGELOG-9.0.1
new file mode 100644
index 000..c09ae7b
--- /dev/null
+++ b/CHANGELOG-9.0.1
@@ -0,0 +1,4 @@
+Changes with Apache Traffic Server 9.0.1
+  #7395 - Replace ::exit() with _exit() to avoid secondary cleanup cores
+  #7352 - Clear call_sm on tunnel reset
+  #7401 - Fix unnecessary addition of Expires header



[trafficserver] branch 8.1.x updated: Updated ChangeLog

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/8.1.x by this push:
 new b92245d  Updated ChangeLog
b92245d is described below

commit b92245da2a5f83268008510ca0cb5d7087fa665e
Author: Leif Hedstrom 
AuthorDate: Thu Jan 7 13:47:07 2021 -0700

Updated ChangeLog
---
 CHANGELOG-8.1.2 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG-8.1.2 b/CHANGELOG-8.1.2
index 2e87547..3af30eb 100644
--- a/CHANGELOG-8.1.2
+++ b/CHANGELOG-8.1.2
@@ -1,2 +1,3 @@
 Changes with Apache Traffic Server 8.1.2
+  #7352 - Clear call_sm on tunnel reset
   #7401 - Fix unnecessary addition of Expires header



[trafficserver] branch 8.1.x updated: Clear call_sm on tunnel reset (#7352)

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/8.1.x by this push:
 new 9ec952a  Clear call_sm on tunnel reset (#7352)
9ec952a is described below

commit 9ec952a031fded237523be1c2adb9c4ce2b84877
Author: Susan Hinrichs 
AuthorDate: Tue Dec 15 08:07:39 2020 -0600

Clear call_sm on tunnel reset (#7352)

(cherry picked from commit 85e6f316996613e53ee5eb5d991072a874fc167d)
---
 proxy/http/HttpTunnel.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index 48aebb8..5ac2e73 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -537,6 +537,7 @@ HttpTunnel::reset()
   }
 #endif
 
+  call_sm   = false;
   num_producers = 0;
   num_consumers = 0;
   memset(consumers, 0, sizeof(consumers));



[trafficserver] branch 9.0.x updated: Clear call_sm on tunnel reset (#7352)

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 39adbe0  Clear call_sm on tunnel reset (#7352)
39adbe0 is described below

commit 39adbe0032c3b2b164c0cffe0ce124fa26d83eec
Author: Susan Hinrichs 
AuthorDate: Tue Dec 15 08:07:39 2020 -0600

Clear call_sm on tunnel reset (#7352)

(cherry picked from commit 85e6f316996613e53ee5eb5d991072a874fc167d)
---
 proxy/http/HttpTunnel.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index d7607fa..1f86437 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -477,6 +477,7 @@ HttpTunnel::reset()
   }
 #endif
 
+  call_sm   = false;
   num_producers = 0;
   num_consumers = 0;
   ink_zero(consumers);



[trafficserver] branch 9.0.x updated: Replace ::exit() with _exit() to avoid secondary cleanup cores (#7395)

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new ca1db9e  Replace ::exit() with _exit() to avoid secondary cleanup 
cores (#7395)
ca1db9e is described below

commit ca1db9e85655c892de95c120634c7cf01e20d439
Author: Susan Hinrichs 
AuthorDate: Tue Dec 15 16:09:57 2020 -0600

Replace ::exit() with _exit() to avoid secondary cleanup cores (#7395)

(cherry picked from commit 2607ff71d85175b49018caf1fc57f6eae3efc5cb)
---
 src/tscore/ink_error.cc | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/tscore/ink_error.cc b/src/tscore/ink_error.cc
index e2f775e..3bf866b 100644
--- a/src/tscore/ink_error.cc
+++ b/src/tscore/ink_error.cc
@@ -52,7 +52,7 @@ void
 ink_fatal_va(const char *fmt, va_list ap)
 {
   fatal_va("Fatal: ", fmt, ap);
-  ::exit(70); // 70 corresponds to EX_SOFTWARE in BSD's sysexits. As good a 
status as any.
+  _exit(70); // 70 corresponds to EX_SOFTWARE in BSD's sysexits. As good a 
status as any.
 }
 
 void
@@ -64,14 +64,14 @@ ink_fatal(const char *message_format, ...)
   fatal_va("Fatal: ", message_format, ap);
   va_end(ap);
 
-  ::exit(70); // 70 corresponds to EX_SOFTWARE in BSD's sysexits. As good a 
status as any.
+  _exit(70); // 70 corresponds to EX_SOFTWARE in BSD's sysexits. As good a 
status as any.
 }
 
 void
 ink_emergency_va(const char *fmt, va_list ap)
 {
   fatal_va("Emergency: ", fmt, ap);
-  ::exit(UNRECOVERABLE_EXIT);
+  _exit(UNRECOVERABLE_EXIT);
 }
 
 void
@@ -84,7 +84,7 @@ ink_emergency(const char *message_format, ...)
   // Should never reach here since ink_emergency_va calls exit()
   va_end(ap);
 
-  ::exit(UNRECOVERABLE_EXIT);
+  _exit(UNRECOVERABLE_EXIT);
 }
 
 void



[trafficserver] branch 8.1.x updated: Added CHANGELOG for 8.1.2

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/8.1.x by this push:
 new cf3613a  Added CHANGELOG for 8.1.2
cf3613a is described below

commit cf3613aaaf9d02d7153343ec552f83d9ef293125
Author: Leif Hedstrom 
AuthorDate: Thu Jan 7 13:36:52 2021 -0700

Added CHANGELOG for 8.1.2
---
 CHANGELOG-8.1.2 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG-8.1.2 b/CHANGELOG-8.1.2
new file mode 100644
index 000..2e87547
--- /dev/null
+++ b/CHANGELOG-8.1.2
@@ -0,0 +1,2 @@
+Changes with Apache Traffic Server 8.1.2
+  #7401 - Fix unnecessary addition of Expires header



[trafficserver] branch 8.1.x updated: Reverting to old negative_caching conditional behavior (#7401)

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/8.1.x by this push:
 new f2f7be7  Reverting to old negative_caching conditional behavior (#7401)
f2f7be7 is described below

commit f2f7be7ac59a25c420038a614b7df684d6ab20ff
Author: Shinya Kawano 
AuthorDate: Wed Dec 23 13:32:54 2020 +0900

Reverting to old negative_caching conditional behavior (#7401)

https://github.com/apache/trafficserver/pull/7361 fixed negative caching
for non-cacheable negative responses, but it broke certain logic
concerning checks for whether a given response was cacheable because of
negative caching configuration. This fixes the latter behavior so it now
behaves as it did before.

Co-authored-by: bneradt 
(cherry picked from commit 80f2c3f40133a59c00db05d8d3a6bc428b4d20f0)
---
 proxy/http/HttpSM.cc   |  8 
 proxy/http/HttpTransact.cc | 10 +-
 proxy/http/HttpTransact.h  | 22 +++---
 3 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 0f737fa..322f04a 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2941,7 +2941,7 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer *p)
   // the reason string being written to the client and a bad CL when 
reading from cache.
   // I didn't find anywhere this appended reason is being used, so 
commenting it out.
   /*
-if (t_state.is_cacheable_and_negative_caching_is_enabled && 
p->bytes_read == 0) {
+if (t_state.is_cacheable_due_to_negative_caching_configuration && 
p->bytes_read == 0) {
 int reason_len;
 const char *reason = 
t_state.hdr_info.server_response.reason_get(_len);
 if (reason == NULL)
@@ -2996,8 +2996,8 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer *p)
   }
 
   // turn off negative caching in case there are multiple server contacts
-  if (t_state.is_cacheable_and_negative_caching_is_enabled) {
-t_state.is_cacheable_and_negative_caching_is_enabled = false;
+  if (t_state.is_cacheable_due_to_negative_caching_configuration) {
+t_state.is_cacheable_due_to_negative_caching_configuration = false;
   }
 
   // If we had a ground fill, check update our status
@@ -6579,7 +6579,7 @@ HttpSM::setup_server_transfer()
 
   nbytes = server_transfer_init(buf, hdr_size);
 
-  if (t_state.is_cacheable_and_negative_caching_is_enabled &&
+  if (t_state.is_cacheable_due_to_negative_caching_configuration &&
   t_state.hdr_info.server_response.status_get() == HTTP_STATUS_NO_CONTENT) 
{
 int s = sizeof("No Content") - 1;
 buf->write("No Content", s);
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 66d96af..3801774 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -4202,7 +4202,7 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
 client_response_code = server_response_code;
 base_response= >hdr_info.server_response;
 
-s->is_cacheable_and_negative_caching_is_enabled = cacheable && 
s->txn_conf->negative_caching_enabled;
+s->is_cacheable_due_to_negative_caching_configuration = cacheable && 
is_negative_caching_appropriate(s);
 
 // determine the correct cache action given the original cache action,
 // cacheability of server response, and request method
@@ -4264,7 +4264,7 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
 //   before issuing a 304
 if (s->cache_info.action == CACHE_DO_WRITE || s->cache_info.action == 
CACHE_DO_NO_ACTION ||
 s->cache_info.action == CACHE_DO_REPLACE) {
-  if (s->is_cacheable_and_negative_caching_is_enabled) {
+  if (s->is_cacheable_due_to_negative_caching_configuration) {
 HTTPHdr *resp;
 s->cache_info.object_store.create();
 s->cache_info.object_store.request_set(>hdr_info.client_request);
@@ -4300,8 +4300,8 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
   SET_VIA_STRING(VIA_PROXY_RESULT, VIA_PROXY_SERVER_REVALIDATED);
 }
   }
-} else if (s->is_cacheable_and_negative_caching_is_enabled) {
-  s->is_cacheable_and_negative_caching_is_enabled = false;
+} else if (s->is_cacheable_due_to_negative_caching_configuration) {
+  s->is_cacheable_due_to_negative_caching_configuration = false;
 }
 
 break;
@@ -4711,7 +4711,7 @@ HttpTransact::set_headers_for_cache_write(State *s, 
HTTPInfo *cache_info, HTTPHd
  sites yields no insight. So the assert is removed and we keep the 
behavior that if the response
  in @a cache_info is already set, we don't override it.
   */
-  if (!s->is_cacheable_and_negative_caching_is_enabled || 
!cache_info->response_get()->valid()) {
+  if 

[trafficserver] branch 9.0.x updated: Reverting to old negative_caching conditional behavior (#7401)

2021-01-07 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new d453794  Reverting to old negative_caching conditional behavior (#7401)
d453794 is described below

commit d4537942d324fb0faafce53e490c87d32531b510
Author: Shinya Kawano 
AuthorDate: Wed Dec 23 13:32:54 2020 +0900

Reverting to old negative_caching conditional behavior (#7401)

https://github.com/apache/trafficserver/pull/7361 fixed negative caching
for non-cacheable negative responses, but it broke certain logic
concerning checks for whether a given response was cacheable because of
negative caching configuration. This fixes the latter behavior so it now
behaves as it did before.

Co-authored-by: bneradt 
(cherry picked from commit 80f2c3f40133a59c00db05d8d3a6bc428b4d20f0)
---
 proxy/http/HttpSM.cc   |  8 
 proxy/http/HttpTransact.cc | 10 +-
 proxy/http/HttpTransact.h  | 22 +++---
 3 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 61bb2c0..e263497 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -3021,7 +3021,7 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer *p)
   // the reason string being written to the client and a bad CL when 
reading from cache.
   // I didn't find anywhere this appended reason is being used, so 
commenting it out.
   /*
-if (t_state.is_cacheable_and_negative_caching_is_enabled && 
p->bytes_read == 0) {
+if (t_state.is_cacheable_due_to_negative_caching_configuration && 
p->bytes_read == 0) {
 int reason_len;
 const char *reason = 
t_state.hdr_info.server_response.reason_get(_len);
 if (reason == NULL)
@@ -3077,8 +3077,8 @@ HttpSM::tunnel_handler_server(int event, 
HttpTunnelProducer *p)
   }
 
   // turn off negative caching in case there are multiple server contacts
-  if (t_state.is_cacheable_and_negative_caching_is_enabled) {
-t_state.is_cacheable_and_negative_caching_is_enabled = false;
+  if (t_state.is_cacheable_due_to_negative_caching_configuration) {
+t_state.is_cacheable_due_to_negative_caching_configuration = false;
   }
 
   // If we had a ground fill, check update our status
@@ -6725,7 +6725,7 @@ HttpSM::setup_server_transfer()
 
   nbytes = server_transfer_init(buf, hdr_size);
 
-  if (t_state.is_cacheable_and_negative_caching_is_enabled &&
+  if (t_state.is_cacheable_due_to_negative_caching_configuration &&
   t_state.hdr_info.server_response.status_get() == HTTP_STATUS_NO_CONTENT) 
{
 int s = sizeof("No Content") - 1;
 buf->write("No Content", s);
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 74f5720..87de57a 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -4437,7 +4437,7 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
 client_response_code = server_response_code;
 base_response= >hdr_info.server_response;
 
-s->is_cacheable_and_negative_caching_is_enabled = cacheable && 
s->txn_conf->negative_caching_enabled;
+s->is_cacheable_due_to_negative_caching_configuration = cacheable && 
is_negative_caching_appropriate(s);
 
 // determine the correct cache action given the original cache action,
 // cacheability of server response, and request method
@@ -4499,7 +4499,7 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
 //   before issuing a 304
 if (s->cache_info.action == CACHE_DO_WRITE || s->cache_info.action == 
CACHE_DO_NO_ACTION ||
 s->cache_info.action == CACHE_DO_REPLACE) {
-  if (s->is_cacheable_and_negative_caching_is_enabled) {
+  if (s->is_cacheable_due_to_negative_caching_configuration) {
 HTTPHdr *resp;
 s->cache_info.object_store.create();
 s->cache_info.object_store.request_set(>hdr_info.client_request);
@@ -4535,8 +4535,8 @@ 
HttpTransact::handle_cache_operation_on_forward_server_response(State *s)
   SET_VIA_STRING(VIA_PROXY_RESULT, VIA_PROXY_SERVER_REVALIDATED);
 }
   }
-} else if (s->is_cacheable_and_negative_caching_is_enabled) {
-  s->is_cacheable_and_negative_caching_is_enabled = false;
+} else if (s->is_cacheable_due_to_negative_caching_configuration) {
+  s->is_cacheable_due_to_negative_caching_configuration = false;
 }
 
 break;
@@ -4946,7 +4946,7 @@ HttpTransact::set_headers_for_cache_write(State *s, 
HTTPInfo *cache_info, HTTPHd
  sites yields no insight. So the assert is removed and we keep the 
behavior that if the response
  in @a cache_info is already set, we don't override it.
   */
-  if (!s->is_cacheable_and_negative_caching_is_enabled || 
!cache_info->response_get()->valid()) {
+  if