{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/comments/35725717","id":35725717,"diff_hunk":"@@ -0,0 +1,259 @@\n+// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+\n+using System;\n+using System.Diagnostics;\n+using System.Net.Http;\n+using System.Runtime.InteropServices;\n+using System.Threading;\n+using System.Threading.Tasks;\n+\n+using SafeCurlHandle = Interop.libcurl.SafeCurlHandle;\n+using CURLoption = Interop.libcurl.CURLoption;\n+using CURLcode = Interop.libcurl.CURLcode;\n+using CURLINFO = Interop.libcurl.CURLINFO;\n+\n+namespace System.Net.Http\n+{\n+    internal class CurlHandler : HttpMessageHandler\n+    {\n+        #region Constants\n+\n+        private const string UriSchemeHttps = \"https\";\n+\n+        #endregion\n+\n+        #region Fields\n+\n+        private volatile bool _anyOperationStarted;\n+        private volatile bool _disposed;\n+        private bool _automaticRedirection = true;\n+\n+        #endregion\n+\n+        internal CurlHandler()\n+        {\n+        }\n+\n+        #region Properties\n+        internal bool AutomaticRedirection\n+        {\n+            get\n+            {\n+                return _automaticRedirection;\n+            }\n+\n+            set\n+            {\n+                CheckDisposedOrStarted();\n+                _automaticRedirection = value;\n+            }\n+        }\n+\n+        #endregion\n+\n+        protected override void Dispose(bool disposing)\n+        {\n+            if (disposing && !_disposed)\n+            {\n+                _disposed = true;\n+            }\n+\n+            base.Dispose(disposing);\n+        }\n+\n+        protected internal override Task<HttpResponseMessage> SendAsync(\n+            HttpRequestMessage request,\n+            CancellationToken cancellationToken)\n+        {\n+            if (request == null)\n+            {\n+                throw new ArgumentNullException(\"request\", SR.net_http_handler_norequest);\n+            }\n+            if (request.RequestUri.Scheme == UriSchemeHttps)\n+            {\n+                throw NotImplemented.ByDesignWithMessage(\"HTTPS stack is not yet implemented\");\n+            }\n+            if (request.Content != null)\n+            {\n+                throw NotImplemented.ByDesignWithMessage(\"HTTP requests with a body are not yet supported\");\n+            }\n+\n+            CheckDisposed();\n+\n+            SetOperationStarted();\n+\n+            if (cancellationToken.IsCancellationRequested)\n+            {\n+                return Task.FromCanceled<HttpResponseMessage>(cancellationToken);\n+            }\n+\n+            // Create RequestCompletionSource object and save current values of handler settings.\n+            RequestCompletionSource state = new RequestCompletionSource();\n+            state.CancellationToken = cancellationToken;\n+            state.RequestMessage = request;\n+            state.Handler = this;\n+\n+            Task.Factory.StartNew(\n+                s =>\n+                {\n+                    var rcs = (RequestCompletionSource)s;\n+                    rcs.Handler.StartRequest(rcs);\n+                },\n+                state,\n+                CancellationToken.None,\n+                TaskCreationOptions.DenyChildAttach,\n+                TaskScheduler.Default);\n+\n+            return state.Task;\n+        }\n+\n+        #region Private methods\n+\n+        private void StartRequest(RequestCompletionSource state)\n+        {\n+            HttpResponseMessage responseMessage = null;\n+            SafeCurlHandle requestHandle = null;\n+\n+            if (state.CancellationToken.IsCancellationRequested)\n+            {\n+                state.TrySetCanceled();\n+                return;\n+            }\n+\n+            var cancellationTokenRegistration = state.CancellationToken.Register(x => ((RequestCompletionSource) x).TrySetCanceled(), state);\n+\n+            try\n+            {\n+                requestHandle = CreateRequestHandle(state);\n+\n+                state.CancellationToken.ThrowIfCancellationRequested();\n+                int result = Interop.libcurl.curl_easy_perform(requestHandle);","path":"src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.cs","position":131,"original_position":131,"commit_id":"ac4bf3eb90bf9255e64031c3d623b3443f349f7f","original_commit_id":"8976781285c8b7f094fddac3a626eb7854291eba","user":{"login":"vijaykota","id":11638339,"avatar_url":"https://avatars.githubusercontent.com/u/11638339?v=3","gravatar_id":"","url":"https://api.github.com/users/vijaykota","html_url":"https://github.com/vijaykota","followers_url":"https://api.github.com/users/vijaykota/followers","following_url":"https://api.github.com/users/vijaykota/following{/other_user}","gists_url":"https://api.github.com/users/vijaykota/gists{/gist_id}","starred_url":"https://api.github.com/users/vijaykota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vijaykota/subscriptions","organizations_url":"https://api.github.com/users/vijaykota/orgs","repos_url":"https://api.github.com/users/vijaykota/repos","events_url":"https://api.github.com/users/vijaykota/events{/privacy}","received_events_url":"https://api.github.com/users/vijaykota/received_events","type":"User","site_admin":false},"body":"What is the timeline for WinHttpHandler changes in this regard?","created_at":"2015-07-29T03:46:38Z","updated_at":"2015-07-29T03:46:38Z","html_url":"https://github.com/dotnet/corefx/pull/2473#discussion_r35725717","pull_request_url":"https://api.github.com/repos/dotnet/corefx/pulls/2473","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments/35725717"},"html":{"href":"https://github.com/dotnet/corefx/pull/2473#discussion_r35725717"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/2473"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corefx/pulls/2473","id":40747830,"html_url":"https://github.com/dotnet/corefx/pull/2473","diff_url":"https://github.com/dotnet/corefx/pull/2473.diff","patch_url":"https://github.com/dotnet/corefx/pull/2473.patch","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/2473","number":2473,"state":"closed","locked":false,"title":"Initial xplat work for HttpClient","user":{"login":"vijaykota","id":11638339,"avatar_url":"https://avatars.githubusercontent.com/u/11638339?v=3","gravatar_id":"","url":"https://api.github.com/users/vijaykota","html_url":"https://github.com/vijaykota","followers_url":"https://api.github.com/users/vijaykota/followers","following_url":"https://api.github.com/users/vijaykota/following{/other_user}","gists_url":"https://api.github.com/users/vijaykota/gists{/gist_id}","starred_url":"https://api.github.com/users/vijaykota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vijaykota/subscriptions","organizations_url":"https://api.github.com/users/vijaykota/orgs","repos_url":"https://api.github.com/users/vijaykota/repos","events_url":"https://api.github.com/users/vijaykota/events{/privacy}","received_events_url":"https://api.github.com/users/vijaykota/received_events","type":"User","site_admin":false},"body":"Created a CurlHandler class to wrap calls to libcurl. Very limited support currently which will be extended in future checkins.\r\n\r\nStart of #2480","created_at":"2015-07-24T07:03:21Z","updated_at":"2015-07-29T03:46:38Z","closed_at":"2015-07-29T03:39:04Z","merged_at":"2015-07-29T03:39:04Z","merge_commit_sha":"1b8f6f559039c14103380897779c2c88d11e2439","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corefx/pulls/2473/commits","review_comments_url":"https://api.github.com/repos/dotnet/corefx/pulls/2473/comments","review_comment_url":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/2473/comments","statuses_url":"https://api.github.com/repos/dotnet/corefx/statuses/ac4bf3eb90bf9255e64031c3d623b3443f349f7f","head":{"label":"vijaykota:feature","ref":"feature","sha":"ac4bf3eb90bf9255e64031c3d623b3443f349f7f","user":{"login":"vijaykota","id":11638339,"avatar_url":"https://avatars.githubusercontent.com/u/11638339?v=3","gravatar_id":"","url":"https://api.github.com/users/vijaykota","html_url":"https://github.com/vijaykota","followers_url":"https://api.github.com/users/vijaykota/followers","following_url":"https://api.github.com/users/vijaykota/following{/other_user}","gists_url":"https://api.github.com/users/vijaykota/gists{/gist_id}","starred_url":"https://api.github.com/users/vijaykota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vijaykota/subscriptions","organizations_url":"https://api.github.com/users/vijaykota/orgs","repos_url":"https://api.github.com/users/vijaykota/repos","events_url":"https://api.github.com/users/vijaykota/events{/privacy}","received_events_url":"https://api.github.com/users/vijaykota/received_events","type":"User","site_admin":false},"repo":{"id":39578675,"name":"corefx","full_name":"vijaykota/corefx","owner":{"login":"vijaykota","id":11638339,"avatar_url":"https://avatars.githubusercontent.com/u/11638339?v=3","gravatar_id":"","url":"https://api.github.com/users/vijaykota","html_url":"https://github.com/vijaykota","followers_url":"https://api.github.com/users/vijaykota/followers","following_url":"https://api.github.com/users/vijaykota/following{/other_user}","gists_url":"https://api.github.com/users/vijaykota/gists{/gist_id}","starred_url":"https://api.github.com/users/vijaykota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vijaykota/subscriptions","organizations_url":"https://api.github.com/users/vijaykota/orgs","repos_url":"https://api.github.com/users/vijaykota/repos","events_url":"https://api.github.com/users/vijaykota/events{/privacy}","received_events_url":"https://api.github.com/users/vijaykota/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vijaykota/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/vijaykota/corefx","forks_url":"https://api.github.com/repos/vijaykota/corefx/forks","keys_url":"https://api.github.com/repos/vijaykota/corefx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vijaykota/corefx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vijaykota/corefx/teams","hooks_url":"https://api.github.com/repos/vijaykota/corefx/hooks","issue_events_url":"https://api.github.com/repos/vijaykota/corefx/issues/events{/number}","events_url":"https://api.github.com/repos/vijaykota/corefx/events","assignees_url":"https://api.github.com/repos/vijaykota/corefx/assignees{/user}","branches_url":"https://api.github.com/repos/vijaykota/corefx/branches{/branch}","tags_url":"https://api.github.com/repos/vijaykota/corefx/tags","blobs_url":"https://api.github.com/repos/vijaykota/corefx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vijaykota/corefx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vijaykota/corefx/git/refs{/sha}","trees_url":"https://api.github.com/repos/vijaykota/corefx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vijaykota/corefx/statuses/{sha}","languages_url":"https://api.github.com/repos/vijaykota/corefx/languages","stargazers_url":"https://api.github.com/repos/vijaykota/corefx/stargazers","contributors_url":"https://api.github.com/repos/vijaykota/corefx/contributors","subscribers_url":"https://api.github.com/repos/vijaykota/corefx/subscribers","subscription_url":"https://api.github.com/repos/vijaykota/corefx/subscription","commits_url":"https://api.github.com/repos/vijaykota/corefx/commits{/sha}","git_commits_url":"https://api.github.com/repos/vijaykota/corefx/git/commits{/sha}","comments_url":"https://api.github.com/repos/vijaykota/corefx/comments{/number}","issue_comment_url":"https://api.github.com/repos/vijaykota/corefx/issues/comments{/number}","contents_url":"https://api.github.com/repos/vijaykota/corefx/contents/{+path}","compare_url":"https://api.github.com/repos/vijaykota/corefx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vijaykota/corefx/merges","archive_url":"https://api.github.com/repos/vijaykota/corefx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vijaykota/corefx/downloads","issues_url":"https://api.github.com/repos/vijaykota/corefx/issues{/number}","pulls_url":"https://api.github.com/repos/vijaykota/corefx/pulls{/number}","milestones_url":"https://api.github.com/repos/vijaykota/corefx/milestones{/number}","notifications_url":"https://api.github.com/repos/vijaykota/corefx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vijaykota/corefx/labels{/name}","releases_url":"https://api.github.com/repos/vijaykota/corefx/releases{/id}","created_at":"2015-07-23T16:32:30Z","updated_at":"2015-07-23T16:32:47Z","pushed_at":"2015-07-28T05:16:52Z","git_url":"git://github.com/vijaykota/corefx.git","ssh_url":"git@github.com:vijaykota/corefx.git","clone_url":"https://github.com/vijaykota/corefx.git","svn_url":"https://github.com/vijaykota/corefx","homepage":"http://dotnet.github.io/core/","size":25359,"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":"196c8368b08b813bd768785a91e030ecc0be3f4f","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":26295345,"name":"corefx","full_name":"dotnet/corefx","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/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":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}","created_at":"2014-11-06T23:42:48Z","updated_at":"2015-07-28T21:33:18Z","pushed_at":"2015-07-29T03:39:06Z","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":"http://dotnet.github.io/core/","size":56135,"stargazers_count":8131,"watchers_count":8131,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1702,"mirror_url":null,"open_issues_count":517,"forks":1702,"open_issues":517,"watchers":8131,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/2473"},"html":{"href":"https://github.com/dotnet/corefx/pull/2473"},"issue":{"href":"https://api.github.com/repos/dotnet/corefx/issues/2473"},"comments":{"href":"https://api.github.com/repos/dotnet/corefx/issues/2473/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/2473/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corefx/pulls/2473/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corefx/statuses/ac4bf3eb90bf9255e64031c3d623b3443f349f7f"}}}}