2using System.Collections.Generic;
4using System.Net.Http.Headers;
5using System.Security.Cryptography.X509Certificates;
6using System.Threading.Tasks;
28 public override string[]
UriSchemes =>
new string[] {
"http",
"https" };
38 switch (Uri.Scheme.ToLower())
62 public override async Task<KeyValuePair<byte[], string>>
PutAsync(Uri Uri,
byte[] EncodedData,
string ContentType,
64 params KeyValuePair<string, string>[] Headers)
67 using (HttpClient HttpClient =
new HttpClient(Handler,
true)
69 Timeout = TimeSpan.FromMilliseconds(TimeoutMs)
72 using (HttpRequestMessage Request =
new HttpRequestMessage()
75 Method = HttpMethod.Put,
76 Content =
new ByteArrayContent(EncodedData)
79 Request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(ContentType);
80 WebGetter.PrepareHeaders(Request, Headers, Handler);
82 HttpResponseMessage Response = await HttpClient.SendAsync(Request);
Gets resources from the Web (i.e. using HTTP or HTTPS).
static HttpClientHandler GetClientHandler()
Gets a HTTP Client handler
Posts to resources on the Web (i.e. using HTTP or HTTPS).
static async Task< KeyValuePair< byte[], string > > ProcessResponse(HttpResponseMessage Response, Uri Uri)
Decodes a response from the web. If the response is a success, the decoded response is returned....
Abstract base class for putters.
Puts to resources on the Web (i.e. using HTTP or HTTPS).
override string[] UriSchemes
Supported URI schemes.
override async Task< KeyValuePair< byte[], string > > PutAsync(Uri Uri, byte[] EncodedData, string ContentType, X509Certificate Certificate, RemoteCertificateEventHandler RemoteCertificateValidator, int TimeoutMs, params KeyValuePair< string, string >[] Headers)
Puts to a resource, using a Uniform Resource Identifier (or Locator).
override bool CanPut(Uri Uri, out Grade Grade)
If the putter is able to put to a resource, given its URI.
WebPutter()
Puts to resources on the Web (i.e. using HTTP or HTTPS).
delegate void RemoteCertificateEventHandler(object Sender, RemoteCertificateEventArgs e)
Delegate for remote certificate event handlers.