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

Ensure Request::withUri preserves host correctly #2126

Merged
merged 3 commits into from
Mar 7, 2017
Merged

Ensure Request::withUri preserves host correctly #2126

merged 3 commits into from
Mar 7, 2017

Conversation

akrabat
Copy link
Member

@akrabat akrabat commented Jan 17, 2017

The rules for dealing with the Host header in withUri() when $preserveHost is true state this:

If the the Host header is missing or empty, and the new URI contains
a host component, this method MUST update the Host header in the returned
request.

This now works - it didn't before as we didn't have a test for it…

The rules for dealing with the Host header when $preserveHost is true
state this:

> If the the Host header is missing or empty, and the new URI contains
> a host component, this method MUST update the Host header in the returned
> request.

This now works.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 98.111% when pulling fd2768a on akrabat:fix-with-uri-preserve-host into fb5356a on slimphp:3.x.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 98.111% when pulling fd2768a on akrabat:fix-with-uri-preserve-host into fb5356a on slimphp:3.x.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 98.111% when pulling fd2768a on akrabat:fix-with-uri-preserve-host into fb5356a on slimphp:3.x.

We must change the Host header, not the host in the Uri.
We must check the new Uri’s host, and the current Request’s Host Header,
Not the current Request’s Uri’s host.
@akrabat
Copy link
Member Author

akrabat commented Jan 19, 2017

Discovered that my unit test for $preserveHost was wrong as it didn't allow for the case of the Request's Host header being different from the Uri's host property.

Fixed test and hence fixed withRequest().

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 98.111% when pulling a6c2803 on akrabat:fix-with-uri-preserve-host into fb5356a on slimphp:3.x.

@codeguy
Copy link
Member

codeguy commented Mar 7, 2017

@akrabat Is this just for 3.x?

@akrabat
Copy link
Member Author

akrabat commented Mar 7, 2017

@akrabat Is this just for 3.x?

Better forward port to 4.x too as I need to resync for slim\http

Copy link
Member

@codeguy codeguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Merging into 3.x and 4.x

@codeguy codeguy merged commit a6c2803 into slimphp:3.x Mar 7, 2017
@akrabat akrabat added this to the 3.8.0 milestone Mar 7, 2017
@codeguy codeguy modified the milestones: 3.8.0, 4.0 Mar 7, 2017
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