tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 63932] New: Content compression breaks contract of ETag
Date Mon, 18 Nov 2019 11:58:33 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=63932

            Bug ID: 63932
           Summary: Content compression breaks contract of ETag
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Connectors
          Assignee: dev@tomcat.apache.org
          Reporter: michaelo@apache.org
  Target Milestone: -----

This is basically the same as Bug 39727.

Consider a huge JSON file, content compression is on in the connector and this
simple servlet:

> protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
> 	response.setContentType("application/json");
> 	Path dump = Paths.get("projects.json");
> 	response.setContentLengthLong(Files.size(dump));
> 	response.setHeader("ETag", String.format("\"%d+%s\"", Files.size(dump), Files.getLastModifiedTime(dump)));
> 	Files.copy(dump, response.getOutputStream());
> }

and the following curl requests:

> $ curl http://md11gxtc:8080/awesome/awesome  -H "Accept-Encoding: identity" -I
> HTTP/1.1 200
> ETag: "2571736354+2016-01-07T12:29:06.455824Z"
> vary: accept-encoding
> Content-Type: application/json
> Content-Length: 2571736354
> Date: Mon, 18 Nov 2019 11:50:04 GMT

This one is fine, now lets request compression:
> $ curl http://md11gxtc:8080/awesome/awesome  -H "Accept-Encoding: gzip" -I
> HTTP/1.1 200
> ETag: "2571736354+2016-01-07T12:29:06.455824Z"
> vary: accept-encoding
> Content-Encoding: gzip
> Content-Type: application/json
> Transfer-Encoding: chunked
> Date: Mon, 18 Nov 2019 11:50:46 GMT

RFC 7232, 2.1 + 2.3 + 2.3.1 + 2.3.3 say: ETag generation happens over content
negotiation.

RFC 7231, 5.3 these headers are part of content negotiation:
Accept
Accept-Charset
Accept-Encoding
Accept-Language

Basically, Tomcat would require to modify the ETag somehow and on the fly
remove the change when If-Match/If-None-Match arrives at the servlet. Fully
opaque.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message