jnbt / candy_check

Check and verify in-app receipts
MIT License
125 stars 70 forks source link

Incompatible with Ruby 2.4.4/2.5.1 #26

Closed sajmoon closed 6 years ago

sajmoon commented 6 years ago

Ruby 2.4.4 includes https://bugs.ruby-lang.org/issues/14208 that "raise error if value contains CR/LF in iniheader of initialize_http_header".

So during initialisation of the application during boot! it crashed from what i think is a request to the google api.

The issue is easy to reproduce. Running the specs of this gem with ruby 2.4.4. Or running the specs with ruby 2.5.1

Example output from the specs:

6) Error:
CandyCheck::PlayStore::Client::discovery::w/o cache file#test_0001_boot loads and dumps discovery file:
ArgumentError: header field value cannot include CR/LF
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/2.5.0/net/http/header.rb:23:in `block in initialize_http_header'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/2.5.0/net/http/header.rb:16:in `each'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/2.5.0/net/http/header.rb:16:in `initialize_http_header'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/2.5.0/net/http/generic_request.rb:44:in `initialize'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/faraday-0.15.1/lib/faraday/adapter/net_http.rb:67:in `new'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/faraday-0.15.1/lib/faraday/adapter/net_http.rb:67:in `create_request'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/faraday-0.15.1/lib/faraday/adapter/net_http.rb:87:in `perform_request'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/faraday-0.15.1/lib/faraday/adapter/net_http.rb:43:in `block in call'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/faraday-0.15.1/lib/faraday/adapter/net_http.rb:92:in `with_net_http_connection'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/faraday-0.15.1/lib/faraday/adapter/net_http.rb:38:in `call'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/faraday-0.15.1/lib/faraday/response.rb:8:in `call'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/google-api-client-0.8.7/lib/google/api_client/request.rb:163:in `send'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:648:in `block (2 levels) in execute!'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/retriable-1.4.1/lib/retriable/retry.rb:27:in `perform'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/retriable-1.4.1/lib/retriable.rb:15:in `retriable'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:645:in `block in execute!'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/retriable-1.4.1/lib/retriable/retry.rb:27:in `perform'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/retriable-1.4.1/lib/retriable.rb:15:in `retriable'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:636:in `execute!'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:368:in `discovery_document'
    /Users/simon/.asdf/installs/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:413:in `discovered_api'
    /Users/simon/Code/candy_check/lib/candy_check/play_store/client.rb:96:in `request_discover'
    /Users/simon/Code/candy_check/lib/candy_check/play_store/client.rb:90:in `discover!'
    /Users/simon/Code/candy_check/lib/candy_check/play_store/client.rb:40:in `boot!'
    /Users/simon/Code/candy_check/spec/play_store/client_spec.rb:27:in `block (4 levels) in <top (required)>'

127 runs, 207 assertions, 2 failures, 4 errors, 0 skips
leogiertz commented 6 years ago

@jnbt Would be fantastic if you could take a look at this. 🎈

klaseskilson commented 6 years ago

Hey @sajmoon and @leogiertz ! Thanks for bringing this up. I currently don't have time to take a look at this, and I believe the same goes for @jnbt. Do you think you would have time to help us and prepare a PR or investigate further on how this would be solved? I'd be happy to help, but I'm pretty limited on time. Thanks!

jnbt commented 6 years ago

@sajmoon @leogiertz @klaseskilson I've started a small PR on this matter #27 In case the tests are green on Travis, I'll merge and publish a bugfix release.

sajmoon commented 6 years ago

This is awesome! Thank you.

I will try to test the branch today.

sajmoon commented 6 years ago

@jnbt We have verified this for us. For our use case and environment the fix works!

jnbt commented 6 years ago

27 released as 0.1.2

/cc @sajmoon @leogiertz @klaseskilson

sajmoon commented 6 years ago

👍 awesome @jnbt