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<ContentBinaryResponse>
PutAsync(Uri Uri,
byte[] EncodedData,
string ContentType,
63 X509Certificate Certificate, EventHandler<RemoteCertificateEventArgs> RemoteCertificateValidator,
int TimeoutMs,
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()
74 Method = HttpMethod.Put,
75 Content =
new ByteArrayContent(EncodedData)
79 Request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(ContentType);
82 HttpResponseMessage Response = await HttpClient.SendAsync(Request);
Gets resources from the Web (i.e. using HTTP or HTTPS).
static void PrepareHeaders(HttpRequestMessage Request, KeyValuePair< string, string >[] Headers, HttpClientHandler Handler)
Prepares headers for a HTTP request.
static HttpClientHandler GetClientHandler()
Gets a HTTP Client handler
static Uri CheckUri(Uri Uri, HttpRequestMessage Request)
Checks the URI, if it is suitable for processing, or if it needs to be modified.
Posts to resources on the Web (i.e. using HTTP or HTTPS).
static async Task< ContentBinaryResponse > 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< ContentBinaryResponse > PutAsync(Uri Uri, byte[] EncodedData, string ContentType, X509Certificate Certificate, EventHandler< RemoteCertificateEventArgs > 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).