Manage internal errors on HTTP
Hello, I'm developing a simple server and I'm not sure on how to manage an internal error only in a certain case:
Suppose that the server transmits a file (non chunked): first send the http header and then start sending the content; but before finish sending the file content it occurs an error (i.e.)while reading from the file.
There's the problem: if I send a new http header specifying the error, that header will be interpreted as a part of the file; and if I kill the conection (graceful or abortive shutdown) without any information, the client will only know that the conection has been closed and will assume that if the content size is minor than the content-length specifyed in the header some problem should happened (but will be only a pressumption).
What is the correct way in those cases?
Thank's in advance