{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/681","repository_url":"https://api.github.com/repos/apple/swift-corelibs-foundation","labels_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/681/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/681/comments","events_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/681/events","html_url":"https://github.com/apple/swift-corelibs-foundation/pull/681","id":182187618,"number":681,"title":"Fix for SR-2913 - HTTP headers not picked up","user":{"login":"pushkarnk","id":4761859,"avatar_url":"https://avatars.githubusercontent.com/u/4761859?v=3","gravatar_id":"","url":"https://api.github.com/users/pushkarnk","html_url":"https://github.com/pushkarnk","followers_url":"https://api.github.com/users/pushkarnk/followers","following_url":"https://api.github.com/users/pushkarnk/following{/other_user}","gists_url":"https://api.github.com/users/pushkarnk/gists{/gist_id}","starred_url":"https://api.github.com/users/pushkarnk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pushkarnk/subscriptions","organizations_url":"https://api.github.com/users/pushkarnk/orgs","repos_url":"https://api.github.com/users/pushkarnk/repos","events_url":"https://api.github.com/users/pushkarnk/events{/privacy}","received_events_url":"https://api.github.com/users/pushkarnk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-10-11T06:58:59Z","updated_at":"2016-11-03T16:12:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/pulls/681","html_url":"https://github.com/apple/swift-corelibs-foundation/pull/681","diff_url":"https://github.com/apple/swift-corelibs-foundation/pull/681.diff","patch_url":"https://github.com/apple/swift-corelibs-foundation/pull/681.patch"},"body":"In `startNewTransfer(with:)` though we first set currentRequest property to the incoming request [here](https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/NSURLSession/NSURLSessionTask.swift#L462), the update happens asynchronously on the `taskAttributesIsolation` queue. Subsequently, in `curlHeaders(for: URLRequest)` we use the `currentRequest` property assuming it has been set to get the HTTP headers. \n\nIf we end up picking up the HTTP headers before async block runs, we can get into problems. For new requests, the `currentRequest` property could still be nil, meaning the expected headers will not passed to libcurl. For redirections, we may pick up headers from the previous request. \n\nI think it must be acceptable to use the incoming URLRequest parameter instead of the property. After all, the `currentRequest` property is expected to be set to the incoming URLRequest. \n"},"comment":{"url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/comments/258190767","html_url":"https://github.com/apple/swift-corelibs-foundation/pull/681#issuecomment-258190767","issue_url":"https://api.github.com/repos/apple/swift-corelibs-foundation/issues/681","id":258190767,"user":{"login":"parkera","id":144462,"avatar_url":"https://avatars.githubusercontent.com/u/144462?v=3","gravatar_id":"","url":"https://api.github.com/users/parkera","html_url":"https://github.com/parkera","followers_url":"https://api.github.com/users/parkera/followers","following_url":"https://api.github.com/users/parkera/following{/other_user}","gists_url":"https://api.github.com/users/parkera/gists{/gist_id}","starred_url":"https://api.github.com/users/parkera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parkera/subscriptions","organizations_url":"https://api.github.com/users/parkera/orgs","repos_url":"https://api.github.com/users/parkera/repos","events_url":"https://api.github.com/users/parkera/events{/privacy}","received_events_url":"https://api.github.com/users/parkera/received_events","type":"User","site_admin":false},"created_at":"2016-11-03T16:12:46Z","updated_at":"2016-11-03T16:12:46Z","body":"LGTM"}}
{"actor":{"display_login":"parkera"}}