[ 
https://issues.apache.org/jira/browse/THRIFT-5532?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Finn Isaac Norris Colman updated THRIFT-5532:
---------------------------------------------
    Description: 
When using the Perl library with the Thrift/HttpClient.pm the following error 
occurs:
'Can\'t call method "clone" on unblessed reference at 
/usr/share/perl5/HTTP/Message.pm line 40, <GEN2> line 1.
'

This is happening because of these lines of code in Thrift/HttpClient.pm:

[https://github.com/apache/thrift/blob/79f89e0cec046ae7e6ed4a31ccfadd907be8baed/lib/perl/lib/Thrift/HttpClient.pm#L189-L190]

The HTTP::Request package expects the headers to either be an {{HTTP::Headers}} 
object or a plain array reference of key/value pairs.

But here we are instead passing a hash reference which is incorrect.

This bug was introduced back in 2018 with this refactoring PR:

https://github.com/apache/thrift/commit/8a130f63e5bd09e5c39f9760ba04b5ea0837ff4c#diff-c1101ee9588204db1c3ab744b4f50c932bf86c3ad4bef129b6a0a8a1e222bb98L187-L188

In the process the correct setting of the headers was lost.

  was:
When using the Perl library with the Thrift/HttpClient.pm the following error 
occurs:
'Can\'t call method "clone" on unblessed reference at 
/usr/share/perl5/HTTP/Message.pm line 40, <GEN2> line 1.
'

This is happening because of these lines of code in Thrift/HttpClient.pm:

[https://github.com/apache/thrift/blob/79f89e0cec046ae7e6ed4a31ccfadd907be8baed/lib/perl/lib/Thrift/HttpClient.pm#L189-L190]

The HTTP::Request package expects the headers to either be an {{HTTP::Headers}} 
object or a plain array reference of key/value pairs.

But here we are instead passing a hash reference which is incorrect.

This bug was introduced back in 2018 with this refactoring PR:

[https://github.com/apache/thrift/commit/8a130f63e5bd09e5c39f9760ba04b5ea0837ff4c]

In the process the correct setting of the headers was lost.


> Perl Thrift/HttpClient.pm headers bug
> -------------------------------------
>
>                 Key: THRIFT-5532
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5532
>             Project: Thrift
>          Issue Type: Bug
>          Components: Perl - Library
>    Affects Versions: 0.12.0, 0.13.0, 0.14.0, 0.15.0, 0.14.1, 0.14.2, 0.16.0
>            Reporter: Finn Isaac Norris Colman
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When using the Perl library with the Thrift/HttpClient.pm the following error 
> occurs:
> 'Can\'t call method "clone" on unblessed reference at 
> /usr/share/perl5/HTTP/Message.pm line 40, <GEN2> line 1.
> '
> This is happening because of these lines of code in Thrift/HttpClient.pm:
> [https://github.com/apache/thrift/blob/79f89e0cec046ae7e6ed4a31ccfadd907be8baed/lib/perl/lib/Thrift/HttpClient.pm#L189-L190]
> The HTTP::Request package expects the headers to either be an 
> {{HTTP::Headers}} object or a plain array reference of key/value pairs.
> But here we are instead passing a hash reference which is incorrect.
> This bug was introduced back in 2018 with this refactoring PR:
> https://github.com/apache/thrift/commit/8a130f63e5bd09e5c39f9760ba04b5ea0837ff4c#diff-c1101ee9588204db1c3ab744b4f50c932bf86c3ad4bef129b6a0a8a1e222bb98L187-L188
> In the process the correct setting of the headers was lost.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to