{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/comments/139119358","pull_request_review_id":63005807,"id":139119358,"diff_hunk":"@@ -0,0 +1,148 @@\n+// This source file is part of the Swift.org open source project\n+//\n+// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors\n+// Licensed under Apache License v2.0 with Runtime Library Exception\n+//\n+// See http://swift.org/LICENSE.txt for license information\n+// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors\n+//\n+\n+import CoreFoundation\n+import Dispatch\n+\n+internal class _FTPURLProtocol: _NativeProtocol {\n+    \n+    public required init(task: URLSessionTask, cachedResponse: CachedURLResponse?, client: URLProtocolClient?) {\n+        super.init(task: task, cachedResponse: cachedResponse, client: client)\n+    }\n+    \n+    public required init(request: URLRequest, cachedResponse: CachedURLResponse?, client: URLProtocolClient?) {\n+        super.init(request: request, cachedResponse: cachedResponse, client: client)\n+    }\n+    \n+    override class func canInit(with request: URLRequest) -> Bool {\n+        guard request.url?.scheme == \"ftp\" || request.url?.scheme == \"ftps\" || request.url?.scheme == \"sftp\" else { return false }\n+        return true\n+    }\n+    \n+    override class func canonicalRequest(for request: URLRequest) -> URLRequest {\n+        return request\n+    }\n+    \n+    override func startLoading() {\n+        resume()\n+    }\n+    \n+    override func stopLoading() {\n+        if task?.state == .suspended {\n+            suspend()\n+        } else {\n+            self.internalState = .transferFailed\n+            guard let error = self.task?.error else { fatalError() }\n+            completeTask(withError: error)\n+        }\n+    }\n+    \n+    override  func didReceive(headerData data: Data, contentLength: Int64) -> _EasyHandle._Action {\n+        guard case .transferInProgress(let ts) = internalState else { fatalError(\"Received body data, but no transfer in progress.\") }\n+        guard let task = task else { fatalError(\"Received header data but no task available.\") }\n+        task.countOfBytesExpectedToReceive = contentLength > 0 ? contentLength : NSURLSessionTransferSizeUnknown\n+        do {\n+            let newTS = try ts.byAppendingFTP(headerLine: data, expectedContentLength: contentLength)\n+            internalState = .transferInProgress(newTS)\n+            let didCompleteHeader = !ts.isHeaderComplete && newTS.isHeaderComplete\n+            if didCompleteHeader {\n+                // The header is now complete, but wasn't before.\n+                didReceiveResponse()\n+            }\n+            return .proceed\n+        } catch {\n+            return .abort\n+        }\n+    }\n+    \n+    override func seekInputStream(to position: UInt64) throws {\n+        // NSUnimplemented()","path":"Foundation/URLSession/ftp/FTPURLProtocol.swift","position":65,"original_position":65,"commit_id":"43bcd816af9b9360558e057fd2b9c54d54d681e2","original_commit_id":"43bcd816af9b9360558e057fd2b9c54d54d681e2","user":{"login":"alblue","id":76791,"avatar_url":"https://avatars2.githubusercontent.com/u/76791?v=4","gravatar_id":"","url":"https://api.github.com/users/alblue","html_url":"https://github.com/alblue","followers_url":"https://api.github.com/users/alblue/followers","following_url":"https://api.github.com/users/alblue/following{/other_user}","gists_url":"https://api.github.com/users/alblue/gists{/gist_id}","starred_url":"https://api.github.com/users/alblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alblue/subscriptions","organizations_url":"https://api.github.com/users/alblue/orgs","repos_url":"https://api.github.com/users/alblue/repos","events_url":"https://api.github.com/users/alblue/events{/privacy}","received_events_url":"https://api.github.com/users/alblue/received_events","type":"User","site_admin":false},"body":"Why commented out?","created_at":"2017-09-15T10:52:55Z","updated_at":"2017-09-15T11:04:29Z","html_url":"https://github.com/apple/swift-corelibs-foundation/pull/1122#discussion_r139119358","pull_request_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1122","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/comments/139119358"},"html":{"href":"https://github.com/apple/swift-corelibs-foundation/pull/1122#discussion_r139119358"},"pull_request":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1122"}}},"pull_request":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1122","id":131535289,"html_url":"https://github.com/apple/swift-corelibs-foundation/pull/1122","diff_url":"https://github.com/apple/swift-corelibs-foundation/pull/1122.diff","patch_url":"https://github.com/apple/swift-corelibs-foundation/pull/1122.patch","issue_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1122","number":1122,"state":"open","locked":false,"title":"Initial implementation of FTP","user":{"login":"saiHemak","id":17431959,"avatar_url":"https://avatars0.githubusercontent.com/u/17431959?v=4","gravatar_id":"","url":"https://api.github.com/users/saiHemak","html_url":"https://github.com/saiHemak","followers_url":"https://api.github.com/users/saiHemak/followers","following_url":"https://api.github.com/users/saiHemak/following{/other_user}","gists_url":"https://api.github.com/users/saiHemak/gists{/gist_id}","starred_url":"https://api.github.com/users/saiHemak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saiHemak/subscriptions","organizations_url":"https://api.github.com/users/saiHemak/orgs","repos_url":"https://api.github.com/users/saiHemak/repos","events_url":"https://api.github.com/users/saiHemak/events{/privacy}","received_events_url":"https://api.github.com/users/saiHemak/received_events","type":"User","site_admin":false},"body":"\r\nThis PR includes ..\r\n\r\n- FTP Data Task, Download Task implementations ,Upload task with completion handler\r\n- Refactoring of URLProtocol  code to support both FTP and HTTP protocol implementations.\r\n- Basic FTPServer  implementation which supports download,data and upload task\r\n- Test cases for FTP  implementation\r\n\r\n","created_at":"2017-07-20T11:52:59Z","updated_at":"2017-09-15T11:04:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7d2c721d3111c434f5a69e5395a6683f5b7f303c","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1122/commits","review_comments_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1122/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/1122/comments","statuses_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/statuses/43bcd816af9b9360558e057fd2b9c54d54d681e2","head":{"label":"saiHemak:ftpimplementation","ref":"ftpimplementation","sha":"43bcd816af9b9360558e057fd2b9c54d54d681e2","user":{"login":"saiHemak","id":17431959,"avatar_url":"https://avatars0.githubusercontent.com/u/17431959?v=4","gravatar_id":"","url":"https://api.github.com/users/saiHemak","html_url":"https://github.com/saiHemak","followers_url":"https://api.github.com/users/saiHemak/followers","following_url":"https://api.github.com/users/saiHemak/following{/other_user}","gists_url":"https://api.github.com/users/saiHemak/gists{/gist_id}","starred_url":"https://api.github.com/users/saiHemak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saiHemak/subscriptions","organizations_url":"https://api.github.com/users/saiHemak/orgs","repos_url":"https://api.github.com/users/saiHemak/repos","events_url":"https://api.github.com/users/saiHemak/events{/privacy}","received_events_url":"https://api.github.com/users/saiHemak/received_events","type":"User","site_admin":false},"repo":{"id":58928746,"name":"swift-corelibs-foundation","full_name":"saiHemak/swift-corelibs-foundation","owner":{"login":"saiHemak","id":17431959,"avatar_url":"https://avatars0.githubusercontent.com/u/17431959?v=4","gravatar_id":"","url":"https://api.github.com/users/saiHemak","html_url":"https://github.com/saiHemak","followers_url":"https://api.github.com/users/saiHemak/followers","following_url":"https://api.github.com/users/saiHemak/following{/other_user}","gists_url":"https://api.github.com/users/saiHemak/gists{/gist_id}","starred_url":"https://api.github.com/users/saiHemak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saiHemak/subscriptions","organizations_url":"https://api.github.com/users/saiHemak/orgs","repos_url":"https://api.github.com/users/saiHemak/repos","events_url":"https://api.github.com/users/saiHemak/events{/privacy}","received_events_url":"https://api.github.com/users/saiHemak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/saiHemak/swift-corelibs-foundation","description":"The Foundation Project, providing core utilities, internationalization, and OS independence","fork":true,"url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation","forks_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/forks","keys_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/teams","hooks_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/hooks","issue_events_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/issues/events{/number}","events_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/events","assignees_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/assignees{/user}","branches_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/branches{/branch}","tags_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/tags","blobs_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/git/refs{/sha}","trees_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/statuses/{sha}","languages_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/languages","stargazers_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/stargazers","contributors_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/contributors","subscribers_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/subscribers","subscription_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/subscription","commits_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/commits{/sha}","git_commits_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/git/commits{/sha}","comments_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/comments{/number}","issue_comment_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/issues/comments{/number}","contents_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/contents/{+path}","compare_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/merges","archive_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/downloads","issues_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/issues{/number}","pulls_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/pulls{/number}","milestones_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/milestones{/number}","notifications_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/labels{/name}","releases_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/releases{/id}","deployments_url":"https://api.github.com/repos/saiHemak/swift-corelibs-foundation/deployments","created_at":"2016-05-16T11:53:22Z","updated_at":"2016-05-16T11:53:26Z","pushed_at":"2017-09-15T10:11:24Z","git_url":"git://github.com/saiHemak/swift-corelibs-foundation.git","ssh_url":"git@github.com:saiHemak/swift-corelibs-foundation.git","clone_url":"https://github.com/saiHemak/swift-corelibs-foundation.git","svn_url":"https://github.com/saiHemak/swift-corelibs-foundation","homepage":"swift.org","size":10893,"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":"3ee0925fceb476e89b26673effb7b9f92edbc3da","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","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://avatars0.githubusercontent.com/u/10639145?v=4","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-09-15T10:12:21Z","pushed_at":"2017-09-15T10:11:26Z","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":11142,"stargazers_count":2600,"watchers_count":2600,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":606,"mirror_url":null,"open_issues_count":46,"forks":606,"open_issues":46,"watchers":2600,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1122"},"html":{"href":"https://github.com/apple/swift-corelibs-foundation/pull/1122"},"issue":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1122"},"comments":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/1122/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/1122/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/1122/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift-corelibs-foundation/statuses/43bcd816af9b9360558e057fd2b9c54d54d681e2"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"alblue"}}