{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/comments/126687536","pull_request_review_id":49194200,"id":126687536,"diff_hunk":"@@ -168,6 +171,20 @@ extension _EasyHandle {\n         let protocols = (CFURLSessionProtocolHTTP | CFURLSessionProtocolHTTPS)\n         try! CFURLSession_easy_setopt_long(rawHandle, CFURLSessionOptionPROTOCOLS, protocols).asError()\n         try! CFURLSession_easy_setopt_long(rawHandle, CFURLSessionOptionREDIR_PROTOCOLS, protocols).asError()\n+        #if os(Android)\n+            // See https://curl.haxx.se/docs/sslcerts.html\n+            // For SSL to work you need \"cacert.pem\" to be accessable\n+            // at the path pointed to by the URLSessionCAInfo env var.","path":"Foundation/NSURLSession/http/EasyHandle.swift","position":17,"original_position":17,"commit_id":"589035387d49eea3624fe364737589499d7b8184","original_commit_id":"589035387d49eea3624fe364737589499d7b8184","user":{"login":"johnno1962","id":1786033,"avatar_url":"https://avatars0.githubusercontent.com/u/1786033?v=3","gravatar_id":"","url":"https://api.github.com/users/johnno1962","html_url":"https://github.com/johnno1962","followers_url":"https://api.github.com/users/johnno1962/followers","following_url":"https://api.github.com/users/johnno1962/following{/other_user}","gists_url":"https://api.github.com/users/johnno1962/gists{/gist_id}","starred_url":"https://api.github.com/users/johnno1962/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnno1962/subscriptions","organizations_url":"https://api.github.com/users/johnno1962/orgs","repos_url":"https://api.github.com/users/johnno1962/repos","events_url":"https://api.github.com/users/johnno1962/events{/privacy}","received_events_url":"https://api.github.com/users/johnno1962/received_events","type":"User","site_admin":false},"body":"OK, a version with no more dummy values left over from being an env var..\r\n```swift\r\n#if os(Android)\r\nextension URLSession {\r\n    /// See https://curl.haxx.se/docs/sslcerts.html\r\n    /// For SSL to work you need a \"cacert.pem\" to be accessible at the\r\n    /// path set by URLSession.setCertificateAuthorityInfo(filePath: path)\r\n    /// or by setting URLSession.sslCertificateAuthorityFile to a file URL.\r\n    /// Downloadable here: https://curl.haxx.se/docs/caextract.html\r\n    fileprivate static var _sslCertificateAuthorityFile: UnsafeMutablePointer<Int8>?\r\n    public static var bypassSSLPeerVerify = false\r\n    public static var sslCertificateAuthorityFile: URL {\r\n        set(value) {\r\n            guard value.isFileURL && FileManager.default.fileExists(atPath: value.path) else {\r\n                NSLog(\"*** sslCertificateAuthorityFile not FileURL or does not exist ***\")\r\n                return\r\n            }\r\n            bypassSSLPeerVerify = false\r\n            value.path.withCString {\r\n                free(_sslCertificateAuthorityFile)\r\n                _sslCertificateAuthorityFile = strdup($0)\r\n            }\r\n        }\r\n        get {\r\n            return URL(fileURLWithPath: String(cString: _sslCertificateAuthorityFile!))\r\n        }\r\n    }\r\n}\r\n#endif\r\n```","created_at":"2017-07-11T13:28:14Z","updated_at":"2017-07-11T13:28:14Z","html_url":"https://github.com/apple/swift-corelibs-foundation/pull/1103#discussion_r126687536","pull_request_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1103","_links":{"self":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/comments/126687536"},"html":{"href":"https://github.com/apple/swift-corelibs-foundation/pull/1103#discussion_r126687536"},"pull_request":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1103"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1103","id":129572715,"html_url":"https://github.com/apple/swift-corelibs-foundation/pull/1103","diff_url":"https://github.com/apple/swift-corelibs-foundation/pull/1103.diff","patch_url":"https://github.com/apple/swift-corelibs-foundation/pull/1103.patch","issue_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1103","number":1103,"state":"closed","locked":false,"title":"For https: to work on Android","user":{"login":"johnno1962","id":1786033,"avatar_url":"https://avatars0.githubusercontent.com/u/1786033?v=3","gravatar_id":"","url":"https://api.github.com/users/johnno1962","html_url":"https://github.com/johnno1962","followers_url":"https://api.github.com/users/johnno1962/followers","following_url":"https://api.github.com/users/johnno1962/following{/other_user}","gists_url":"https://api.github.com/users/johnno1962/gists{/gist_id}","starred_url":"https://api.github.com/users/johnno1962/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnno1962/subscriptions","organizations_url":"https://api.github.com/users/johnno1962/orgs","repos_url":"https://api.github.com/users/johnno1962/repos","events_url":"https://api.github.com/users/johnno1962/events{/privacy}","received_events_url":"https://api.github.com/users/johnno1962/received_events","type":"User","site_admin":false},"body":"Hi, just wondering whether you would consider merging this change to allow https: fetches using NSURLSession to work on Android. It turns out there is a root certificate authorities file required by libcurl for SSL to work.\r\n\r\nThis PR gives the user the opportunity to provide one and specify it’s location in the environment variable “URLSessionCAInfo” for it to be configured correctly. As providing an absolute path to anything is spectacularly difficult in Android or if the user’s servers are self-signed it also gives the user the option to specify the value “UNSAFE_SSL_NOVERIFY” and SSL hostname verification will not be performed at all.\r\n\r\nThe advantage of an environment variable over increasing the API surface is that the value can come all the way from the Java side of the application where it is most likely to know the path.\r\n\r\nHow does this sound?","created_at":"2017-07-09T18:10:18Z","updated_at":"2017-07-11T13:28:14Z","closed_at":"2017-07-10T22:32:08Z","merged_at":"2017-07-10T22:32:08Z","merge_commit_sha":"31d1d41896a62a3b7dd107bfc82154d31231d094","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1103/commits","review_comments_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1103/comments","review_comment_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1103/comments","statuses_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/statuses/589035387d49eea3624fe364737589499d7b8184","head":{"label":"johnno1962b:master","ref":"master","sha":"589035387d49eea3624fe364737589499d7b8184","user":{"login":"johnno1962b","id":17994687,"avatar_url":"https://avatars3.githubusercontent.com/u/17994687?v=3","gravatar_id":"","url":"https://api.github.com/users/johnno1962b","html_url":"https://github.com/johnno1962b","followers_url":"https://api.github.com/users/johnno1962b/followers","following_url":"https://api.github.com/users/johnno1962b/following{/other_user}","gists_url":"https://api.github.com/users/johnno1962b/gists{/gist_id}","starred_url":"https://api.github.com/users/johnno1962b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnno1962b/subscriptions","organizations_url":"https://api.github.com/users/johnno1962b/orgs","repos_url":"https://api.github.com/users/johnno1962b/repos","events_url":"https://api.github.com/users/johnno1962b/events{/privacy}","received_events_url":"https://api.github.com/users/johnno1962b/received_events","type":"Organization","site_admin":false},"repo":{"id":96701254,"name":"swift-corelibs-foundation","full_name":"johnno1962b/swift-corelibs-foundation","owner":{"login":"johnno1962b","id":17994687,"avatar_url":"https://avatars3.githubusercontent.com/u/17994687?v=3","gravatar_id":"","url":"https://api.github.com/users/johnno1962b","html_url":"https://github.com/johnno1962b","followers_url":"https://api.github.com/users/johnno1962b/followers","following_url":"https://api.github.com/users/johnno1962b/following{/other_user}","gists_url":"https://api.github.com/users/johnno1962b/gists{/gist_id}","starred_url":"https://api.github.com/users/johnno1962b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnno1962b/subscriptions","organizations_url":"https://api.github.com/users/johnno1962b/orgs","repos_url":"https://api.github.com/users/johnno1962b/repos","events_url":"https://api.github.com/users/johnno1962b/events{/privacy}","received_events_url":"https://api.github.com/users/johnno1962b/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/johnno1962b/swift-corelibs-foundation","description":"The Foundation Project, providing core utilities, internationalization, and OS independence","fork":true,"url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation","forks_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/forks","keys_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/teams","hooks_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/hooks","issue_events_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/issues/events{/number}","events_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/events","assignees_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/assignees{/user}","branches_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/branches{/branch}","tags_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/tags","blobs_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/git/refs{/sha}","trees_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/statuses/{sha}","languages_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/languages","stargazers_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/stargazers","contributors_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/contributors","subscribers_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/subscribers","subscription_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/subscription","commits_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/commits{/sha}","git_commits_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/git/commits{/sha}","comments_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/comments{/number}","issue_comment_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/issues/comments{/number}","contents_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/contents/{+path}","compare_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/merges","archive_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/downloads","issues_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/issues{/number}","pulls_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/pulls{/number}","milestones_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/milestones{/number}","notifications_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/labels{/name}","releases_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/releases{/id}","deployments_url":"https://api.github.com/repos/johnno1962b/swift-corelibs-foundation/deployments","created_at":"2017-07-09T17:52:53Z","updated_at":"2017-07-09T17:52:59Z","pushed_at":"2017-07-10T23:05:16Z","git_url":"git://github.com/johnno1962b/swift-corelibs-foundation.git","ssh_url":"git@github.com:johnno1962b/swift-corelibs-foundation.git","clone_url":"https://github.com/johnno1962b/swift-corelibs-foundation.git","svn_url":"https://github.com/johnno1962b/swift-corelibs-foundation","homepage":"swift.org","size":10508,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:master","ref":"master","sha":"1b05ee593296f24b6b7c7801c8690fe86f0c6946","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars3.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":45863890,"name":"swift-corelibs-foundation","full_name":"apple/swift-corelibs-foundation","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars3.githubusercontent.com/u/10639145?v=3","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift-corelibs-foundation","description":"The Foundation Project, providing core utilities, internationalization, and OS independence","fork":false,"url":"https://api.github.com/repos/apple/swift-corelibs-foundation","forks_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/forks","keys_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/teams","hooks_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/hooks","issue_events_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/events","assignees_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/tags","blobs_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/languages","stargazers_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/stargazers","contributors_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/contributors","subscribers_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/subscribers","subscription_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/subscription","commits_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/merges","archive_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/downloads","issues_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/deployments","created_at":"2015-11-09T20:12:23Z","updated_at":"2017-07-11T03:42:49Z","pushed_at":"2017-07-11T13:12:02Z","git_url":"git://github.com/apple/swift-corelibs-foundation.git","ssh_url":"git@github.com:apple/swift-corelibs-foundation.git","clone_url":"https://github.com/apple/swift-corelibs-foundation.git","svn_url":"https://github.com/apple/swift-corelibs-foundation","homepage":"swift.org","size":10508,"stargazers_count":2520,"watchers_count":2520,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":576,"mirror_url":null,"open_issues_count":39,"forks":576,"open_issues":39,"watchers":2520,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1103"},"html":{"href":"https://github.com/apple/swift-corelibs-foundation/pull/1103"},"issue":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1103"},"comments":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1103/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1103/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1103/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/statuses/589035387d49eea3624fe364737589499d7b8184"}}}}
{"actor":{"display_login":"johnno1962"}}