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

Follow relative locations correctly. Fixes #228 #230

Merged
merged 4 commits into from May 21, 2018

Conversation

Projects
None yet
2 participants
@ioquatix
Contributor

ioquatix commented Apr 6, 2018

No description provided.

@perlun

This comment has been minimized.

Contributor

perlun commented Apr 9, 2018

Thanks @ioquatix! I looked at your implementation, it looks good.

Please fix the minor issues reported by Travis also: https://travis-ci.org/rack-test/rack-test/jobs/363348025 and I'll approve this change
(for the file length cop you can auto-regenerate the .rubocop_todo.yml file, rubocop --auto-gen)

@ioquatix

This comment has been minimized.

Contributor

ioquatix commented Apr 9, 2018

I don't know why but Travis didn't seem to re-run the tests. However I think I fixed all (most?) of the issues.

@ioquatix

This comment has been minimized.

Contributor

ioquatix commented Apr 17, 2018

@perlun Are we good to go with this?

# Compute the next location by appending the location header with the
# last request, as per https://tools.ietf.org/html/rfc7231#section-7.1.2
next_location = URI.parse(last_request.url) + URI.parse(last_response['Location'])

This comment has been minimized.

@perlun

perlun Apr 19, 2018

Contributor

I thought about this a bit more: does this work if Location is an absolute URL? It feels like it wouldn't. So please add a test case for that, and if it works => fine, but if not I think we'll need to adjust the implementation a bit.

This comment has been minimized.

@ioquatix

ioquatix Apr 19, 2018

Contributor

When you add two absolute locations the RHS is returned. That's the behaviour of URI RFC.

This comment has been minimized.

@ioquatix

ioquatix Apr 19, 2018

Contributor
2.5.0 :001 > require 'uri'
 => false 
2.5.0 :002 > URI.parse("http://www.google.com") + URI.parse("http://www.yahoo.com")
 => #<URI::HTTP http://www.yahoo.com> 
2.5.0 :003 > 

This comment has been minimized.

@perlun

perlun Apr 28, 2018

Contributor

OK, sounds great! Would you mind adding a test that documents these semantics? You could even write a comment saying that '# Adding two absolute locations returns the right-hand location or something to the like.

This comment has been minimized.

@perlun

perlun May 2, 2018

Contributor

Ping @ioquatix

@perlun

This comment has been minimized.

Contributor

perlun commented Apr 19, 2018

@ioquatix Thanks for the update. I realized there might be some more issues with this - noted above.

@ioquatix

This comment has been minimized.

Contributor

ioquatix commented May 2, 2018

Okay done.

Per Lundberg
@ioquatix

This comment has been minimized.

Contributor

ioquatix commented May 21, 2018

Can we merge this?

Per Lundberg
@perlun

This comment has been minimized.

Contributor

perlun commented May 21, 2018

@ioquatix

Can we merge this?

There was still a Travis issue, I've fixed that now and Travis is green again. Merging - thanks for your contributions! 👍

@perlun

perlun approved these changes May 21, 2018

@perlun perlun merged commit 88559dc into rack-test:master May 21, 2018

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment