Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Seems the latest 'update' to libwww-perl broke things that used to work with POE::Component::Client::HTTP.

After the upgrade my script dies on certain requests but always in the same spot and giving the same error:
HTTP::Message content must be bytes at /home/overlordq/lib/POE/Component/Client/HTTP/ line 187
The relevant lines in PoCo::Client::HTTP are:
eval { $content = $response->decoded_content }; if ($content) { $response->content($content); }

Digging through HTTP::Message, this has to do with utf8 stuff in the content, and the relevant lines in there are:
In the content subroutine is a call to _set_content, and in _set_content is a call to _utf8_downgrade:
*_utf8_downgrade = defined(&utf8::downgrade) ? sub { utf8::downgrade($_[0], 1) or Carp::croak("HTTP::Message content must be bytes") } : sub { };
Looking through the libwww changelog I noticed: "Don't allow HTTP::Message content to be set to Unicode strings."

Any suggestions on what's a man to do? And which module has the wrong behavior so I know where to report it? FWIW, here's the headers being sent back from the server that causes the error and possibly a related cpan bug:
HTTP/1.x 200 OK Date: Thu, 01 May 2008 02:30:39 GMT Server: Apache X-Powered-By: PHP/5.2.5 Cache-Control: private, s-maxage=0, max-age=0, must-revalidate Content-Language: en Vary: Accept-Encoding,Cookie Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Encoding: gzip Content-Length: 12241 Content-Type: text/html; charset=utf-8 Connection: keep-alive

In reply to libwww-perl, POE and Unicode by OverlordQ

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (8)
    As of 2020-05-29 08:35 GMT
    Find Nodes?
      Voting Booth?
      If programming languages were movie genres, Perl would be:

      Results (168 votes). Check out past polls.