Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Fix #905 #1281

Merged
merged 2 commits into from
Apr 26, 2016
Merged

Fix #905 #1281

merged 2 commits into from
Apr 26, 2016

Conversation

slozier
Copy link
Contributor

@slozier slozier commented Mar 11, 2016

Update socket.getfqdn to properly handle empty string and 0.0.0.0

@@ -1297,6 +1297,10 @@ public int ioctl(BigInteger cmd, object option)
)]
public static string getfqdn(string host) {
host = host.Trim();
Copy link
Contributor

Choose a reason for hiding this comment

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

As an additional hint, you maybe could assert host for null and give a specific error message. Else it will crash on .Trim() with a very unlucky NullReferenceException.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just going by what cpython does (fails by calling .strip on None), but I guess there's no reason we can't throw a TypeError instead.

@slide
Copy link
Contributor

slide commented Apr 26, 2016

Does this follow the CPython way?

@slozier
Copy link
Contributor Author

slozier commented Apr 26, 2016

CPython deals with the name argument in the exact same way (see Lib\socket.py):

    name = name.strip()
    if not name or name == '0.0.0.0':
        name = gethostname()

@slide slide merged commit 2b528dc into IronLanguages:ipy-2.7-maint Apr 26, 2016
@slozier slozier deleted the fix_905 branch June 27, 2016 17:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants