Some of the documents in our backend system are read only and dynamically generated when the content is requested. Generating the content for these files is expensive and files of different length are generated over time.
Is there a way I can return an approximate or placeholder content length that isn’t the actual length of the file but when asked for the content via a GET request generate the actual file and return the correct length and content via the stream requests? I tried passing back -1 for the length assuming it could be a magic number to indicate the length is unknown and then repeated IFile.Read requests could be used to return a document of unknown length but that didn't work.
What I want to avoid is generating the content when browsing a directory in Explorer to provide the unknown ContentLength value. Then only when the IFile.Read calls are made generate the document content, cache it and use that cached file to fulfil the content read requests. Is it possible to do this using the ITHit WebDAV engine? Is there another approach to this problem?
It seems like the WebDAV protocol could support returning any content length for documents when browsing a directory but when requesting the content a different / accurate content length could be returned with the content.