in reply to LWP UserAgent response header in decoded_content

Any thoughts on what may be causing the headers to be included in the content?

I think broken webserver

For example

use CGI(); my $q = CGI->new; print $q->header, $q->header, $q->Dump; __END__
This will show headers in the content ... but its just content in the content .. everything after header is content

I'm not ruling out some odd /old misbehaving combination of LWP modules ... make sure you have the latest LWP...

then fix your arudino server

For diagnostics you might try using the following program and showing us the output

use Data::Dump qw/ dd /; use WWW::Mechanize; my $ua = WWW::Mechanize->new; $ua->get( $server_endpoint ); dd( $ua ); __END__

Replies are listed 'Best First'.
Re^2: LWP UserAgent response header in decoded_content
by ikegami (Patriarch) on Mar 18, 2014 at 17:38 UTC
    It's easy to see what the server returns to confirm this is a server problem.
    perl -MIO::Socket::INET -e' my $s = IO::Socket::INET->new("192.168.0.198:80"); print $s "GET / HTTP/1.0\r\n"; print $s "Host: 192.168.0.198\r\n"; print $s "\r\n"; print while <$s>; '

    Note: I omitted Content-Type: application/json from the request since GET requests don't have a body (of any type).

Re^2: LWP UserAgent response header in decoded_content
by jeff_e (Initiate) on Mar 18, 2014 at 21:21 UTC

    I figured out the problem using the dd output. The server was sending null terminators from string literals. Removed those from the output of the server and LWP works as expected.

    Thanks for the suggestion and example.

    I figured it was something in the server output, but couldn't "see" anything wrong.