Re: PoCo::Client::HTTP Bug

2005-05-06 Thread Tim Cheadle
 How about:

   If there's nonzero-length content
 And there isn't a Content-Length header
   We go ahead and add one?

 Would that cause damage anywhere?
 If so, is there an alternate solution that would cause less (ideally
 no) damage?

I suppose it wouldn't hurt anything to simply add a Content-Length header
to every request (including those with zero-length content) if no such
header exists already.  Any HTTPd that blows up when it sees
Content-Length=0 on a GET request is buggy to begin with. =)

If there is zero-length content, we should still add Content-Length=0.

Tim



Re: PoCo::Client::HTTP Bug

2005-05-06 Thread Tim Cheadle
 Surely if someone is using chunks you don't want to use content-length?

HTTP 1.0 does not support OPTIONS (and therefore chunks) requests.



PoCo::Client::HTTP Bug

2005-05-04 Thread Tim Cheadle
I'm trying to use POE::Component::Client::HTTP for asynchronous POST
requests, and it has a fatal bug that breaks such requests.  As per the
HTTP 1.0 spec, all POSTs are required to have a Content-Length header
specifying the number of octets in the content of the request.  The POE
component does not automatically set this header if not previously
present.

This results in servers not knowing when the request is complete.

If you add the Content-Length header, things work great.

Tim


Here is a simple patch:

--- HTTP.pm.old 2005-05-04 16:31:57.600035522 -0400
+++ HTTP.pm 2005-05-04 16:32:02.713339216 -0400
@@ -344,15 +344,6 @@
   );
   }

-  # Add a Content-Length header for POSTs
-  if (defined $http_request-method() and $http_request-method() eq
'POST') {
-if (defined $http_request-content()) {
-  $http_request-header(
-'Content-Length' = length($http_request-content())
-  );
-}
-  }
-
   # Create a progress postback if requested.
   my $progress_postback;
   $progress_postback = $sender-postback($progress_event, $http_request,
$tag)



Re: PoCo::Client::HTTP Bug

2005-05-04 Thread Matt Cashner
On Wed, 2005-05-04 at 13:40 -0700, Mathieu Longtin wrote:
 Actually, you should do a use bytes before you calculate
 the length. Otherwise, unicode strings will get the number
 of characters, not bytes, and send the wrong length.

poe itself does a use bytes on startup so doing that again here is not
necessary.

--
sungo



Re: PoCo::Client::HTTP Bug

2005-05-04 Thread Mathieu Longtin
All I know is I had this issue with Poco::Server::HTTP. So
when I see automated content measurement, I'd rather have
them fixed in the library.

--- Arthur Bergman [EMAIL PROTECTED] wrote:
 
 
 On 4 May 2005, at 22:04, Matt Cashner wrote:
 
  On Wed, 2005-05-04 at 13:40 -0700, Mathieu Longtin
 wrote:
  Actually, you should do a use bytes before you
 calculate
  the length. Otherwise, unicode strings will get the
 number
  of characters, not bytes, and send the wrong length.
 
  poe itself does a use bytes on startup so doing that
 again here is not
  necessary.
 
  --
  sungo
 
 
 
 surely it is lexically scoped, is it not?
 
 -
 CTO @ Fotango Ltd
 +447834716919
 http://www.fotango.com/
 
 



Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html