{"id":18435,"date":"2013-05-22T17:24:00","date_gmt":"2013-05-22T17:24:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/dotnet\/2013\/05\/22\/portable-httpclient-is-now-available-as-rc\/"},"modified":"2021-10-04T12:35:27","modified_gmt":"2021-10-04T19:35:27","slug":"portable-httpclient-is-now-available-as-rc-2-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/portable-httpclient-is-now-available-as-rc-2-2\/","title":{"rendered":"Portable HttpClient is now available as RC"},"content":{"rendered":"<p>Three months ago <a href=\"http:\/\/blogs.msdn.com\/b\/bclteam\/archive\/2013\/02\/18\/portable-httpclient-for-net-framework-and-windows-phone.aspx\">we shipped the first preview of the portable HttpClient<\/a>. Many of you wondered when we would ship the RTM version. Today, we&rsquo;re happy to announce the first step towards an RTM: We shipped a release candidate (RC) of HttpClient (<a href=\"http:\/\/nuget.org\/packages\/Microsoft.Net.Http\/\">Microsoft.Net.Http package on NuGet<\/a>) that includes all the bug fixes since the preview.<\/p>\n<h2>New features<\/h2>\n<p>To address some of the platform differences in a portable fashion, we&rsquo;ve added new&nbsp;capability APIs.<\/p>\n<p><strong>HttpClientHandler.SupportsUseProxy()<\/strong>: The existing <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.http.httpclienthandler.supportsproxy.aspx\">HttpClientHandler.SupportsProxy<\/a> property indicates whether both the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.http.httpclienthandler.useproxy.aspx\">UseProxy<\/a> property and the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.http.httpclienthandler.proxy.aspx\">Proxy<\/a> property are supported. This created an issue because some platforms (for example, Windows Phone) don&rsquo;t allow you to configure a proxy explicitly. However, Windows Phone lets you control whether the machine wide proxy should be used. To model this behavior, we added the <strong>HttpClientHandler.SupportsUseProxy()<\/strong> extension method. For some platforms that don&rsquo;t support both, such as Windows Phone, the <strong>SupportsProxy<\/strong> property will continue to return false, but the <strong>SupportsUseProxy()<\/strong> method will return true.<\/p>\n<p><strong>HttpClientHandler.SupportsAllowAutoRedirect()<\/strong>: The <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.http.httpclienthandler.supportsredirectconfiguration.aspx\">HttpClientHandler.SupportsRedirectConfiguration<\/a> property had a similar issue: It controls whether both the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.http.httpclienthandler.allowautoredirect.aspx\">AllowAutoRedirect<\/a> and the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.http.httpclienthandler.maxautomaticredirections.aspx\">MaxAutomaticRedirections<\/a> properties are supported. Windows Phone doesn&rsquo;t support specifying the maximum number of automatic redirections, but it does support redirection. For that reason, we added the <strong>HttpClientHandler.SupportsAllowAutoRedirect()<\/strong> extension method.<\/p>\n<p>Here&#8217;s how you use these capability APIs:<\/p>\n<pre>HttpClientHandler handler = new HttpClientHandler();\n\n\/\/ Configure proxy (if supported)\nif (handler.SupportsUseProxy())\n    handler.UseProxy = true;\n\n\/\/ Allow automatic redirection (if supported)\nif (handler.SupportsAllowAutoRedirect())\n    handler.AllowAutoRedirect = true;<\/pre>\n<p>In case you are wondering why we added extension methods instead of regular properties: Some of the platforms that <strong>Microsoft.Net.Http<\/strong> supports already provide the <strong>HttpClientHandler<\/strong> class, which is used on those platforms. Since we can&rsquo;t modify the built-in version of the properties directly, we added extension methods that ship in a separate assembly with the NuGet package.<\/p>\n<h2>Bug fixes<\/h2>\n<p>All bug fixes are listed in the <a href=\"http:\/\/blogs.msdn.com\/b\/bclteam\/p\/httpclient.aspx\">release notes<\/a>. In this post, I&rsquo;d like to highlight just one:<\/p>\n<p style=\"padding-left: 30px\"><em>Issue: When consuming a portable class library that depends on HttpClient from a Windows Store application, the app can crash with a MissingMethodException.<\/em><\/p>\n<p>We&rsquo;ve fixed this bug by using the technique we explained in our <a href=\"http:\/\/blogs.msdn.com\/b\/bclteam\/archive\/2013\/04\/17\/microsoft-bcl-async-is-now-stable.aspx\">blog post about Microsoft.Bcl.Async<\/a>: We ensure during the build that the application has a reference to the NuGet package.<\/p>\n<h2>Future directions<\/h2>\n<p>This RC doesn&rsquo;t include support for the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/system.net.http.httpclienthandler.automaticdecompression.aspx\">HttpClientHandler.AutomaticDecompression<\/a> property. Many of you have asked for this support, and we certainly haven&rsquo;t ignored it or forgotten about it. In fact, <a href=\"http:\/\/social.msdn.microsoft.com\/Forums\/en-US\/wptools\/thread\/1fa78fca-5aae-436b-a9c0-0bafa5b78b14\/#5667f6af-21c5-4224-b2c3-400729bfbf14\">our original plan was<\/a> to ship another preview with support for automatic decompression, and then ship an RTM version a few weeks later. So why did we change our minds about it?<\/p>\n<p>We had two options:<\/p>\n<ol>\n<li>Block the release of HttpClient until automatic decompression is ready.<\/li>\n<li>Ship an interim release of HttpClient that doesn&rsquo;t have automatic decompression but is marked as a stable NuGet release and comes with a license that allows usage in production.<\/li>\n<\/ol>\n<p>We decided to go with the second option, because we believe it delivers functionality sooner to our customers. After all, that&#8217;s why we ship on NuGet, and we hope you agree.<\/p>\n<p>Let&rsquo;s recap why our team is investing so much in releasing components via NuGet. The reason is twofold:<\/p>\n<p>First, it allows bridging differences in functionality between platforms we already shipped. A good example is HttpClient, and also includes the <a href=\"http:\/\/blogs.msdn.com\/b\/bclteam\/archive\/2013\/04\/17\/microsoft-bcl-async-is-now-stable.aspx\">support for the async and await keywords<\/a>. Shipping features out of band also enables us to ship new functionality for multiple platforms via a single portable class library, without having to wait for any of the platforms to add that functionality.<\/p>\n<p>Second, our goal is to strengthen the feedback loop with you, our customers. In the past, we&rsquo;ve shipped &ldquo;big&rdquo; betas, like a beta of the entire .NET Framework. This approach certainly has some advantages, but we&rsquo;ve seen issues with it as well. The biggest downside is that &ldquo;big&rdquo; betas are pretty expensive to ship and are typically very close to RTM, which, in turn, means that we can&rsquo;t make impactful changes anymore. In fact, we have to turn down a large number of the bug reports we get in &ldquo;big&rdquo; betas, either because they affect a relatively small number of customers or because fixing the bugs would place the RTM release at risk. We&rsquo;re certainly not the first company running into this problem; there is an entire agile software development movement in our industry that focuses on this. I don&rsquo;t want to go into a philosophical discussion about agile methodologies, but it&rsquo;s pretty hard to disagree that shipping early and often helps with feedback loop issues.<\/p>\n<p>A good example where we use your feedback quite heavily is in the previews of i<a href=\"http:\/\/blogs.msdn.com\/b\/bclteam\/archive\/tags\/immutable\/\">mmutable collections<\/a>; in contrast to &ldquo;big&rdquo; betas, we were able to change the design of the APIs when we believe that&rsquo;s the correct approach.<\/p>\n<p>Unfortunately, shipping a constant stream of previews isn&rsquo;t necessarily a helpful solution in all scenarios. On certain platforms, such as the .NET Framework 4.5 and Windows Store, HttpClient is already available as a fully supported, RTM-quality component. For that reason, we can offer a preview of HttpClient only for Windows Phone today.<\/p>\n<p>Here are our tentative plans for future NuGet releases of HttpClient:<\/p>\n<ul>\n<li>Today: RC of HttpClient 2.1.<\/li>\n<li>Wednesday 5\/29: RTM of HttpClient 2.1. Yep, it&rsquo;s only a week away now, but it entirely depends on your feedback. If we find substantial issues, we might change the release date.<\/li>\n<li>Mid-June: Beta of HttpClient 2.2 with automatic decompression<\/li>\n<li>End of June: RC of HttpClient 2.2 with automatic decompression<\/li>\n<li>Around July (depending on feedback): RTM of HttpClient 2.2 with automatic decompression<\/li>\n<\/ul>\n<h2>Summary<\/h2>\n<p>We released an RC version of the <a href=\"http:\/\/nuget.org\/packages\/Microsoft.Net.Http\/\">Microsoft.Net.Http<\/a> NuGet package. We expect this to be the last preview of HttpClient before we ship an RTM. Please provide feedback if you find any issues.<\/p>\n<p>Of course, we&rsquo;d also love to hear from you if everything just works. After all, we&#8217;re happy if you&#8217;re happy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Three months ago we shipped the first preview of the portable HttpClient. Many of you wondered when we would ship the RTM version. Today, we&rsquo;re happy to announce the first step towards an RTM: We shipped a release candidate (RC) of HttpClient (Microsoft.Net.Http package on NuGet) that includes all the bug fixes since the preview. [&hellip;]<\/p>\n","protected":false},"author":335,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685],"tags":[43,104,110],"class_list":["post-18435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","tag-bcl","tag-nuget","tag-portable-class-libraries"],"acf":[],"blog_post_summary":"<p>Three months ago we shipped the first preview of the portable HttpClient. Many of you wondered when we would ship the RTM version. Today, we&rsquo;re happy to announce the first step towards an RTM: We shipped a release candidate (RC) of HttpClient (Microsoft.Net.Http package on NuGet) that includes all the bug fixes since the preview. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/18435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/335"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=18435"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/18435\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=18435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=18435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=18435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}