You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chris Morris <ch...@clabs.org> on 2003/04/03 18:28:26 UTC
[users@httpd] cgi serving xml from Apache problem
Howdy - I've got a Ruby script I'm trying to use to serve up some xml. I
posted to the Ruby list and now it seems to be an Apache and stupid-me
issue. Can anyone enlighten me?
(2.0.44 Win32, btw)
----- Original Message -----
From: "Brian Candler" <B....@pobox.com>
To: "ruby-talk ML" <ru...@ruby-lang.org>
Sent: Thursday, April 03, 2003 10:02 AM
Subject: Re: cgi serving xml from Apache problem
> On Fri, Apr 04, 2003 at 12:13:48AM +0900, Chris Morris wrote:
> > Transfer-Encoding: chunked
> > Content-Type: text/xml
> >
> > ff2
> > <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
> >
> > Notice the 'ff2' inserted in there. Anyone know what the heck that is?
>
> I think it's because you have "Transfer-Encoding: chunked" - would I be
right
> in saying your XML document is 4082 bytes long?
It's close - a little longer than than (4472 or somesuch).
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] cgi serving xml from Apache problem
Posted by Chris Morris <ch...@clabs.org>.
> > > Howdy - I've got a Ruby script I'm trying to use to serve up some xml.
I
> > > posted to the Ruby list and now it seems to be an Apache and stupid-me
> > > issue. Can anyone enlighten me?
> >
> > What, exactly, is the problem? Transfer-Encoding: chunked means just
> that:
My Ruby script was not flushing the stdout pipe, which I guess trigged
Apache into using the chunked transfer. By making sure the script flushes
stdout, Apache no longer uses the chunked mode and the XML comes over clean.
Chris
http://clabs.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] cgi serving xml from Apache problem
Posted by Chris Morris <ch...@clabs.org>.
> > Howdy - I've got a Ruby script I'm trying to use to serve up some xml. I
> > posted to the Ruby list and now it seems to be an Apache and stupid-me
> > issue. Can anyone enlighten me?
>
> What, exactly, is the problem? Transfer-Encoding: chunked means just
that:
> it breaks up the result into smaller chunks which look like:
>
> size (in hex)
> data
> size
> data
> ...
> 0
>
> Whatever is on the recipient side must understand the Transfer-Encoding
> directive and recombine the pieces. I haven't actually checked, but it
> seems like apache defaults to a chunked transfer for files.
The problem is the content is xml and the recipient (IE in this case...)
includes the chunk size as part of the xml content and declares invalid xml.
Is there anyway I can just not use the chunked setting?
If I have the web server serve up a plain ol' .xml file, the header doesn't
indicate chunked in that case:
HTTP/1.1 200 OK
Date: Thu, 03 Apr 2003 17:02:00 GMT
Server: Apache/2.0.44 (Win32)
Last-Modified: Thu, 03 Apr 2003 17:00:11 GMT
ETag: "189af-1165-f7293716"
Accept-Ranges: bytes
Content-Length: 4453
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/xml
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
[snip...]
Chris
http://clabs.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] cgi serving xml from Apache problem
Posted by Jacob Coby <jc...@listingbook.com>.
> Howdy - I've got a Ruby script I'm trying to use to serve up some xml. I
> posted to the Ruby list and now it seems to be an Apache and stupid-me
> issue. Can anyone enlighten me?
What, exactly, is the problem? Transfer-Encoding: chunked means just that:
it breaks up the result into smaller chunks which look like:
size (in hex)
data
size
data
...
0
Whatever is on the recipient side must understand the Transfer-Encoding
directive and recombine the pieces. I haven't actually checked, but it
seems like apache defaults to a chunked transfer for files.
There may be some extra stuff added to safely transmit the data, which is
where you are getting the extra 10 bytes.
-Jacob
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org