Skip to content

Handle 304 status for remote config files - #4485

Merged
bbatsov merged 1 commit into
rubocop:masterfrom
daniloisr:fix-remote-not-modified-reponses
Jun 10, 2017
Merged

bbatsov merged 1 commit into
rubocop:masterfrom
daniloisr:fix-remote-not-modified-reponses

Conversation

@daniloisr

Copy link
Copy Markdown
Contributor

Hi all, when using remote config I was facing the following error:

bad URI(is not URI?):

On lines lib/rubocop/remote_config.rb:48-49:

when Net::HTTPRedirection
  request(URI.parse(response['location']), limit - 1, &block)

This happens for 304 HTTPNotModified responses, which don't have the 'location' key.
(and to help reviewers, 304 responses occurs due this header)

So my solution is to just handle this response and reuses the existing cached file.

@bbatsov

bbatsov commented Jun 10, 2017

Copy link
Copy Markdown
Collaborator

The fix looks good, but it should be listed in the changelog.

@daniloisr
daniloisr force-pushed the fix-remote-not-modified-reponses branch from bcd2ff7 to eb75fa0 Compare June 10, 2017 09:53
@daniloisr

Copy link
Copy Markdown
Contributor Author

@bbatsov done

@mikegee

mikegee commented Jun 10, 2017

Copy link
Copy Markdown
Contributor

@daniloisr add yourself to the bottom of the changelog too to get the build to pass.

When remote file response is NotModified, we can reuse the existing
cached file.
@daniloisr
daniloisr force-pushed the fix-remote-not-modified-reponses branch from eb75fa0 to de20b1e Compare June 10, 2017 14:28
@bbatsov
bbatsov merged commit 4a81790 into rubocop:master Jun 10, 2017
@bbatsov

bbatsov commented Jun 10, 2017

Copy link
Copy Markdown
Collaborator

👍

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

Successfully merging this pull request may close these issues.

3 participants