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.

--- Tim Cheadle <[EMAIL PROTECTED]> wrote:
> 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)
> 
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to