{"id":16687147,"url":"https://github.com/redth/httptwo","last_synced_at":"2025-04-05T05:02:42.924Z","repository":{"id":52569648,"uuid":"48619910","full_name":"Redth/HttpTwo","owner":"Redth","description":"A basic C# HTTP/2 client library","archived":false,"fork":false,"pushed_at":"2024-08-11T23:57:50.000Z","size":300,"stargazers_count":120,"open_issues_count":12,"forks_count":50,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-29T04:03:42.941Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Redth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-26T18:28:17.000Z","updated_at":"2024-09-10T17:04:12.000Z","dependencies_parsed_at":"2022-09-06T20:12:34.423Z","dependency_job_id":null,"html_url":"https://github.com/Redth/HttpTwo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Redth%2FHttpTwo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Redth%2FHttpTwo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Redth%2FHttpTwo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Redth%2FHttpTwo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Redth","download_url":"https://codeload.github.com/Redth/HttpTwo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289409,"owners_count":20914464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T15:07:58.929Z","updated_at":"2025-04-05T05:02:42.908Z","avatar_url":"https://github.com/Redth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HttpTwo\n\nA fully managed C# HTTP/2 client library implementation\n\nThe focus of this library is to bring enough HTTP/2 functionality to .NET for implementing the APNS (Apple Push Notification Service) provider API over HTTP/2 within [PushSharp](https://github.com/redth/pushsharp)\n\n[![Join the chat at https://gitter.im/Redth/HttpTwo](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Redth/HttpTwo?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n[![AppVeyor CI Status](https://ci.appveyor.com/api/projects/status/github/Redth/HttpTwo?svg=true)](https://ci.appveyor.com/project/Redth/httptwo)\n\nIt's currently not very well tested and lacks some implementation details.\n\n**What's working:**\n - All frame types can be parsed and can be generated to send to a stream\n - HPack for frames that send headers (thanks to @ringostarr80)\n - Flow control is implemented in theory but not well tested\n - WINDOW_UPDATEs on the connection level (not yet per stream)\n - Simple requests should work\n  \n**What's not working / not implemented:**\n - Missing sending of WINDOW_UPDATE frames for streams, but streams aren't very long lived yet so it shouldn't be too bad - except for when receiving large downloads/data sets from a request\n - No optimizations for large amounts of data sent/received (there may be a lot of request/response data that gets processed completely in memory currently)\n - Secure connections require TLS 1.2 according to the RFC so they won't work on Mono at this point\n - No ALPN support (see below)\n - Stream prioritization isn't implemented (you can still send Priority frames)\n - Push Promise isn't implemented, but you can tell the server it is disabled\n - Much more test coverage needed\n - No Upgrade support (only starting with prior knowledge in clear text)\n - HttpClient Support (Http2MessageHandler)\n   - Passes along all headers - might not make sense always\n\n**Reason for the Lack of ALPN Support**\n\nThe HTTP/2 RFC states that secure connections must use ALPN to negotiate the protocol.  Unfortunately, .NET's `SslStream` has no ability to specify application protocols as part of the TLS authentication, so it can't support ALPN.  There's an [issue tracking this on dotnetfx](https://github.com/dotnet/corefx/issues/4721) however it seems like this isn't going to happen very soon (especially on mono and .NET 4.x).\n\nIn practice, Apple does not enforce this ALPN negotiation on their APNS HTTP/2 servers, and given that they seem to use Netty, it's possible other servers will not require this either.\n\nNot much I can do about this currently.\n\n\n### Using the Http2Client\n\nThere's a `Http2Client` class that can be used to send requests and receive responses:\n\n```csharp\n// Uri to request\nvar uri = new Uri (\"http://somesite.com:80/index.html\");\n\n// Create a Http2Client\nvar http2 = new Http2Client (uri);\n\n// Specify any custom headers\nvar headers = new NameValueCollection ();\nheaders.Add (\"some-header\", \"value\");\n\n// For some requests you may have a request body\nbyte[] data = null; \n\n// Await our response\nvar response = await http2.Send (uri, HttpMethod.Get, headers, data); \n\n// Response object has properties:\n//  HttpStatusCode Status\n//  HttpStream Stream (contains Frames history)\n//  NameValueCollection Headers\n//  byte[] Body\n// ...\n```\n\n### Using the HttpClient API\n\nFor some familiarity I've implemented a simple `HttpMessageHandler` so that you can use the HttpClient API:\n\n```csharp\n// Create our HttpTwo handler\nvar handler = new Http2MessageHandler ();\n// Pass the handler into the HttpClient\nvar http = new HttpClient (handler);\n\nvar data = await http.GetStringAsync (\"http://somesite.com:80/index.html\");\n```\n\n### Running Tests\n\nThere aren't very many tests right now, however all the tests require a local `node-http2` server to be setup to run them.  To make this easier, the source is included in `HttpTwo.Tests/node-http2`.  Make sure you run `npm install` in that folder after check out before you start the NUnit tests (which will automatically launch the node server when you run the tests, and stop it when the tests have completed).\n\n### License\n\nCopyright 2015-2016 Jonathan Dick\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n\n### HPack Code\nThis library uses HPACK code which is licensed under Apache 2.0 and was borrowed from Ringo Leese's repository at: https://github.com/ringostarr80/hpack \n\nThanks @ringostarr80 !\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredth%2Fhttptwo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredth%2Fhttptwo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredth%2Fhttptwo/lists"}