在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:Redth/HttpTwo开源软件地址:https://github.com/Redth/HttpTwo开源编程语言:JavaScript 62.5%开源软件介绍:HttpTwoA fully managed C# HTTP/2 client library implementation The 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 It's currently not very well tested and lacks some implementation details. What's working:
What's not working / not implemented:
Reason for the Lack of ALPN Support The HTTP/2 RFC states that secure connections must use ALPN to negotiate the protocol. Unfortunately, .NET's In 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. Not much I can do about this currently. Using the Http2ClientThere's a // Uri to request
var uri = new Uri ("http://somesite.com:80/index.html");
// Create a Http2Client
var http2 = new Http2Client (uri);
// Specify any custom headers
var headers = new NameValueCollection ();
headers.Add ("some-header", "value");
// For some requests you may have a request body
byte[] data = null;
// Await our response
var response = await http2.Send (uri, HttpMethod.Get, headers, data);
// Response object has properties:
// HttpStatusCode Status
// HttpStream Stream (contains Frames history)
// NameValueCollection Headers
// byte[] Body
// ... Using the HttpClient APIFor some familiarity I've implemented a simple // Create our HttpTwo handler
var handler = new Http2MessageHandler ();
// Pass the handler into the HttpClient
var http = new HttpClient (handler);
var data = await http.GetStringAsync ("http://somesite.com:80/index.html"); Running TestsThere aren't very many tests right now, however all the tests require a local LicenseCopyright 2015-2016 Jonathan Dick Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. HPack CodeThis 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 Thanks @ringostarr80 ! |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论