libwww-perl-5.810 (HTTP::Message content not bytes)

libwww-perl-5.810 (HTTP::Message content not bytes)

am 14.04.2008 20:21:20 von mailinglists

------=_NextPart_000_00C5_01C89E21.AB886050
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit

"Don't allow HTTP::Message content to be set to Unicode strings."



I'm going to assume this change above is whats breaking my scripts. My
script is using NicToolServerAPI.pm which in turn uses LWP::UserAgent. The
script dies out with the error above when I run it. I'm not sure what has
to be done, my guess is that the script is POST'ing the URL in plain text
and it needs to be in some other format. I've snipped out a few pieces of
code in hopes that somebody here might be able to give me a quick fix.



===NicToolServerAPI.pm Snip calling LWP::UserAgent====

my $ua = new LWP::UserAgent;

my $req = HTTP::Request->new('POST',$url);





===NicToolServerAPI.pm snip setting $url====



sub send_request {

my $self = shift;

my $url;

if ($NicToolServerAPI::use_https_authentication) {

$url = 'https://'.$NicToolServerAPI::server_host.':'
..$NicToolServerAPI::https_server_port;

} else {

$url = 'http://'.$NicToolServerAPI::server_host.':'
..$NicToolServerAPI::server_port;

}

my $func = 'send_'.$NicToolServerAPI::data_protocol.'_request';

if ($self->can($func)) {

return $self->$func($url,@_);

} else {

return {'error_code'=>501,'error_msg'=>'Data protocol not supported:
'.$NicToolServerAPI::data_protocol};

}

}







Anybody know what I need to do to convert $url to bytes? Is this just a
base64 encode or something?





~Shaun




------=_NextPart_000_00C5_01C89E21.AB886050--

Re: libwww-perl-5.810 (HTTP::Message content not bytes)

am 14.04.2008 20:27:54 von derhoermi

* Shaun wrote:
>"Don't allow HTTP::Message content to be set to Unicode strings."
>
>I'm going to assume this change above is whats breaking my scripts. My
>script is using NicToolServerAPI.pm which in turn uses LWP::UserAgent. The
>script dies out with the error above when I run it. I'm not sure what has
>to be done, my guess is that the script is POST'ing the URL in plain text
>and it needs to be in some other format. I've snipped out a few pieces of
>code in hopes that somebody here might be able to give me a quick fix.

Presumably you have to clear the string you are passing in of the UTF-8
flag, e.g. by using Encode::encode or perhaps Encode::_utf8_off.
--
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

Re: libwww-perl-5.810 (HTTP::Message content not bytes)

am 14.04.2008 22:21:00 von gisle

Can you try if the newly upload libwww-perl-5.811 fixes your problem.
It will not complain about Unicode strings unless they actually
contain chars that can't be treated as bytes.

--Gisle

RE: libwww-perl-5.810 (HTTP::Message content not bytes)

am 14.04.2008 22:55:09 von mailinglists

This version looks to have fixed the problem! Thanks

~Shaun

-----Original Message-----
From: gisle.aas@gmail.com [mailto:gisle.aas@gmail.com] On Behalf Of Gisle
Aas
Sent: Monday, April 14, 2008 1:21 PM
To: Shaun
Cc: libwww@perl.org
Subject: Re: libwww-perl-5.810 (HTTP::Message content not bytes)

Can you try if the newly upload libwww-perl-5.811 fixes your problem.
It will not complain about Unicode strings unless they actually
contain chars that can't be treated as bytes.

--Gisle