fdiary commented on issue #8539:
URL: https://github.com/apache/trafficserver/issues/8539#issuecomment-982680697


   @bneradt Let me first show the minimal example of the following issue : 
   > (also compress plugin does nothing in send_request timing if transform is 
registered in cache_lookup_complete timing, remove-access-encoding true is not 
effective for this case)
   
   * dump_accept_encoding.py
   ```python
   #!/usr/bin/env python3
   import http.server as SimpleHTTPServer
   import socketserver as SocketServer
   
   PORT = 8888
   
   class TestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
   
     def do_GET(self):
       self.send_response(200)
       self.send_header('Content-Type', 'text/plain')
       self.send_header('Cache-Control', 'max-age=60')
       result = bytes(str(self.headers.get('Accept-Encoding')) + '\n', 'utf-8')
       self.send_header('Content-Length', len(result))
       self.end_headers()
       self.wfile.write(result)
   
     do_POST = do_GET
   
   httpd = SocketServer.TCPServer(("", PORT), TestHandler)
   
   httpd.serve_forever()
   ```
   
   * plugin.config
   ```
   compress.so compress.config
   ```
   
   * compress.config
   ```
   cache false
   remove-accept-encoding true
   compressible-content-type text/*
   ```
   
   Now let's show the result of the 4 requests as written in the previous 
comment : 
   
   ```
   $ curl -X GET -H 'Accept-Encoding: gzip' http://localhost:8080/
   None <- Accept-Encoding is stripped in the request to the origin server
   $ curl -X GET -H 'Accept-Encoding: gzip' http://localhost:8080/
   None <- cached result, same as above
   $ curl -X POST -H 'Accept-Encoding: gzip' -H 'Content-Length: 0' 
http://localhost:8080/
   gzip <- Accept-Encoding is NOT stripped in the request to the origin server
   $ curl -X POST -H 'Accept-Encoding: gzip' -H 'Content-Length: 0' 
http://localhost:8080/
   None <- Accept-Encoding is stripped in the request to the origin server
   ```
   
   As you can see, CACHE_LOOKUP_HIT_FRESH is not a proper enough condition to 
know 'ATS will return a cached response'. But I'm wondering what should be the 
way to go.
   
   * we should have another state than `CACHE_LOOKUP_HIT_FRESH` ?
   
   * each plugin should implement the same logic as 
`does_method_require_cache_copy_deletion` ?
   
https://github.com/apache/trafficserver/blob/420935b7d7c61ab94a8addaaa43b6affb1fa9ab7/proxy/http/HttpTransact.cc#L727-L733
   
   * we should introduce another hook like `READ_CACHE_RESPONSE_HOOK` when we 
are really sending a cache response ?
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to