Hey all!

I've got the latest CVS and I've been using POE::Filter::HTTPD to convert 
data between HTTP::* objects and streams.  I noticed two things.

First, *HTTPD wants to tack on a duplicate protocol and version to each 
outgoing stream:

my $stream = $httpd_object->put( $response_object );
print @$stream;

Will yield something like:

HTTP/1.0 HTTP/1.1 200 OK
Connection: close
Date: Mon, 26 Nov 2001 03:40:10 GMT
Accept-Ranges: bytes
.......

I use regular expressions to remove the extra codes, but since the HTTP::* 
objects include that information I don't think it should be blindly prepended 
as it is presently:

(From CVS version of POE::Filter::HTTPD):
push @result, $_->headers_as_string("\x0D\x0A"); # network newlines!
# network newlines!  Don't touch the content!
push @raw, 'HTTP/1.0 ' . join("\x0D\x0A", @result, "") . $_->content;

Second, as you'll note above you cannot send a response header to a browser 
without content, because the trailing network lines indicate to the browser 
that the content will follow.

In my application, I'm using PoCoCi::UserAgent and LWP::UserAgent's callback 
for data chunks which means I'll be passing data back later on.  Forcing the 
browser to think content follows the header as above thwarts this.

If I've misstated something or my analysis is incorrect on one of these 
points, I'm sure you'll let me know. :)

Thanks.

Reply via email to