{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/14715","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/14715/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/14715/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/14715/events","html_url":"https://github.com/dotnet/corefx/issues/14715","id":197537675,"number":14715,"title":"Unknown cURL error when using HTTP/2 to connect to api.push.apple.com","user":{"login":"yaakov-h","id":426009,"avatar_url":"https://avatars.githubusercontent.com/u/426009?v=3","gravatar_id":"","url":"https://api.github.com/users/yaakov-h","html_url":"https://github.com/yaakov-h","followers_url":"https://api.github.com/users/yaakov-h/followers","following_url":"https://api.github.com/users/yaakov-h/following{/other_user}","gists_url":"https://api.github.com/users/yaakov-h/gists{/gist_id}","starred_url":"https://api.github.com/users/yaakov-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaakov-h/subscriptions","organizations_url":"https://api.github.com/users/yaakov-h/orgs","repos_url":"https://api.github.com/users/yaakov-h/repos","events_url":"https://api.github.com/users/yaakov-h/events{/privacy}","received_events_url":"https://api.github.com/users/yaakov-h/received_events","type":"User","site_admin":false},"labels":[{"id":158885797,"url":"https://api.github.com/repos/dotnet/corefx/labels/area-Meta","name":"area-Meta","color":"d4c5f9","default":false},{"id":309869280,"url":"https://api.github.com/repos/dotnet/corefx/labels/question","name":"question","color":"207de5","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-26T05:22:19Z","updated_at":"2016-12-26T23:20:10Z","closed_at":null,"body":"Using .NET Core 1.1 on macOS \"Sierra\" 10.12.2 (build 16C67).\r\n\r\nWhen using `System.Net.Http.HttpClient` to try connect via HTTP/2 to api.push.apple.com, there's some unexplained cURL error - see below.\r\n\r\nThe exception is not descriptive enough to attempt to troubleshoot, and as the connection is encrypted, I cannot examine it and compare the transmissions to a working reference implementation.\r\n\r\n**Repro code:**\r\n<details>\r\n\r\n```\r\nusing System;\r\nusing System.Net.Http;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace ConsoleApplication\r\n{\r\n    public class Program\r\n    {\r\n        public static int Main(string[] args)\r\n            => MainAsync(args).GetAwaiter().GetResult();\r\n\r\n        static async Task<int> MainAsync(string[] args)\r\n        {\r\n            try\r\n            {\r\n                using (var client = new HttpClient())\r\n                {\r\n                    var request = new HttpRequestMessage(HttpMethod.Post, \"https://api.push.apple.com/3/device/AAA\");\r\n                    request.Version = new Version(2, 0);\r\n\r\n                    var response = await client.SendAsync(request);\r\n                    Console.WriteLine($\"HTTP Status Code: {response.StatusCode}\");\r\n                    Console.WriteLine(await response.Content.ReadAsStringAsync());\r\n                }\r\n                \r\n                return 0;\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                WriteExceptionRecursive(ex);\r\n                return -1;\r\n            }\r\n        }\r\n\r\n        static void WriteExceptionRecursive(Exception ex)\r\n        {\r\n            if (ex.InnerException != null)\r\n            {\r\n                WriteExceptionRecursive(ex.InnerException);\r\n            }\r\n\r\n            Console.WriteLine($\"{ex.GetType().Name}: {ex.Message}\");\r\n            Console.WriteLine(ex.StackTrace);\r\n            Console.WriteLine();\r\n        }\r\n    }\r\n}\r\n```\r\n</details>\r\n<br />\r\n\r\n**Output:**\r\n\r\n```\r\n[04:13pm yaakov@Expression:/tmp/netcore_apple] dotnet run\r\nProject netcore_apple (.NETCoreApp,Version=v1.1) will be compiled because inputs were modified\r\nCompiling netcore_apple for .NETCoreApp,Version=v1.1\r\n\r\nCompilation succeeded.\r\n    0 Warning(s)\r\n    0 Error(s)\r\n\r\nTime elapsed 00:00:01.4441779\r\n \r\n\r\nCurlException: Failure when receiving data from the peer\r\n   at System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode error)\r\n   at System.Net.Http.CurlHandler.MultiAgent.FinishRequest(StrongToWeakReference`1 easyWrapper, CURLcode messageResult)\r\n\r\nIOException: The read operation failed, see inner exception.\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()\r\n   at System.Net.Http.StreamToStreamCopy.<CopyAsyncAnyStreamToAnyStreamCore>d__3.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()\r\n   at System.Net.Http.HttpContent.<LoadIntoBufferAsyncCore>d__48.MoveNext()\r\n\r\nHttpRequestException: Error while copying content to a stream.\r\n   at System.Net.Http.HttpContent.<LoadIntoBufferAsyncCore>d__48.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()\r\n   at System.Net.Http.HttpClient.<FinishSendAsync>d__58.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at ConsoleApplication.Program.<MainAsync>d__1.MoveNext() in /private/tmp/netcore_apple/Program.cs:line 21\r\n\r\n```\r\n\r\nFor reference, a build of the cURL command-line client that supports HTTP/2 provides the following output:\r\n\r\n<details>\r\n\r\n```\r\n[04:21pm yaakov@Expression:/tmp/netcore_apple] /usr/local/Cellar/curl/7.52.1/bin/curl -v --http2 -X POST https://api.push.apple.com/3/device/AAA\r\n*   Trying 17.188.160.207...\r\n* TCP_NODELAY set\r\n* Connected to api.push.apple.com (17.188.160.207) port 443 (#0)\r\n* ALPN, offering h2\r\n* ALPN, offering http/1.1\r\n* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH\r\n* successfully set certificate verify locations:\r\n*   CAfile: /usr/local/etc/openssl/cert.pem\r\n  CApath: /usr/local/etc/openssl/certs\r\n* TLSv1.2 (OUT), TLS header, Certificate Status (22):\r\n* TLSv1.2 (OUT), TLS handshake, Client hello (1):\r\n* TLSv1.2 (IN), TLS handshake, Server hello (2):\r\n* TLSv1.2 (IN), TLS handshake, Certificate (11):\r\n* TLSv1.2 (IN), TLS handshake, Server key exchange (12):\r\n* TLSv1.2 (IN), TLS handshake, Request CERT (13):\r\n* TLSv1.2 (IN), TLS handshake, Server finished (14):\r\n* TLSv1.2 (OUT), TLS handshake, Certificate (11):\r\n* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):\r\n* TLSv1.2 (OUT), TLS change cipher, Client hello (1):\r\n* TLSv1.2 (OUT), TLS handshake, Finished (20):\r\n* TLSv1.2 (IN), TLS change cipher, Client hello (1):\r\n* TLSv1.2 (IN), TLS handshake, Finished (20):\r\n* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384\r\n* ALPN, server accepted to use h2\r\n* Server certificate:\r\n*  subject: CN=api.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US\r\n*  start date: Aug 28 19:03:46 2015 GMT\r\n*  expire date: Sep 26 19:03:46 2017 GMT\r\n*  subjectAltName: host \"api.push.apple.com\" matched cert's \"api.push.apple.com\"\r\n*  issuer: CN=Apple IST CA 2 - G1; OU=Certification Authority; O=Apple Inc.; C=US\r\n*  SSL certificate verify ok.\r\n* Using HTTP2, server supports multi-use\r\n* Connection state changed (HTTP/2 confirmed)\r\n* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0\r\n* Using Stream ID: 1 (easy handle 0x7fd42980b000)\r\n> POST /3/device/AAA HTTP/1.1\r\n> Host: api.push.apple.com\r\n> User-Agent: curl/7.52.1\r\n> Accept: */*\r\n> \r\n* Connection state changed (MAX_CONCURRENT_STREAMS updated)!\r\n< HTTP/2 403 \r\n< apns-id: 1AD32888-F1A3-3494-BCBD-2783E02F7AD3\r\n< \r\n* Curl_http_done: called premature == 0\r\n* Connection #0 to host api.push.apple.com left intact\r\n{\"reason\":\"MissingProviderToken\"}\r\n```\r\n</details>"},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/269248400","html_url":"https://github.com/dotnet/corefx/issues/14715#issuecomment-269248400","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/14715","id":269248400,"user":{"login":"karelz","id":5776068,"avatar_url":"https://avatars.githubusercontent.com/u/5776068?v=3","gravatar_id":"","url":"https://api.github.com/users/karelz","html_url":"https://github.com/karelz","followers_url":"https://api.github.com/users/karelz/followers","following_url":"https://api.github.com/users/karelz/following{/other_user}","gists_url":"https://api.github.com/users/karelz/gists{/gist_id}","starred_url":"https://api.github.com/users/karelz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karelz/subscriptions","organizations_url":"https://api.github.com/users/karelz/orgs","repos_url":"https://api.github.com/users/karelz/repos","events_url":"https://api.github.com/users/karelz/events{/privacy}","received_events_url":"https://api.github.com/users/karelz/received_events","type":"User","site_admin":false},"created_at":"2016-12-26T23:20:10Z","updated_at":"2016-12-26T23:20:10Z","body":"@cH40z-Lord do you have any reference to problems in other languages? If that's true, the issue is likely unrelated to .NET Core - unless we need to update our prereqs to require special curl install ..."}}
{"actor":{"display_login":"karelz"}}