Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompression not working with callback in request #15

Open
fra-iesus opened this issue Aug 15, 2018 · 1 comment
Open

Decompression not working with callback in request #15

fra-iesus opened this issue Aug 15, 2018 · 1 comment

Comments

@fra-iesus
Copy link

fra-iesus commented Aug 15, 2018

#!/usr/bin/env perl
use 5.014;
use RPC::XML;
use RPC::XML::Client;

my $url = 'https://wordpress.com/xmlrpc.php';
my $client = RPC::XML::Client->new($url);
$client->request->accept_decodable;
print '"Accept-Encoding" set to ' . $client->request->header('Accept-Encoding') . "\n";
my $request = RPC::XML::request->new('wp.getPostTypes');
my $response = $client->send_request($request);
print "$response\n";

"Accept-Encoding" set to gzip, x-gzip, deflate, x-bzip2

not well-formed (invalid token) at line 1, column 0, byte 0:
?PMk1??+???ق??x
^
?
at /usr/share/perl5/RPC/XML/Client.pm line 402.

Everything works correctly in case request is fired w/o callback and response data are processed afterwards.

@fra-iesus
Copy link
Author

There are 2 issues with that:

  1. compression is not detected, so $data_in doesn't go to inflate(), but directly to parse_more()
  2. in case detection of compression is changed from $resp->content_encoding to $resp->{_headers}->{content-encoding} (I know - internal variable, I don't mind it for test), result of inflate() is empty string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant