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
Contributor

@frewsxcv frewsxcv commented Dec 2, 2016

Fixes #243.


This change is Reviewable

@frewsxcv
Copy link
Contributor Author

frewsxcv commented Dec 2, 2016

r? @SimonSapin

@valenting
Copy link
Collaborator

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
Contributor 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.

@SimonSapin
Copy link
Member

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 2c9e076 has been approved by SimonSapin

@bors-servo
Copy link
Contributor

⌛ Testing commit 2c9e076 with merge ae7204f...

bors-servo pushed 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

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit 2c9e076 into master Dec 17, 2016
@SimonSapin SimonSapin deleted the sethostnone branch December 17, 2016 05:21
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.

4 participants