HTTP Compliance: do not remove ETag header from partial responses

RFC 2616 section 10.2.7 says that partial responses MUST include ETag
header, if it would have been sent in a 200 response to the same request.

Co-Advisor test cases:
    test_case/rfc2616/scHdrs-206-include-explicit-withVary-noIfs
    test_case/rfc2616/scHdrs-206-include-explicit-woutVary-noIfs
    test_case/rfc2616/scHdrs-206-include-other-If-Range-strong
HTTP Compliance: do not remove ETag header from partial responses.

RFC 2616 section 10.2.7 says that partial responses MUST include ETag
header, if it would have been sent in a 200 response to the same request.

Co-Advisor test cases:
    test_case/rfc2616/scHdrs-206-include-explicit-withVary-noIfs
    test_case/rfc2616/scHdrs-206-include-explicit-woutVary-noIfs
    test_case/rfc2616/scHdrs-206-include-other-If-Range-strong

=== modified file 'src/client_side.cc'
--- src/client_side.cc	2010-09-13 01:48:17 +0000
+++ src/client_side.cc	2010-09-19 02:58:10 +0000
@@ -1244,42 +1244,41 @@ ClientSocketContext::buildRangeHeader(Ht
          */
         debugs(33, 3, "clientBuildRangeHeader: will not do ranges: " << range_err << ".");
         delete http->request->range;
         http->request->range = NULL;
     } else {
         /* XXX: TODO: Review, this unconditional set may be wrong. - TODO: review. */
         httpStatusLineSet(&rep->sline, rep->sline.version,
                           HTTP_PARTIAL_CONTENT, NULL);
         // web server responded with a valid, but unexpected range.
         // will (try-to) forward as-is.
         //TODO: we should cope with multirange request/responses
         bool replyMatchRequest = rep->content_range != NULL ?
                                  request->range->contains(rep->content_range->spec) :
                                  true;
         const int spec_count = http->request->range->specs.count;
         int64_t actual_clen = -1;
 
         debugs(33, 3, "clientBuildRangeHeader: range spec count: " <<
                spec_count << " virgin clen: " << rep->content_length);
         assert(spec_count > 0);
-        /* ETags should not be returned with Partial Content replies? */
-        hdr->delById(HDR_ETAG);
+
         /* append appropriate header(s) */
 
         if (spec_count == 1) {
             if (!replyMatchRequest) {
                 hdr->delById(HDR_CONTENT_RANGE);
                 hdr->putContRange(rep->content_range);
                 actual_clen = rep->content_length;
                 //http->range_iter.pos = rep->content_range->spec.begin();
                 (*http->range_iter.pos)->offset = rep->content_range->spec.offset;
                 (*http->range_iter.pos)->length = rep->content_range->spec.length;
 
             } else {
                 HttpHdrRange::iterator pos = http->request->range->begin();
                 assert(*pos);
                 /* append Content-Range */
 
                 if (!hdr->has(HDR_CONTENT_RANGE)) {
                     /* No content range, so this was a full object we are
                      * sending parts of.
                      */

Reply via email to