forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsyncUtils.cs
More file actions
45 lines (36 loc) · 1.13 KB
/
Copy pathAsyncUtils.cs
File metadata and controls
45 lines (36 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) ServiceStack, Inc. All Rights Reserved.
// License: https://raw.github.com/ServiceStack/ServiceStack/master/license.txt
/*
* Keep as much platform specific stuff here
*/
using System;
using System.IO;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
namespace ServiceStack
{
public interface ITimer : IDisposable
{
void Cancel();
}
public delegate void ProgressDelegate(long done, long total);
internal static class AsyncUtils
{
internal static HttpWebRequest CreateHttpWebRequest(this AsyncServiceClient client, string requestUri)
{
var webRequest = PclExport.Instance.CreateWebRequest(requestUri,
emulateHttpViaPost:client.EmulateHttpViaPost);
PclExport.Instance.Config(webRequest);
if (client.StoreCookies)
{
PclExportClient.Instance.SetCookieContainer(webRequest, client);
}
if (!client.DisableAutoCompression)
{
PclExport.Instance.AddCompression(webRequest);
}
return webRequest;
}
}
}