{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/9828","labels_url":"https://api.github.com/repos/golang/go/issues/9828/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/9828/comments","events_url":"https://api.github.com/repos/golang/go/issues/9828/events","html_url":"https://github.com/golang/go/issues/9828","id":57191201,"number":9828,"title":"crypto/x509: matchHostnames doesn't work with absolute domain names","user":{"login":"rubyist","id":143,"avatar_url":"https://avatars.githubusercontent.com/u/143?v=3","gravatar_id":"","url":"https://api.github.com/users/rubyist","html_url":"https://github.com/rubyist","followers_url":"https://api.github.com/users/rubyist/followers","following_url":"https://api.github.com/users/rubyist/following{/other_user}","gists_url":"https://api.github.com/users/rubyist/gists{/gist_id}","starred_url":"https://api.github.com/users/rubyist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubyist/subscriptions","organizations_url":"https://api.github.com/users/rubyist/orgs","repos_url":"https://api.github.com/users/rubyist/repos","events_url":"https://api.github.com/users/rubyist/events{/privacy}","received_events_url":"https://api.github.com/users/rubyist/received_events","type":"User","site_admin":true},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-10T15:41:18Z","updated_at":"2015-02-10T15:41:18Z","closed_at":null,"body":"If an absolute domain name (i.e. ends in a '.' like \"example.com.\") is used with ssl/tls, the certificate will be reported as invalid. In `matchHostnames`, the host and patterns are split on '.' and if the lengths of the resulting slices do not match, the function returns false. When splitting an absolute domain name on '.', the slice will have an extra empty string at the end. This empty string should be discarded before comparison, if present.\r\n\r\n```\r\n$ go env\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOCHAR=\"6\"\r\nGOEXE=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"darwin\"\r\nGOOS=\"darwin\"\r\nGOPATH=\"/Users/scott/src/gocode\"\r\nGORACE=\"\"\r\nGOROOT=\"/Users/scott/go1.4.1/go\"\r\nGOTOOLDIR=\"/Users/scott/go1.4.1/go/pkg/tool/darwin_amd64\"\r\nCC=\"clang\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common\"\r\nCXX=\"clang++\"\r\nCGO_ENABLED=\"1\"\r\n```\r\n\r\nExample code:\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"log\"\r\n\t\"net/http\"\r\n)\r\n\r\nfunc main() {\r\n\t_, err := http.Get(\"https://api.github.com./users/rubyist\")\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n}\r\n```\r\n\r\nOutput:\r\n```\r\n2015/02/10 10:35:20 Get https://api.github.com./users/rubyist: x509: certificate is valid for *.github.com, github.com, not api.github.com.\r\nexit status 1\r\n```"}}