You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/09/14 19:24:16 UTC

[GitHub] [trafficserver] bneradt commented on a diff in pull request #9092: better logic for checking if a server allows storing

bneradt commented on code in PR #9092:
URL: https://github.com/apache/trafficserver/pull/9092#discussion_r971208811


##########
tests/gold_tests/cache/replay/cache-control-pragma.replay.yaml:
##########
@@ -0,0 +1,215 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# This replay file assumes that caching is enabled and
+# proxy.config.http.cache.ignore_client_cc_max_age is set to 0 so that we can
+# test max-age in the client requests.
+#
+
+meta:
+  version: "1.0"
+
+sessions:
+- transactions:
+  # Pragma: no-cache will prevent caching
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      url: /pragma/no-cache
+      headers:
+        fields:
+          - [ uuid, pragma-populate-cache]
+          - [ Host, example.com ]
+
+    server-response:
+      status: 200
+      reason: OK
+      headers:
+        fields:
+        - [ Content-Length, 4 ]
+        - [ Pragma, "no-cache" ]
+
+    proxy-response:
+      status: 200
+      headers:
+        fields:
+          - [ Content-Length, { value: 4, as: equal}]
+  # Re-request to make sure it cached
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      url: /pragma/no-cache
+      headers:
+        fields:
+          - [ uuid, pragma-populate-cache-verify]
+          - [ Host, example.com ]
+
+    server-response:
+      status: 200
+      reason: OK
+      headers:
+        fields:
+          # change content length
+        - [ Content-Length, 5 ]
+        - [ Pragma, "no-cache" ]
+
+    proxy-response:
+      status: 200
+      headers:
+        fields:
+          - [ Content-Length, { value: 5, as: equal}]
+
+  # Cache-Control: no-cache will not cache
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      url: /cc/no-cache
+      headers:
+        fields:
+          - [ uuid, cc-no-cache]
+          - [ Host, example.com ]
+
+    server-response:
+      status: 200
+      reason: OK
+      headers:
+        fields:
+        - [ Content-Length, 4 ]
+        - [ Cache-Control, "no-cache" ]
+
+    proxy-response:
+      status: 200
+      headers:
+        fields:
+          - [ Content-Length, { value: 4, as: equal}]
+  # Re-request to make sure it cached

Review Comment:
   "make sure it was not cached."



##########
tests/gold_tests/cache/replay/cache-control-pragma.replay.yaml:
##########
@@ -0,0 +1,215 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# This replay file assumes that caching is enabled and
+# proxy.config.http.cache.ignore_client_cc_max_age is set to 0 so that we can
+# test max-age in the client requests.
+#
+
+meta:
+  version: "1.0"
+
+sessions:
+- transactions:
+  # Pragma: no-cache will prevent caching
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      url: /pragma/no-cache
+      headers:
+        fields:
+          - [ uuid, pragma-populate-cache]
+          - [ Host, example.com ]
+
+    server-response:
+      status: 200
+      reason: OK
+      headers:
+        fields:
+        - [ Content-Length, 4 ]
+        - [ Pragma, "no-cache" ]
+
+    proxy-response:
+      status: 200
+      headers:
+        fields:
+          - [ Content-Length, { value: 4, as: equal}]
+  # Re-request to make sure it cached
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      url: /pragma/no-cache
+      headers:
+        fields:
+          - [ uuid, pragma-populate-cache-verify]
+          - [ Host, example.com ]
+
+    server-response:
+      status: 200
+      reason: OK
+      headers:
+        fields:
+          # change content length
+        - [ Content-Length, 5 ]
+        - [ Pragma, "no-cache" ]
+
+    proxy-response:

Review Comment:
   Perhaps some comment such as:
   
   ```
   # Expect the origin's response of size 5 rather than the previous response of 
   # size 4 since the original response should not have been cached due to no-cache.
   ```



##########
tests/gold_tests/cache/replay/cache-control-pragma.replay.yaml:
##########
@@ -0,0 +1,215 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+#
+# This replay file assumes that caching is enabled and
+# proxy.config.http.cache.ignore_client_cc_max_age is set to 0 so that we can
+# test max-age in the client requests.
+#
+
+meta:
+  version: "1.0"
+
+sessions:
+- transactions:
+  # Pragma: no-cache will prevent caching
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      url: /pragma/no-cache
+      headers:
+        fields:
+          - [ uuid, pragma-populate-cache]
+          - [ Host, example.com ]
+
+    server-response:
+      status: 200
+      reason: OK
+      headers:
+        fields:
+        - [ Content-Length, 4 ]
+        - [ Pragma, "no-cache" ]
+
+    proxy-response:
+      status: 200
+      headers:
+        fields:
+          - [ Content-Length, { value: 4, as: equal}]
+  # Re-request to make sure it cached

Review Comment:
   Actually, we're making sure it was not cached, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org