[cs631apue] SWS File I/O error

Rob Hoffmann rhoffman at stevens.edu
Wed Dec 14 15:46:23 EST 2011


I have another quick question:

The response header should be sent before writing the file to the 
socket, after the file has been located. However, if a failure happens 
during the reading/sending of the file, then the server should send a 
status 500...except the response header was already sent. How could I 
get around this issue, considering a) Dummy reading the file first 
doesn't guarantee it will work the second time, and b) the file could be 
larger than the amount of memory available to hold the entire thing.

The same logic could apply when executing a cgi script throws an error 
as well -- the header was already sent.

-Rob


More information about the cs631apue mailing list