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

Test error with LWP::UserAgent v 6.64 #27

Closed
chylli-deriv opened this issue May 1, 2022 · 4 comments
Closed

Test error with LWP::UserAgent v 6.64 #27

chylli-deriv opened this issue May 1, 2022 · 4 comments

Comments

@chylli-deriv
Copy link

chylli-deriv commented May 1, 2022

reproduce:

mkdir tmp
cd tmp
cpanm --reinstall -l local -n LWP::UserAgent@6.64
cpanm --reinstall -l local WWW::Mechanize::Cached

Test result:

t/006-cached-chi.t ........... ok
Can't store CODE items at /usr/lib/perl5/5.34/core_perl/Storable.pm line 370, at /home/chylli/.cpanm/work/1651414937.988007/WWW-Mechanize-Cached-1.55/blib/lib/WWW/Mechanize/Cached.pm line 130.

#   Failed test 'no exceptions'                                                                
#   at t/default.t line 16.                                                                    
#          got: 'Can't store CODE items at /usr/lib/perl5/5.34/core_perl/Storable.pm line 370, at /home/chylli/.cpanm/work/1651414937.988007/WWW-Mechanize-Cached-1.55/blib/lib/WWW/Mechanize/Cached.pm line 130.                                                                            
# '
#     expected: undef       
# Looks like you failed 1 test of 1.
@chylli-deriv
Copy link
Author

Started from LWP::UserAgent v6.63

@oalders
Copy link
Member

oalders commented May 1, 2022

Thanks @chylli-binary! This starts with the change to LWP::UserAgent where meta-refresh tags are now followed when max_redirect > 0. In the failing tests, the error goes away when we set max_redirect => 0 when creating the mech object. However, if we then revert the change to allow redirects, the tests begin passing again, so it looks like this is happening with that specific version of LWP::UserAgent when the cache has not yet been created.

First off, I think we need to be better about ensuring that the tests always use a cache in a random namespece and then we can look into what's causing this to happen. Normally redirects aren't being cached, but if the meta-refresh is coming from a page with a 2xx response code, then this module will assume it's ok to cache it.

@vanHoesel
Copy link
Member

HTTP::Status provides a test is_cacheable_by_default, I propose to use that instead of assuming a 2xx response is OK to cache... it is not!

@oalders
Copy link
Member

oalders commented May 19, 2022

This should now be fixed if you upgrade to the latest version of LWP::UserAgent. Thanks for reporting @chylli-binary!

@oalders oalders closed this as completed May 19, 2022
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

3 participants