C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 07-24-2009, 05:22 AM   #1
Registered User
 
Join Date: Mar 2005
Location: Juneda
Posts: 224
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
Niara
Niara is offline   Reply With Quote
Old 07-24-2009, 09:41 AM   #2
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 2,845
I think you've already come up with the correct answer. The server should close the connection. This will tell the client that there was an error as long as the bytes transferred is less than the content-length passed in the header.
bithub is offline   Reply With Quote
Old 07-24-2009, 02:01 PM   #3
Registered User
 
Join Date: Mar 2005
Location: Juneda
Posts: 224
Hello bithub, thank's for the help and your time.

I'll do in that way.

Also I have been searching and reading a bit more and I found the Out Of Band data, but I'm not sure if they are for that purpose or if I can use it in whatever conection. That's difficult to me, so for the moment I'll close de connection and problem solved

Thank's.
Niara
Niara is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Http 502 and 503 errors George2 C# Programming 1 07-18-2008 03:21 AM
Internal Compiler Error Elysia C++ Programming 20 07-05-2008 03:59 AM
global namespace errors stubaan C++ Programming 9 04-02-2008 03:11 PM
errors in class(urgent ) ayesha C++ Programming 1 11-10-2001 10:14 PM
errors in class(urgent) ayesha C++ Programming 2 11-10-2001 06:51 PM


All times are GMT -6. The time now is 08:34 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22