• Nils Goroll's avatar
    Call trimstore only once when copying the body after a 304 · 89c1688f
    Nils Goroll authored
    It is my understanding that the objtrimstore stevedore API function is
    only to be called once when the object is complete, which I believe is
    also in line with the comment on ObjExtend() that "The final flag must
    be set on the last call".
    
    If this understanding of the API is correct, we did not adhere to it in
    the fetch code when we made a copy of an existing stale object after a
    304 response: There, we iterated over the stale object and did not set
    the final flag just once when the object was complete, but rather after
    each storage segment was copied.
    
    This commit fixes this, adds some pedentry to the simple storage and
    extends b00062.vtc to test this behavior specifically. On top, g6.vtc
    also triggered without the fix but the duplicate trim detection in place.
    
    This issue has originally surfaced in the SLASH/fellow storage where the
    trimstore function implicitly asserted to only be called once.
    
    Ref 115742b0
    Ref https://gitlab.com/uplex/varnish/slash/-/issues/33
    89c1688f