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

Prevent panic when calling `url::Url::set_host` with `None`. #244

Merged
merged 1 commit into from Dec 17, 2016

Conversation

@frewsxcv
Copy link
Member

frewsxcv commented Dec 2, 2016

Fixes #243.


This change is Reviewable

@frewsxcv
Copy link
Member Author

frewsxcv commented Dec 2, 2016

@valenting
Copy link
Collaborator

valenting commented Dec 2, 2016

Note this line from the URL spec:

If url is special and buffer is the empty string, return failure.

So both set_host(None) and set_host("") should probably fail if SchemeType::from(self.scheme()).is_special()

So while the test should not crash, the result should not be https:/hello
The same test would be correct though, if the protocol were not special.

@frewsxcv
Copy link
Member Author

frewsxcv commented Dec 4, 2016

@SimonSapin Do you remember why there is logic here for the 'cannot-be-a-base-URL' flag? At least for the link that @valenting sent, it doesn't look like that logic needs to be here.

@Manishearth Manishearth force-pushed the sethostnone branch from f82eb26 to b0d6060 Dec 17, 2016
@Manishearth Manishearth force-pushed the sethostnone branch from b0d6060 to 2c9e076 Dec 17, 2016
@SimonSapin
Copy link
Member

SimonSapin commented Dec 17, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 17, 2016

📌 Commit 2c9e076 has been approved by SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented Dec 17, 2016

Testing commit 2c9e076 with merge ae7204f...

bors-servo added a commit that referenced this pull request Dec 17, 2016
Prevent panic when calling `url::Url::set_host` with `None`.

Fixes #243.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/244)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 17, 2016

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit 2c9e076 into master Dec 17, 2016
4 of 6 checks passed
4 of 6 checks passed
continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
dependency-ci Dependencies checked
Details
homu Test successful
Details
@SimonSapin SimonSapin deleted the sethostnone branch Dec 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.