Subject: problem with responses to post-requests

From: [email-masked]
Date: Fri, 25 Aug 2000 12:32:15 +0200 (MEST)

i've got a problem while responding to POST requests.

i'm currently developing a small http-server to configure some files via a
webbrowser.

while sending responses to GET requests everything works fine and the
browser prints the output. but if i try to handle a post request i encounter
different reactions by netscape navigator and internet explorer.

after processing the content of the post-request i'm sending the
html-output to the client and close the connection. this works fine with NN. but IE
doesn't show the page and gives an error-msg telling me that the connection
has been reset.

i just don't get it why NN is doing fine and IE not.

what's the difference between responses to GET and POST requests ?

why is IE telling me errors and not showing the transmitted page ?

greetings,
olli

here's some of the code:

while ((conn = accept(sock,(struct sockaddr *) &addr,&addr_length)) >= 0)
{
 /*
  reading/parsing header etc.
 */

if (strcmp(request->method,"POST") == 0)
{
 putsock(conn,"HTTP/1.0 200 OK\n");
 putsock(conn,"Content-Type: text/plain\n\n");
 putsock(conn,"Netscape Navigator shows this.\
              Internet Explorer gives error");
}

// here NN says "Document Done" and shows the page
// but IE gives error msg "Connection Reset"
close(conn); 
}

-- 
Sent through GMX FreeMail - http://www.gmx.net

---

From: "Scott Lawrence" <[email-masked]>
Date: Fri, 25 Aug 2000 07:36:57 -0400

> after processing the content of the post-request i'm sending
> the html-output to the client and close the connection. this
> works fine with NN. but IE doesn't show the page and gives an
> error-msg telling me that the connection has been reset.

> what's the difference between responses to GET and POST

There isn't any.

> // but IE gives error msg "Connection Reset"

Those "\n" should really be "\r\n", but that isn't your problem.

Your TCP is probably (incorrectly) sending an RST when you do the
close.  If the browser hasn't read all of the response, then any
unread part will be discarded and produce the error you are
seeing.  The difference between the browsers could be timing or
differences in the way they do i/o.

If your platform supports it, use shutdown() rather than close().

--
Scott Lawrence         Architect             <[email-masked]>
Virata             http://www.virata.com/         http://emweb.com/

---

From: John Stracke <[email-masked]>
Date: Fri, 25 Aug 2000 12:09:53 -0400

> i'm currently developing a small http-server to configure some files via a

You might find that the easiest way to be compliant is to build on top of an existing
Web server.  If you use Apache, you can strip out the parts you don't need.

--
/==============================================================\
|John Stracke    | http://www.ecal.com |My opinions are my own.|
|Chief Scientist |=============================================|
|eCal Corp.      |The plural of mongoose is polygoose.         |
[email-masked]|                                             |
\==============================================================/

---

From: "Joris Dobbelsteen" <[email-masked]>
Date: Sun, 27 Aug 2000 13:17:26 +0200

Are you sure "\n" (C++) represents CRLF or only a CR???

I thought it represents only the CR. Maybe this is the problem, because
RFC2616 requires you to send only CRLF in the headers and
status/'command'-line.

- Joris

> -----Original Message-----
> From: [email-masked] [mailto:[email-masked]]
> Sent: vrijdag 25 augustus 2000 12:32
> To: [email-masked]
> Subject: problem with responses to post-requests
>
>