vendredi 19 août 2016

HTTP server: What's the right way closing a socket after an internal error and partial data already sent

I'm writing an HTTP server for educational purposes. This is the scenario I need to handle: Suppose the client requested a file. I want to send it's content in the body of the message. Now, the file might be large so I send it in chunks. Suppose that after some iterations, I experienced an internal error (i.e. couldn't read file) -

What should the server do at this point? According to my tutor, only closing the connection isn't enough ("Client must identify an error has happened")

Aucun commentaire:

Enregistrer un commentaire