{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/wcf/pulls/comments/32794005","id":32794005,"diff_hunk":"@@ -0,0 +1,350 @@\n+﻿using System.Diagnostics.Contracts;\n+using System.IO;\n+using System.Threading;\n+using System.Threading.Tasks;\n+\n+namespace System.ServiceModel.Channels\n+{\n+    internal class ProducerConsumerStream : Stream\n+    {\n+        private TaskCompletionSource<WriteBufferWrapper> _buffer;\n+        private TaskCompletionSource<int> _dataAvail;\n+        private WriteBufferWrapper _currentBuffer;\n+        private bool _disposed;\n+\n+        public ProducerConsumerStream()\n+        {\n+            _buffer = new TaskCompletionSource<WriteBufferWrapper>();\n+            _dataAvail = new TaskCompletionSource<int>();\n+            _currentBuffer = WriteBufferWrapper.EmptyContainer;\n+        }\n+\n+        public override void Flush()\n+        {\n+            _dataAvail.TrySetResult(0);\n+        }\n+\n+        public override long Seek(long offset, SeekOrigin origin)\n+        {\n+            throw new NotImplementedException();\n+        }\n+\n+        public override void SetLength(long value)\n+        {\n+            throw new NotImplementedException();\n+        }\n+\n+        public override int Read(byte[] buffer, int offset, int count)\n+        {\n+            if (buffer == null)\n+            {\n+                throw new ArgumentNullException(\"buffer\");\n+            }\n+            if (offset < 0 || offset > buffer.Length)\n+            {\n+                throw new ArgumentOutOfRangeException(\"offset\");\n+            }\n+            if (count < 0 || count > buffer.Length - offset)\n+            {\n+                throw new ArgumentOutOfRangeException(\"count\");\n+            }\n+            Contract.EndContractBlock();\n+\n+            if (_disposed)\n+            {\n+                return 0;\n+            }\n+\n+            _buffer.SetResult(new WriteBufferWrapper(buffer, offset, count));\n+            int totalBytesRead = 0;\n+            do\n+            {\n+                int bytesRead = _dataAvail.Task.Result;\n+                _dataAvail = new TaskCompletionSource<int>();\n+                totalBytesRead += bytesRead;\n+                count -= bytesRead;\n+                if (bytesRead == 0)\n+                {\n+                    break;\n+                }\n+            } while (count > 0);\n+            return totalBytesRead;\n+        }\n+\n+        public override void Write(byte[] buffer, int offset, int count)\n+        {\n+            if (buffer == null)\n+            {\n+                throw new ArgumentNullException(\"buffer\");\n+            }\n+            if (offset < 0 || offset > buffer.Length)\n+            {\n+                throw new ArgumentOutOfRangeException(\"offset\");\n+            }\n+            if (count < 0 || count > buffer.Length - offset)\n+            {\n+                throw new ArgumentOutOfRangeException(\"count\");\n+            }\n+            Contract.EndContractBlock();\n+","path":"src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ProducerConsumerStream.cs","position":89,"original_position":89,"commit_id":"8fa89e6c05e298f3eda3142ef13a340717b24fa9","original_commit_id":"8fa89e6c05e298f3eda3142ef13a340717b24fa9","user":{"login":"mconnew","id":8648390,"avatar_url":"https://avatars.githubusercontent.com/u/8648390?v=3","gravatar_id":"","url":"https://api.github.com/users/mconnew","html_url":"https://github.com/mconnew","followers_url":"https://api.github.com/users/mconnew/followers","following_url":"https://api.github.com/users/mconnew/following{/other_user}","gists_url":"https://api.github.com/users/mconnew/gists{/gist_id}","starred_url":"https://api.github.com/users/mconnew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mconnew/subscriptions","organizations_url":"https://api.github.com/users/mconnew/orgs","repos_url":"https://api.github.com/users/mconnew/repos","events_url":"https://api.github.com/users/mconnew/events{/privacy}","received_events_url":"https://api.github.com/users/mconnew/received_events","type":"User","site_admin":false},"body":"Some Contract methods work all the time, and other only when doing a special compilation with the symbol CONTRACTS_FULL enabled. I don't believe we have that symbol enabled and EndContractBlock() is conditionally compiled with that symbol so it ends up a noop. I'm removing this as it's effectively dead code.","created_at":"2015-06-19T00:57:03Z","updated_at":"2015-06-19T00:57:03Z","html_url":"https://github.com/dotnet/wcf/pull/102#discussion_r32794005","pull_request_url":"https://api.github.com/repos/dotnet/wcf/pulls/102","_links":{"self":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/comments/32794005"},"html":{"href":"https://github.com/dotnet/wcf/pull/102#discussion_r32794005"},"pull_request":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/102"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/wcf/pulls/102","id":37956559,"html_url":"https://github.com/dotnet/wcf/pull/102","diff_url":"https://github.com/dotnet/wcf/pull/102.diff","patch_url":"https://github.com/dotnet/wcf/pull/102.patch","issue_url":"https://api.github.com/repos/dotnet/wcf/issues/102","number":102,"state":"open","locked":false,"title":"Fix ability to replay http content as well as code cleanup","user":{"login":"mconnew","id":8648390,"avatar_url":"https://avatars.githubusercontent.com/u/8648390?v=3","gravatar_id":"","url":"https://api.github.com/users/mconnew","html_url":"https://github.com/mconnew","followers_url":"https://api.github.com/users/mconnew/followers","following_url":"https://api.github.com/users/mconnew/following{/other_user}","gists_url":"https://api.github.com/users/mconnew/gists{/gist_id}","starred_url":"https://api.github.com/users/mconnew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mconnew/subscriptions","organizations_url":"https://api.github.com/users/mconnew/orgs","repos_url":"https://api.github.com/users/mconnew/repos","events_url":"https://api.github.com/users/mconnew/events{/privacy}","received_events_url":"https://api.github.com/users/mconnew/received_events","type":"User","site_admin":false},"body":"We couldn't replay the HttpContent because of the way the ForwardingStream worked. This caused problems with digest authentication as pre-authentication isn't possible with WinHttp (the http client behind the corefx implementation of HttpClient).  This is achieved with a new MessageContent class which encapsulates a WCF Message and can write directly to a stream provided by HttpClient multiple times.\r\nCode cleanup allows easier error handling and extending the error cases in future changes. The send and receive code paths are separated more cleanly. This wasn't possible before because of the HttpOutput/HttpInput abstraction we were dealing with which was inherited from Desktop code. The net change is a reduction of around 700 lines of code.\r\nFixes #48, #6 and #5  ","created_at":"2015-06-17T23:03:44Z","updated_at":"2015-06-19T00:57:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b6803bdc733480b58db332f142adf599913546ef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/wcf/pulls/102/commits","review_comments_url":"https://api.github.com/repos/dotnet/wcf/pulls/102/comments","review_comment_url":"https://api.github.com/repos/dotnet/wcf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/wcf/issues/102/comments","statuses_url":"https://api.github.com/repos/dotnet/wcf/statuses/8fa89e6c05e298f3eda3142ef13a340717b24fa9","head":{"label":"mconnew:http-authentication","ref":"http-authentication","sha":"8fa89e6c05e298f3eda3142ef13a340717b24fa9","user":{"login":"mconnew","id":8648390,"avatar_url":"https://avatars.githubusercontent.com/u/8648390?v=3","gravatar_id":"","url":"https://api.github.com/users/mconnew","html_url":"https://github.com/mconnew","followers_url":"https://api.github.com/users/mconnew/followers","following_url":"https://api.github.com/users/mconnew/following{/other_user}","gists_url":"https://api.github.com/users/mconnew/gists{/gist_id}","starred_url":"https://api.github.com/users/mconnew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mconnew/subscriptions","organizations_url":"https://api.github.com/users/mconnew/orgs","repos_url":"https://api.github.com/users/mconnew/repos","events_url":"https://api.github.com/users/mconnew/events{/privacy}","received_events_url":"https://api.github.com/users/mconnew/received_events","type":"User","site_admin":false},"repo":{"id":35959856,"name":"wcf","full_name":"mconnew/wcf","owner":{"login":"mconnew","id":8648390,"avatar_url":"https://avatars.githubusercontent.com/u/8648390?v=3","gravatar_id":"","url":"https://api.github.com/users/mconnew","html_url":"https://github.com/mconnew","followers_url":"https://api.github.com/users/mconnew/followers","following_url":"https://api.github.com/users/mconnew/following{/other_user}","gists_url":"https://api.github.com/users/mconnew/gists{/gist_id}","starred_url":"https://api.github.com/users/mconnew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mconnew/subscriptions","organizations_url":"https://api.github.com/users/mconnew/orgs","repos_url":"https://api.github.com/users/mconnew/repos","events_url":"https://api.github.com/users/mconnew/events{/privacy}","received_events_url":"https://api.github.com/users/mconnew/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mconnew/wcf","description":"This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.","fork":true,"url":"https://api.github.com/repos/mconnew/wcf","forks_url":"https://api.github.com/repos/mconnew/wcf/forks","keys_url":"https://api.github.com/repos/mconnew/wcf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mconnew/wcf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mconnew/wcf/teams","hooks_url":"https://api.github.com/repos/mconnew/wcf/hooks","issue_events_url":"https://api.github.com/repos/mconnew/wcf/issues/events{/number}","events_url":"https://api.github.com/repos/mconnew/wcf/events","assignees_url":"https://api.github.com/repos/mconnew/wcf/assignees{/user}","branches_url":"https://api.github.com/repos/mconnew/wcf/branches{/branch}","tags_url":"https://api.github.com/repos/mconnew/wcf/tags","blobs_url":"https://api.github.com/repos/mconnew/wcf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mconnew/wcf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mconnew/wcf/git/refs{/sha}","trees_url":"https://api.github.com/repos/mconnew/wcf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mconnew/wcf/statuses/{sha}","languages_url":"https://api.github.com/repos/mconnew/wcf/languages","stargazers_url":"https://api.github.com/repos/mconnew/wcf/stargazers","contributors_url":"https://api.github.com/repos/mconnew/wcf/contributors","subscribers_url":"https://api.github.com/repos/mconnew/wcf/subscribers","subscription_url":"https://api.github.com/repos/mconnew/wcf/subscription","commits_url":"https://api.github.com/repos/mconnew/wcf/commits{/sha}","git_commits_url":"https://api.github.com/repos/mconnew/wcf/git/commits{/sha}","comments_url":"https://api.github.com/repos/mconnew/wcf/comments{/number}","issue_comment_url":"https://api.github.com/repos/mconnew/wcf/issues/comments{/number}","contents_url":"https://api.github.com/repos/mconnew/wcf/contents/{+path}","compare_url":"https://api.github.com/repos/mconnew/wcf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mconnew/wcf/merges","archive_url":"https://api.github.com/repos/mconnew/wcf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mconnew/wcf/downloads","issues_url":"https://api.github.com/repos/mconnew/wcf/issues{/number}","pulls_url":"https://api.github.com/repos/mconnew/wcf/pulls{/number}","milestones_url":"https://api.github.com/repos/mconnew/wcf/milestones{/number}","notifications_url":"https://api.github.com/repos/mconnew/wcf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mconnew/wcf/labels{/name}","releases_url":"https://api.github.com/repos/mconnew/wcf/releases{/id}","created_at":"2015-05-20T16:24:51Z","updated_at":"2015-05-20T16:24:53Z","pushed_at":"2015-06-17T23:27:45Z","git_url":"git://github.com/mconnew/wcf.git","ssh_url":"git@github.com:mconnew/wcf.git","clone_url":"https://github.com/mconnew/wcf.git","svn_url":"https://github.com/mconnew/wcf","homepage":"","size":1178,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"dotnet:master","ref":"master","sha":"ce2cfcb74b106b29f0a90dcbc5db17fa1a322884","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","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":35562993,"name":"wcf","full_name":"dotnet/wcf","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","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/wcf","description":"This repo contains the client-oriented WCF libraries that enable applications built on .NET Core to communicate with WCF services.","fork":false,"url":"https://api.github.com/repos/dotnet/wcf","forks_url":"https://api.github.com/repos/dotnet/wcf/forks","keys_url":"https://api.github.com/repos/dotnet/wcf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/wcf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/wcf/teams","hooks_url":"https://api.github.com/repos/dotnet/wcf/hooks","issue_events_url":"https://api.github.com/repos/dotnet/wcf/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/wcf/events","assignees_url":"https://api.github.com/repos/dotnet/wcf/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/wcf/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/wcf/tags","blobs_url":"https://api.github.com/repos/dotnet/wcf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/wcf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/wcf/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/wcf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/wcf/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/wcf/languages","stargazers_url":"https://api.github.com/repos/dotnet/wcf/stargazers","contributors_url":"https://api.github.com/repos/dotnet/wcf/contributors","subscribers_url":"https://api.github.com/repos/dotnet/wcf/subscribers","subscription_url":"https://api.github.com/repos/dotnet/wcf/subscription","commits_url":"https://api.github.com/repos/dotnet/wcf/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/wcf/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/wcf/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/wcf/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/wcf/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/wcf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/wcf/merges","archive_url":"https://api.github.com/repos/dotnet/wcf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/wcf/downloads","issues_url":"https://api.github.com/repos/dotnet/wcf/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/wcf/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/wcf/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/wcf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/wcf/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/wcf/releases{/id}","created_at":"2015-05-13T17:17:03Z","updated_at":"2015-06-18T05:19:09Z","pushed_at":"2015-06-18T19:01:44Z","git_url":"git://github.com/dotnet/wcf.git","ssh_url":"git@github.com:dotnet/wcf.git","clone_url":"https://github.com/dotnet/wcf.git","svn_url":"https://github.com/dotnet/wcf","homepage":"","size":1893,"stargazers_count":457,"watchers_count":457,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":127,"mirror_url":null,"open_issues_count":61,"forks":127,"open_issues":61,"watchers":457,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/102"},"html":{"href":"https://github.com/dotnet/wcf/pull/102"},"issue":{"href":"https://api.github.com/repos/dotnet/wcf/issues/102"},"comments":{"href":"https://api.github.com/repos/dotnet/wcf/issues/102/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/102/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/wcf/pulls/102/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/wcf/statuses/8fa89e6c05e298f3eda3142ef13a340717b24fa9"}}}}