Re: Server reply formatting (newbie)

David Cary (d.cary@ieee.org)
Thu, 15 Jan 1998 01:44:56 -0500


Message-Id: <l03130301b0e35996b950@[192.168.1.40]>
In-Reply-To: <l03020904b0e3564cd9f4@[204.71.8.33]>
Date: Thu, 15 Jan 1998 01:44:56 -0500
To: www-html@w3.org
From: David Cary <d.cary@ieee.org>
Cc: "Jacob W. Anderson" <jwa@zen.praja.com>
Subject: Re: Server reply formatting (newbie)


I don't quite understand the terminology Jacob W. Anderson uses, but the
example looks a lot like what my CGI program spits out, so I assume I'm
doing roughly the same thing.

None of my programs ever write the "HTTP/1.1 code status" (I think the
Apache server does it for me). (And what's with the inconsistent line
endings ?)
Here is one of my CGI programs:

int
main(/*int argc, char *argv[]*/){

        cout <<
		"Content-type: text/html\n\n"
        	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2
Final//EN\">\n"
  	   	"<html>\n"
		;

... good stuff snipped ...

        cout <<
        	"</body>\n"
       	 	"</html>\n"
		;
        return(0);//success.
}

(This code was copied from a *working* CGI program).

(yes, I know I should do HTML 4.0 -- maybe next week).

Notice that I never tell Apache how long my document will be -- the only
way it could possibly tell where the end of the transmission is to wait for
the stream to actually end -- which happens when close() is called on
stdout when my program ends.

Does this help ?

"Jacob W. Anderson" <jwa@zen.praja.com>
>Hi!
>
>I'm trying to connect my java http client through the Apache 1.2
>proxy to my proprietary http/1.1 server.  I can connect just fine,
>but my reponse from the server doesn't seem to be compatible with
>the apache 1.2 proxy.  Essentially, I am writing the following to
>the response stream:
>
>  HTTP/1.1 code status<CRLF>
>  Content-Type: application/octet-stream<LF>
>  Content-Length: 59<LF>
>  <CRLF>
>  <59 bytes of octets>
>
>
>Am I missing some important detail here?  It seems to me that the
>proxy server doesn't know that the end of the stream has been reached.
>Aside from the content-length, is there some other method which is
>expected by servers to indicate EOF (end-of-transmission rather).
>
>Thanks!
>
>--Jacob W. Anderson (jwa@praja.com)

--
+ David Cary "mailto:d.cary@ieee.org" "http://www.rdrop.com/~cary/"
| Future Tech, Unknowns, PCMCIA, digital hologram, <*> O-