lib/spaceship/client.rb in spaceship-0.27.0 vs lib/spaceship/client.rb in spaceship-0.27.1

- old
+ new

@@ -300,19 +300,21 @@ raise InvalidUserCredentialsError.new, "Invalid username and password combination. Used '#{user}' as the username." elsif (response['Set-Cookie'] || "").include?("itctx") raise "Looks like your Apple ID is not enabled for iTunes Connect, make sure to be able to login online" else info = [response.body, response['Set-Cookie']] - raise ITunesConnectError.new, info.join("\n") + raise TunesClient::ITunesConnectError.new, info.join("\n") end end end def itc_service_key return @service_key if @service_key - # Some clients have had trouble with GZip encoding, so we'll request the server to return unmodified plain-text - headers = ENV['SPACESHIP_LOGIN_ENCODING_IDENTITY'] ? {'Accept-Encoding' => 'identity'} : {} - logger.debug("itc_service_key headers: #{headers}") + # Some customers in Asia have had trouble with the CDNs there that cache and serve this content, leading + # to "buffer error (Zlib::BufError)" from deep in the Ruby HTTP stack. Setting this header requests that + # the content be served only as plain-text, which seems to work around their problem, while not affecting + # other clients. + headers = {'Accept-Encoding' => 'identity'} # We need a service key from a JS file to properly auth js = request(:get, "https://itunesconnect.apple.com/itc/static-resources/controllers/login_cntrl.js", nil, headers) @service_key ||= js.body.match(/itcServiceKey = '(.*)'/)[1] end