I have a case where I am uploading a file and I know the final size once the upload is complete and provide this information when someone is requesting the file while the upload is still in progress.
My problem is range requests vs non range request and how to handle the resource size.
In the case of non range request I always set Content-Length to the expected/final size of the resource and let the server tail the file.
In the case of range request I set the */{complete-length} to the current size of the resource and the server returns the current payload without tailing the file.
What I'm unsure of is whether this is spec compliant?
In terms of non range request the spec says:
the Content-Length indicates the size of the selected representation
While in terms of range request the spec says:
The complete-length in a 416 response indicates the current length of the selected representation.
So the question here is whether the spec means that these two are the same or not. My current implementation assumes they are not the same, i.e:
Content-Lengthis the final/expected size of the resourcecomplete-lengthis the current size of the resource