{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/200777119","pull_request_review_id":135164891,"id":200777119,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDc3NzExOQ==","diff_hunk":"@@ -0,0 +1,118 @@\n+﻿// Licensed to the .NET Foundation under one or more agreements.\n+// The .NET Foundation licenses this file to you under the MIT license.\n+// See the LICENSE file in the project root for more information.\n+\n+using System.IO;\n+using System.Threading;\n+using System.Threading.Tasks;\n+\n+namespace System.Net.Http\n+{\n+    internal abstract class BaseAsyncStream : Stream\n+    {\n+        public sealed override bool CanSeek => false;\n+\n+        public sealed override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) =>\n+            TaskToApm.Begin(ReadAsync(buffer, offset, count, default), callback, state);\n+\n+        public sealed override int EndRead(IAsyncResult asyncResult) =>\n+            TaskToApm.End<int>(asyncResult);\n+\n+        public sealed override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) =>\n+            TaskToApm.Begin(WriteAsync(buffer, offset, count, default), callback, state);\n+\n+        public sealed override void EndWrite(IAsyncResult asyncResult) =>\n+            TaskToApm.End(asyncResult);\n+\n+        public sealed override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException();\n+\n+        public sealed override void SetLength(long value) => throw new NotSupportedException();\n+\n+        public sealed override long Length => throw new NotSupportedException();\n+\n+        public sealed override long Position\n+        {\n+            get { throw new NotSupportedException(); }\n+            set { throw new NotSupportedException(); }\n+        }\n+\n+        protected static void ValidateBufferArgs(byte[] buffer, int offset, int count)\n+        {\n+            if (buffer == null)\n+            {\n+                throw new ArgumentNullException(nameof(buffer));\n+            }\n+\n+            if ((uint)offset > buffer.Length)\n+            {\n+                throw new ArgumentOutOfRangeException(nameof(offset));\n+            }\n+\n+            if ((uint)count > buffer.Length - offset)\n+            {\n+                throw new ArgumentOutOfRangeException(nameof(count));\n+            }\n+        }\n+\n+        /// <summary>\n+        /// Validate the arguments to CopyTo, as would Stream.CopyTo, but with knowledge that\n+        /// the source stream is always readable and so only checking the destination.\n+        /// </summary>\n+        protected static void ValidateCopyToArgs(Stream source, Stream destination, int bufferSize)\n+        {\n+            if (destination == null)\n+            {\n+                throw new ArgumentNullException(nameof(destination));\n+            }\n+\n+            if (bufferSize <= 0)\n+            {\n+                throw new ArgumentOutOfRangeException(nameof(bufferSize), bufferSize, SR.ArgumentOutOfRange_NeedPosNum);\n+            }\n+\n+            if (!destination.CanWrite)\n+            {\n+                throw destination.CanRead ?\n+                    new NotSupportedException(SR.NotSupported_UnwritableStream) :\n+                    (Exception)new ObjectDisposedException(nameof(destination), SR.ObjectDisposed_StreamClosed);\n+            }\n+        }\n+\n+        public sealed override int Read(byte[] buffer, int offset, int count)\n+        {\n+            ValidateBufferArgs(buffer, offset, count);\n+            return ReadAsync(new Memory<byte>(buffer, offset, count), CancellationToken.None).GetAwaiter().GetResult();\n+        }\n+\n+        public sealed override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)\n+        {\n+            ValidateBufferArgs(buffer, offset, count);\n+            return ReadAsync(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask();\n+        }\n+\n+        public sealed override void Write(byte[] buffer, int offset, int count)\n+        {\n+            ValidateBufferArgs(buffer, offset, count);\n+            WriteAsync(new Memory<byte>(buffer, offset, count), CancellationToken.None).GetAwaiter().GetResult();\n+        }\n+\n+        public sealed override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)\n+        {\n+            ValidateBufferArgs(buffer, offset, count);\n+            return WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken).AsTask();\n+        }\n+\n+        public sealed override void Flush() => FlushAsync().GetAwaiter().GetResult();\n+\n+        public sealed override void CopyTo(Stream destination, int bufferSize) =>\n+            CopyToAsync(destination, bufferSize, CancellationToken.None).GetAwaiter().GetResult();\n+\n+\n+        //\n+        // Methods which must be implemented by derived classes\n+        //","path":"src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/BaseAsyncStream.cs","position":113,"original_position":113,"commit_id":"ba1710683029f99d6297c27701f4f331c22e1761","original_commit_id":"ba1710683029f99d6297c27701f4f331c22e1761","user":{"login":"stephentoub","id":2642209,"node_id":"MDQ6VXNlcjI2NDIyMDk=","avatar_url":"https://avatars0.githubusercontent.com/u/2642209?v=4","gravatar_id":"","url":"https://api.github.com/users/stephentoub","html_url":"https://github.com/stephentoub","followers_url":"https://api.github.com/users/stephentoub/followers","following_url":"https://api.github.com/users/stephentoub/following{/other_user}","gists_url":"https://api.github.com/users/stephentoub/gists{/gist_id}","starred_url":"https://api.github.com/users/stephentoub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephentoub/subscriptions","organizations_url":"https://api.github.com/users/stephentoub/orgs","repos_url":"https://api.github.com/users/stephentoub/repos","events_url":"https://api.github.com/users/stephentoub/events{/privacy}","received_events_url":"https://api.github.com/users/stephentoub/received_events","type":"User","site_admin":false},"body":"Which base implementation is a nop?  Stream.FlushAsync is not a nop: it queues a work item that calls Flush.","created_at":"2018-07-06T21:43:26Z","updated_at":"2018-07-06T21:43:27Z","html_url":"https://github.com/dotnet/corefx/pull/30740#discussion_r200777119","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/30740","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/200777119"},"html":{"href":"https://github.com/dotnet/corefx/pull/30740#discussion_r200777119"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/30740"}},"in_reply_to_id":200776326},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/30740","id":198147607,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MTQ3NjA3","html_url":"https://github.com/dotnet/corefx/pull/30740","diff_url":"https://github.com/dotnet/corefx/pull/30740.diff","patch_url":"https://github.com/dotnet/corefx/pull/30740.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/30740","number":30740,"state":"open","locked":false,"title":"SocketsHttpHandler: Initial cut at HTTP2 support","user":{"login":"geoffkizer","id":12518809,"node_id":"MDQ6VXNlcjEyNTE4ODA5","avatar_url":"https://avatars2.githubusercontent.com/u/12518809?v=4","gravatar_id":"","url":"https://api.github.com/users/geoffkizer","html_url":"https://github.com/geoffkizer","followers_url":"https://api.github.com/users/geoffkizer/followers","following_url":"https://api.github.com/users/geoffkizer/following{/other_user}","gists_url":"https://api.github.com/users/geoffkizer/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffkizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffkizer/subscriptions","organizations_url":"https://api.github.com/users/geoffkizer/orgs","repos_url":"https://api.github.com/users/geoffkizer/repos","events_url":"https://api.github.com/users/geoffkizer/events{/privacy}","received_events_url":"https://api.github.com/users/geoffkizer/received_events","type":"User","site_admin":false},"body":"This PR contains the first cut at HTTP2 support for SocketsHttpHandler.\r\n\r\nThis is disabled by default, and for now can only be enabled by manually modifying the default for HttpHandlerDefaults.DefaultMaxHttpVersion. Eventually, this setting will be made public and will default to 2.0.\r\n\r\nThere is a fair amount of HTTP2 functionality that's not implemented yet. These are tracked by TODOs in the code currently. I will add issues for these once we've got the initial PR complete.\r\n\r\nCurrently, the existing remote endpoint based HTTP2 tests pass for all tests that don't have a request body (basically, GET and POST with no content).\r\n\r\nI've split this into two commits; the first is just a small amount of reorganization in the existing code to enable adding HTTP2.  The second contains the new HTTP2 code and related changes.\r\n\r\nThe HPACK code here is taken from ASP.NET, with only minor modifications.\r\n\r\n@stephentoub @davidsh @dotnet/ncl ","created_at":"2018-06-28T20:42:59Z","updated_at":"2018-07-06T21:43:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f9ee43718e851f7d162bbd68bfa972bba62329b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":809472144,"node_id":"MDU6TGFiZWw4MDk0NzIxNDQ=","url":"https://api.github.com/repos/dotnet/corefx/labels/area-System.Net.Http.SocketsHttpHandler","name":"area-System.Net.Http.SocketsHttpHandler","color":"d4c5f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/30740/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/30740/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/30740/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/ba1710683029f99d6297c27701f4f331c22e1761","head":{"label":"geoffkizer:http2","ref":"http2","sha":"ba1710683029f99d6297c27701f4f331c22e1761","user":{"login":"geoffkizer","id":12518809,"node_id":"MDQ6VXNlcjEyNTE4ODA5","avatar_url":"https://avatars2.githubusercontent.com/u/12518809?v=4","gravatar_id":"","url":"https://api.github.com/users/geoffkizer","html_url":"https://github.com/geoffkizer","followers_url":"https://api.github.com/users/geoffkizer/followers","following_url":"https://api.github.com/users/geoffkizer/following{/other_user}","gists_url":"https://api.github.com/users/geoffkizer/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffkizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffkizer/subscriptions","organizations_url":"https://api.github.com/users/geoffkizer/orgs","repos_url":"https://api.github.com/users/geoffkizer/repos","events_url":"https://api.github.com/users/geoffkizer/events{/privacy}","received_events_url":"https://api.github.com/users/geoffkizer/received_events","type":"User","site_admin":false},"repo":{"id":50082194,"node_id":"MDEwOlJlcG9zaXRvcnk1MDA4MjE5NA==","name":"corefx","full_name":"geoffkizer/corefx","owner":{"login":"geoffkizer","id":12518809,"node_id":"MDQ6VXNlcjEyNTE4ODA5","avatar_url":"https://avatars2.githubusercontent.com/u/12518809?v=4","gravatar_id":"","url":"https://api.github.com/users/geoffkizer","html_url":"https://github.com/geoffkizer","followers_url":"https://api.github.com/users/geoffkizer/followers","following_url":"https://api.github.com/users/geoffkizer/following{/other_user}","gists_url":"https://api.github.com/users/geoffkizer/gists{/gist_id}","starred_url":"https://api.github.com/users/geoffkizer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoffkizer/subscriptions","organizations_url":"https://api.github.com/users/geoffkizer/orgs","repos_url":"https://api.github.com/users/geoffkizer/repos","events_url":"https://api.github.com/users/geoffkizer/events{/privacy}","received_events_url":"https://api.github.com/users/geoffkizer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/geoffkizer/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.","fork":true,"url":"https://api.github.com/repos/geoffkizer/corefx","forks_url":"https://api.github.com/repos/geoffkizer/corefx/forks","keys_url":"https://api.github.com/repos/geoffkizer/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geoffkizer/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geoffkizer/corefx/teams","hooks_url":"https://api.github.com/repos/geoffkizer/corefx/hooks","issue_events_url":"https://api.github.com/repos/geoffkizer/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/geoffkizer/corefx/events","assignees_url":"https://api.github.com/repos/geoffkizer/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/geoffkizer/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/geoffkizer/corefx/tags","blobs_url":"https://api.github.com/repos/geoffkizer/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geoffkizer/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geoffkizer/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/geoffkizer/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geoffkizer/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/geoffkizer/corefx/languages","stargazers_url":"https://api.github.com/repos/geoffkizer/corefx/stargazers","contributors_url":"https://api.github.com/repos/geoffkizer/corefx/contributors","subscribers_url":"https://api.github.com/repos/geoffkizer/corefx/subscribers","subscription_url":"https://api.github.com/repos/geoffkizer/corefx/subscription","commits_url":"https://api.github.com/repos/geoffkizer/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/geoffkizer/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/geoffkizer/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/geoffkizer/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/geoffkizer/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/geoffkizer/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geoffkizer/corefx/merges","archive_url":"https://api.github.com/repos/geoffkizer/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geoffkizer/corefx/downloads","issues_url":"https://api.github.com/repos/geoffkizer/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/geoffkizer/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/geoffkizer/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/geoffkizer/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geoffkizer/corefx/labels{/name}","releases_url":"https://api.github.com/repos/geoffkizer/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/geoffkizer/corefx/deployments","created_at":"2016-01-21T04:31:55Z","updated_at":"2018-06-25T16:13:06Z","pushed_at":"2018-07-06T20:24:34Z","git_url":"git://github.com/geoffkizer/corefx.git","ssh_url":"git@github.com:geoffkizer/corefx.git","clone_url":"https://github.com/geoffkizer/corefx.git","svn_url":"https://github.com/geoffkizer/corefx","homepage":"http://dotnet.github.io/","size":176042,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"1ddcfb9eca7e690a048ef20552bee37bab6cfd30","user":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":26295345,"node_id":"MDEwOlJlcG9zaXRvcnkyNjI5NTM0NQ==","name":"corefx","full_name":"dotnet/corefx","owner":{"login":"dotnet","id":9141961,"node_id":"MDEyOk9yZ2FuaXphdGlvbjkxNDE5NjE=","avatar_url":"https://avatars0.githubusercontent.com/u/9141961?v=4","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corefx","description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others. We welcome contributions.","fork":false,"url":"https://api.github.com/repos/dotnet/corefx","forks_url":"https://api.github.com/repos/dotnet/corefx/forks","keys_url":"https://api.github.com/repos/dotnet/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corefx/teams","hooks_url":"https://api.github.com/repos/dotnet/corefx/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corefx/events","assignees_url":"https://api.github.com/repos/dotnet/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corefx/tags","blobs_url":"https://api.github.com/repos/dotnet/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corefx/languages","stargazers_url":"https://api.github.com/repos/dotnet/corefx/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corefx/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corefx/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corefx/subscription","commits_url":"https://api.github.com/repos/dotnet/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corefx/merges","archive_url":"https://api.github.com/repos/dotnet/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corefx/downloads","issues_url":"https://api.github.com/repos/dotnet/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corefx/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corefx/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/corefx/deployments","created_at":"2014-11-06T23:42:48Z","updated_at":"2018-07-06T21:32:24Z","pushed_at":"2018-07-06T21:07:53Z","git_url":"git://github.com/dotnet/corefx.git","ssh_url":"git@github.com:dotnet/corefx.git","clone_url":"https://github.com/dotnet/corefx.git","svn_url":"https://github.com/dotnet/corefx","homepage":"https://github.com/dotnet/core","size":182648,"stargazers_count":14304,"watchers_count":14304,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4144,"mirror_url":null,"archived":false,"open_issues_count":2363,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4144,"open_issues":2363,"watchers":14304,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/30740"},"html":{"href":"https://github.com/dotnet/corefx/pull/30740"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/30740"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/30740/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/30740/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/30740/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/ba1710683029f99d6297c27701f4f331c22e1761"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"stephentoub"}}