> Hi, everybody.
>
[quoted text clipped - 7 lines]
> mentioned that in case when response contains no data the correct
> HTTP answer code must be "204 No Content".

Signature
http://www.joergjooss.de
mailto:news-reply@joergjooss.de
No, I can not. I am sending HTTP POST reqests from my tool and the body
of these requests has binary form. I could not find the way how to simulate
that with fiddler tool. But I can easyly make dumps with Ethereal.
The problem now looks for me a little bit different. Exception is raised
not on 200 OK with empty body but rather on something like broken connection
when it takes time for my remote hardware embedded HTTP server to process
incoming request. It happend simply more often when the response was 200 OK
and no message body attached.
Could the reason of WebException WebExceptionStatus.ReceiveFailure
status be the broken or mishandled connection?
Am I applying correct procedure for send request/read response?
int ret = 0;
HttpWebResponse hwResponse = null;
Stream sr = null;
HttpWebRequest hwreq = _prepareRequest(cgi,cmdLen);
Stream s = hwr.GetRequestStream();
s.Write(buf,0,len);
s.Close();
try
{
hwResponse = (HttpWebResponse) hwr.GetResponse();
if(hwResponse.StatusCode == HttpStatusCode.OK)
{
if(hwr.HaveResponse)
{
sr = hwResponse.GetResponseStream();
int offset=0;
int remaining = len;
while (remaining > 0)
{
int read = sr.Read(buf, offset, remaining);
if (read <= 0)
break;
remaining -= read;
offset += read;
}
ret = len - remaining;
}
}
catch(WebException we)
{
if(we.Status == WebExceptionStatus.ProtocolError)
{
throw we;
}
}
finally
{
if(sr != null)
sr.Close();
if(hwResponse != null)
hwResponse.Close();
}
> > Hi, everybody.
> >
[quoted text clipped - 11 lines]
>
> Cheers,
Joerg Jooss - 01 Jul 2005 08:04 GMT
> No, I can not. I am sending HTTP POST reqests from my tool and
> the body of these requests has binary form. I could not find the way
> how to simulate that with fiddler tool.
Hm... why "simulate"? Just run it as proxy and look what happens...
> But I can easyly make dumps with Ethereal.
Fair enough!
> The problem now looks for me a little bit
> different. Exception is raised not on 200 OK with empty body but
[quoted text clipped - 5 lines]
> connection? Am I applying correct procedure for send
> request/read response?
Assuming _pepareRequest doesn't do silly thing, your code looks OK. I'm
not sure that the client side is the culprit here. Could it be that the
server really stops sending while streaming back a response?
Cheers,

Signature
http://www.joergjooss.de
mailto:news-reply@joergjooss.de