diff --git a/src/CurlSharp/Callbacks/CurlEasyCallbacks.cs b/src/CurlSharp/Callbacks/CurlEasyCallbacks.cs
index 303b3789b..6f9cfb6bf 100644
--- a/src/CurlSharp/Callbacks/CurlEasyCallbacks.cs
+++ b/src/CurlSharp/Callbacks/CurlEasyCallbacks.cs
@@ -26,12 +26,16 @@ namespace CurlSharp
/// Debug information as a string.
///
/// -
+ /// size
+ /// The size in bytes.
+ ///
+ /// -
/// extraData
/// Client-provided extra data.
///
///
///
- public delegate void CurlDebugCallback(CurlInfoType infoType, String message, Object extraData);
+ public delegate void CurlDebugCallback(CurlInfoType infoType, String message, int size, Object extraData);
///
/// Called when cURL has header data for the client.
diff --git a/src/CurlSharp/Curl.cs b/src/CurlSharp/Curl.cs
index abb7de8c7..dd85332f0 100644
--- a/src/CurlSharp/Curl.cs
+++ b/src/CurlSharp/Curl.cs
@@ -2,7 +2,7 @@
*
* CurlS#arp
*
- * Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
*
* This software is licensed as described in the file LICENSE, which you
@@ -72,7 +72,7 @@ namespace CurlSharp
///
public static CurlCode GlobalInit(CurlInitFlag flags)
{
- _initCode = NativeMethods.curl_global_init((int)flags);
+ _initCode = NativeMethods.curl_global_init((int) flags);
#if USE_LIBCURLSHIM
if (_initCode == CurlCode.Ok)
NativeMethods.curl_shim_initialize();
@@ -99,48 +99,6 @@ namespace CurlSharp
}
}
- ///
- /// URL encode a String.
- ///
- /// The string to URL encode.
- ///
- /// Input string length;
- /// use 0 for cURL to determine.
- ///
- /// A new URL encoded string.
- ///
- /// Thrown if cURL isn't properly initialized.
- ///
- public static string Escape(string url, int length)
- {
- EnsureCurl();
- var p = NativeMethods.curl_escape(url, length);
- var s = Marshal.PtrToStringAnsi(p);
- NativeMethods.curl_free(p);
- return s;
- }
-
- ///
- /// URL decode a String.
- ///
- /// The string to URL decode.
- ///
- /// Input string length;
- /// use 0 for cURL to determine.
- ///
- /// A new URL decoded string.
- ///
- /// Thrown if cURL isn't properly initialized.
- ///
- public static string Unescape(string url, int length)
- {
- EnsureCurl();
- var p = NativeMethods.curl_unescape(url, length);
- var s = Marshal.PtrToStringAnsi(p);
- NativeMethods.curl_free(p);
- return s;
- }
-
///
/// Get a object.
///
diff --git a/src/CurlSharp/CurlEasy.cs b/src/CurlSharp/CurlEasy.cs
index 551996594..320e080d4 100644
--- a/src/CurlSharp/CurlEasy.cs
+++ b/src/CurlSharp/CurlEasy.cs
@@ -2,7 +2,7 @@
*
* CurlS#arp
*
- * Copyright (c) 2014 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
*
* This software is licensed as described in the file LICENSE, which you
@@ -56,7 +56,7 @@ namespace CurlSharp
private bool _cookieSession;
private CurlShare _curlShare;
private string _customRequest;
- private Object _debugData;
+ private object _debugData;
private int _dnsCacheTimeout;
private bool _dnsUseGlobalCache;
private string _egdSocket;
@@ -79,7 +79,7 @@ namespace CurlSharp
private bool _ftpUseEprt;
private bool _ftpUseEpsv;
private GCHandle _hThis;
- private Object _headerData;
+ private object _headerData;
private CurlHttpAuth _httpAuth;
private bool _httpGet;
private CurlHttpMultiPartForm _httpMultiPartForm;
@@ -88,10 +88,8 @@ namespace CurlSharp
private bool _ignoreContentLength;
private long _infileSize;
private string _interface;
- private Object _ioctlData;
+ private object _ioctlData;
private string _krb4Level;
- private CurlCode _lastErrorCode;
- private string _lastErrorDescription;
private int _lowSpeedLimit;
private int _lowSpeedTime;
private int _maxConnects;
@@ -118,6 +116,7 @@ namespace CurlSharp
private NativeMethods._CurlDebugCallback _pcbDebug;
private NativeMethods._CurlIoctlCallback _pcbIoctl;
private NativeMethods._CurlProgressCallback _pcbProgress;
+ private NativeMethods._CurlSslCtxCallback _pcbSslCtx;
#endif
private CurlDebugCallback _pfCurlDebug;
private CurlHeaderCallback _pfCurlHeader;
@@ -130,27 +129,27 @@ namespace CurlSharp
private bool _post;
private int _postFieldSize;
private string _postFields;
- private Object _privateData;
- private Object _progressData;
+ private object _progressData;
private string _proxy;
private int _proxyPort;
private string _proxyUserPwd;
private bool _put;
private string _randomFile;
private string _range;
- private Object _readData;
+ private object _readData;
private string _referer;
private int _resumeFrom;
private string _sourceUrl;
private string _sslCert;
private string _sslCertPasswd;
private string _sslCipherList;
- private Object _sslContextData;
+ private object _sslContextData;
private string _sslEngine;
private bool _sslEngineDefault;
private string _sslKey;
private string _sslKeyPasswd;
private bool _sslVerifyPeer;
+ private bool _sslVerifyHost;
private bool _tcpNoDelay;
private int _timeValue;
private int _timeout;
@@ -161,7 +160,7 @@ namespace CurlSharp
private string _userAgent;
private string _userPwd;
private bool _verbose;
- private Object _writeData;
+ private object _writeData;
private string _writeInfo;
///
@@ -180,6 +179,7 @@ namespace CurlSharp
Curl.EnsureCurl();
_pCurl = NativeMethods.curl_easy_init();
ensureHandle();
+ NativeMethods.curl_easy_setopt(_pCurl, CurlOption.NoSignal, 1L);
NativeMethods.curl_easy_setopt(_pCurl, CurlOption.NoProgress, IntPtr.Zero);
#if USE_LIBCURLSHIM
_pMyStrings = NativeMethods.curl_shim_alloc_strings();
@@ -199,11 +199,7 @@ namespace CurlSharp
installDelegates();
}
- public object Private
- {
- get { return _privateData; }
- set { _privateData = value; }
- }
+ public object Private { get; set; }
public object WriteData
{
@@ -227,6 +223,8 @@ namespace CurlSharp
///
private CurlCode setWriteData(object data)
{
+ freeHandle(ref _curlWriteData);
+
_curlWriteData = getHandle(data);
return setCurlOpt(_curlWriteData, CurlOption.WriteData);
}
@@ -292,6 +290,18 @@ namespace CurlSharp
return setCurlOpt(_curlDebugData, CurlOption.DebugData);
}
+ private IntPtr _curlSslCtxData = IntPtr.Zero;
+
+ ///
+ /// Object to pass to OnSslCtxCallback.
+ ///
+ ///
+ ///
+ private CurlCode setSslCtxData(object data)
+ {
+ _curlSslCtxData = getHandle(data);
+ return setCurlOpt(_curlSslCtxData, CurlOption.SslCtxData);
+ }
private IntPtr _curlIoctlData = IntPtr.Zero;
@@ -355,6 +365,17 @@ namespace CurlSharp
}
}
+ public object SslCtxData
+ {
+ get { return _sslContextData; }
+ set
+ {
+ _sslContextData = value;
+#if !USE_LIBCURLSHIM
+ setSslCtxData(value);
+#endif
+ }
+ }
public object IoctlData
{
@@ -426,7 +447,7 @@ namespace CurlSharp
_ftpAuth = value;
var l = Convert.ToInt32(value);
setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.FtpSslAuth, (IntPtr) l),
- CurlOption.FtpSslAuth);
+ CurlOption.FtpSslAuth);
}
}
@@ -438,7 +459,7 @@ namespace CurlSharp
_httpVersion = value;
var l = Convert.ToInt32(value);
setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.HttpVersion, (IntPtr) l),
- CurlOption.HttpVersion);
+ CurlOption.HttpVersion);
}
}
@@ -450,7 +471,7 @@ namespace CurlSharp
_httpAuth = value;
var l = Convert.ToInt32(value);
setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.HttpAuth, (IntPtr) l),
- CurlOption.HttpAuth);
+ CurlOption.HttpAuth);
}
}
@@ -462,7 +483,7 @@ namespace CurlSharp
_ftpSsl = value;
var l = Convert.ToInt32(value);
setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.FtpSsl, (IntPtr) l),
- CurlOption.FtpSsl);
+ CurlOption.FtpSsl);
}
}
@@ -474,7 +495,7 @@ namespace CurlSharp
_closePolicy = value;
var l = Convert.ToInt32(value);
setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.ClosePolicy, (IntPtr) l),
- CurlOption.ClosePolicy);
+ CurlOption.ClosePolicy);
}
}
@@ -514,12 +535,14 @@ namespace CurlSharp
set { setFunctionOptions(CurlOption.IoctlFunction, value); }
}
-
- public string LastErrorDescription
+ public CurlSslContextCallback SslContextFunction
{
- get { return _lastErrorDescription; }
+ get { return _pfCurlSslContext; }
+ set { setFunctionOptions(CurlOption.SslCtxFunction, value); }
}
+ public string LastErrorDescription { get; private set; }
+
public bool NoProgress
{
get { return _noProgress; }
@@ -592,6 +615,12 @@ namespace CurlSharp
set { setBoolOption(CurlOption.SslVerifyPeer, ref _sslVerifyPeer, value); }
}
+ public bool SslVerifyhost
+ {
+ get { return _sslVerifyHost; }
+ set { setBoolOption(CurlOption.SslVerifyhost, ref _sslVerifyHost, value); }
+ }
+
public bool FreshConnect
{
get { return _freshConnect; }
@@ -1106,10 +1135,7 @@ namespace CurlSharp
get { return getSlistInfo(CurlInfo.SslEngines); }
}
- public CurlCode LastErrorCode
- {
- get { return _lastErrorCode; }
- }
+ public CurlCode LastErrorCode { get; private set; }
///
/// Cleanup unmanaged resources.
@@ -1122,7 +1148,7 @@ namespace CurlSharp
private void resetPrivateVariables()
{
- _privateData = null;
+ Private = null;
_pfCurlWrite = null;
_writeData = null;
@@ -1179,10 +1205,10 @@ namespace CurlSharp
///
private void setLastError(CurlCode code, CurlOption opt)
{
- if (LastErrorCode == CurlCode.Ok && code != CurlCode.Ok)
+ if ((LastErrorCode == CurlCode.Ok) && (code != CurlCode.Ok))
{
- _lastErrorCode = code;
- _lastErrorDescription = string.Format("Error: {0} setting option {1}", StrError(code), opt);
+ LastErrorCode = code;
+ LastErrorDescription = string.Format("Error: {0} setting option {1}", StrError(code), opt);
}
}
@@ -1191,10 +1217,10 @@ namespace CurlSharp
///
private void setLastError(CurlCode code, CurlInfo info)
{
- if (LastErrorCode == CurlCode.Ok && code != CurlCode.Ok)
+ if ((LastErrorCode == CurlCode.Ok) && (code != CurlCode.Ok))
{
- _lastErrorCode = code;
- _lastErrorDescription = string.Format("Error: {0} getting info {1}", StrError(code), info);
+ LastErrorCode = code;
+ LastErrorDescription = string.Format("Error: {0} getting info {1}", StrError(code), info);
}
}
@@ -1233,6 +1259,7 @@ namespace CurlSharp
freeHandle(ref _curlProgressData);
freeHandle(ref _curlHeaderData);
freeHandle(ref _curlIoctlData);
+ freeHandle(ref _curlSslCtxData);
#endif
NativeMethods.curl_easy_cleanup(_pCurl);
@@ -1293,6 +1320,12 @@ namespace CurlSharp
private void setStringOption(CurlOption option, out string field, string value)
{
+ // all string options are copied by the library, the only exception to this rule is PostFields option
+ if (option == CurlOption.PostFields)
+ option = CurlOption.CopyPostFields;
+ if ((option == CurlOption.CopyPostFields) && (PostFieldSize == 0))
+ PostFieldSize = System.Text.Encoding.UTF8.GetByteCount(value);
+
setStringOption(option, value);
field = value;
}
@@ -1313,7 +1346,13 @@ namespace CurlSharp
#else
// convert the string to a null-terminated one
var buffer = System.Text.Encoding.UTF8.GetBytes(value + "\0");
- setLastError(NativeMethods.curl_easy_setopt(_pCurl, option, buffer), option);
+ unsafe
+ {
+ fixed (byte* bufPtr = &buffer[0])
+ {
+ setLastError(NativeMethods.curl_easy_setopt(_pCurl, option, buffer), option);
+ }
+ }
#endif
}
}
@@ -1337,7 +1376,7 @@ namespace CurlSharp
///
/// will be returned if the type of value of parameter is invalid.
///
- public CurlCode SetOpt(CurlOption option, Object parameter)
+ public CurlCode SetOpt(CurlOption option, object parameter)
{
ensureHandle();
var retCode = CurlCode.Ok;
@@ -1346,10 +1385,8 @@ namespace CurlSharp
if ((int) option < CURLOPTTYPE_OBJECTPOINT)
{
var i = 0;
- if (option == CurlOption.DnsUseGlobalCache || option == CurlOption.SourcePort)
- {
+ if ((option == CurlOption.DnsUseGlobalCache) || (option == CurlOption.SourcePort))
return CurlCode.BadFunctionArgument;
- }
if (option == CurlOption.TimeValue)
{
@@ -1365,17 +1402,17 @@ namespace CurlSharp
retCode = NativeMethods.curl_easy_setopt(_pCurl, option, (IntPtr) i);
}
- // object cases: the majority
+ // object cases: the majority
else if ((int) option < CURLOPTTYPE_FUNCTIONPOINT)
{
return setObjectOptions(option, parameter);
}
- // FUNCTIONPOINT args, for delegates
+ // FUNCTIONPOINT args, for delegates
else if ((int) option < CURLOPTTYPE_OFF_T)
{
return setFunctionOptions(option, parameter);
}
- // otherwise, it's one of those 64-bit off_t guys!
+ // otherwise, it's one of those 64-bit off_t guys!
else
{
var i = Convert.ToInt64(parameter);
@@ -1390,9 +1427,9 @@ namespace CurlSharp
var retCode = CurlCode.Ok;
switch (option)
{
- // various data items
+ // various data items
case CurlOption.Private:
- _privateData = parameter;
+ Private = parameter;
break;
case CurlOption.WriteData:
_writeData = parameter;
@@ -1409,12 +1446,15 @@ namespace CurlSharp
case CurlOption.HeaderData:
_headerData = parameter;
break;
+ case CurlOption.SslCtxData:
+ _sslContextData = parameter;
+ break;
case CurlOption.IoctlData:
_ioctlData = parameter;
break;
- // items that can't be set externally or
- // obsolete items
+ // items that can't be set externally or
+ // obsolete items
case CurlOption.ErrorBuffer:
case CurlOption.Stderr:
case CurlOption.SourceHost:
@@ -1422,7 +1462,7 @@ namespace CurlSharp
case CurlOption.PasvHost:
return CurlCode.BadFunctionArgument;
- // singular case for share
+ // singular case for share
case CurlOption.Share:
{
_curlShare = parameter as CurlShare;
@@ -1430,7 +1470,7 @@ namespace CurlSharp
break;
}
- // multipart HTTP post
+ // multipart HTTP post
case CurlOption.HttpPost:
{
_httpMultiPartForm = parameter as CurlHttpMultiPartForm;
@@ -1438,7 +1478,7 @@ namespace CurlSharp
break;
}
- // items curl wants as a curl_slist
+ // items curl wants as a curl_slist
case CurlOption.HttpHeader:
case CurlOption.Prequote:
case CurlOption.Quote:
@@ -1452,12 +1492,12 @@ namespace CurlSharp
break;
}
- // string items
+ // string items
default:
{
var s = parameter as string;
setStringOption(option, s);
- retCode = _lastErrorCode;
+ retCode = LastErrorCode;
break;
}
}
@@ -1560,6 +1600,14 @@ namespace CurlSharp
break;
}
+ case CurlOption.SslCtxFunction:
+ {
+ var sf = pfn as CurlSslContextCallback;
+ if (sf == null)
+ return CurlCode.BadFunctionArgument;
+ _pfCurlSslContext = sf;
+ break;
+ }
case CurlOption.IoctlFunction:
{
@@ -1590,7 +1638,13 @@ namespace CurlSharp
public CurlCode Perform()
{
ensureHandle();
- return NativeMethods.curl_easy_perform(_pCurl);
+
+ var nativeRet = NativeMethods.curl_easy_perform(_pCurl);
+#if !USE_LIBCURLSHIM
+ freeHandle(ref _curlWriteData);
+#endif
+
+ return nativeRet;
}
///
@@ -1606,12 +1660,60 @@ namespace CurlSharp
return new CurlEasy(this);
}
+ ///
+ /// URL encode a String.
+ ///
+ /// The string to URL encode.
+ ///
+ /// Input string length;
+ /// use 0 for cURL to determine.
+ ///
+ /// A new URL encoded string.
+ ///
+ /// This is thrown if
+ /// the native CURL* handle wasn't created successfully.
+ ///
+ public string Escape(string url)
+ {
+ ensureHandle();
+
+ var length = System.Text.Encoding.ASCII.GetBytes(url).Length;
+ var p = NativeMethods.curl_easy_escape(_pCurl, url, length);
+ var s = Marshal.PtrToStringAnsi(p);
+ NativeMethods.curl_free(p);
+ return s;
+ }
+
+ ///
+ /// URL decode a String.
+ ///
+ /// The string to URL decode.
+ ///
+ /// Input string length;
+ /// use 0 for cURL to determine.
+ ///
+ /// A new URL decoded string.
+ ///
+ /// This is thrown if
+ /// the native CURL* handle wasn't created successfully.
+ ///
+ public string Unescape(string url)
+ {
+ ensureHandle();
+
+ var length = System.Text.Encoding.ASCII.GetBytes(url).Length;
+ var p = NativeMethods.curl_easy_unescape(_pCurl, url, length, out int outLength);
+ var s = Marshal.PtrToStringAnsi(p, outLength);
+ NativeMethods.curl_free(p);
+ return s;
+ }
+
///
/// Get a string description of an error code.
///
/// Error code.
/// String description of the error code.
- public String StrError(CurlCode code)
+ public string StrError(CurlCode code)
{
return Marshal.PtrToStringAnsi(NativeMethods.curl_easy_strerror(code));
}
@@ -1635,7 +1737,7 @@ namespace CurlSharp
/// This is thrown if
/// the native CURL* handle wasn't created successfully.
///
- public CurlCode GetInfo(CurlInfo info, ref Object objInfo)
+ public CurlCode GetInfo(CurlInfo info, ref object objInfo)
{
ensureHandle();
var retCode = CurlCode.Ok;
@@ -1651,7 +1753,7 @@ namespace CurlSharp
// private data
if (info == CurlInfo.Private)
{
- objInfo = _privateData;
+ objInfo = Private;
return retCode;
}
@@ -1681,7 +1783,7 @@ namespace CurlSharp
{
ensureHandle();
// ensure it's an integral type
- if ((int) info < CURLINFO_LONG || (int) info >= CURLINFO_DOUBLE)
+ if (((int) info < CURLINFO_LONG) || ((int) info >= CURLINFO_DOUBLE))
{
setLastError(CurlCode.BadFunctionArgument, info);
return -1;
@@ -1779,7 +1881,7 @@ namespace CurlSharp
var retCode = CurlCode.Ok;
var ptr = IntPtr.Zero;
- if ((int) info < CURLINFO_STRING || (int) info >= CURLINFO_LONG)
+ if (((int) info < CURLINFO_STRING) || ((int) info >= CURLINFO_LONG))
return CurlCode.BadFunctionArgument;
retCode = NativeMethods.curl_easy_getinfo(_pCurl, info, ref ptr);
if (retCode == CurlCode.Ok)
@@ -1839,7 +1941,7 @@ namespace CurlSharp
var ptr = IntPtr.Zero;
// ensure it's an integral type
- if ((int) info < CURLINFO_LONG || (int) info >= CURLINFO_DOUBLE)
+ if (((int) info < CURLINFO_LONG) || ((int) info >= CURLINFO_DOUBLE))
return CurlCode.BadFunctionArgument;
retCode = NativeMethods.curl_easy_getinfo(_pCurl, info, ref ptr);
@@ -1876,10 +1978,8 @@ namespace CurlSharp
retCode = NativeMethods.curl_easy_getinfo(_pCurl, info, ref ptr);
if (retCode == CurlCode.Ok)
- {
if ((int) ptr < 0)
dt = new DateTime(0);
- }
return retCode;
}
@@ -1908,34 +2008,38 @@ namespace CurlSharp
_pcbProgress = _curlProgressCallback;
_pcbDebug = _curlDebugCallback;
_pcbHeader = _curlHeaderCallback;
+ _pcbSslCtx = _curlSslCtxCallback;
_pcbIoctl = _curlIoctlCallback;
- setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.WriteFunction, _pcbWrite),
- CurlOption.WriteFunction);
- setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.ReadFunction, _pcbRead),
- CurlOption.ReadFunction);
- setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.ProgressFunction, _pcbProgress),
- CurlOption.ProgressFunction);
- setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.HeaderFunction, _pcbHeader),
- CurlOption.HeaderFunction);
- setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.DebugFunction, _pcbDebug),
- CurlOption.DebugFunction);
- setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.IoctlFunction, _pcbIoctl),
- CurlOption.IoctlFunction);
+ setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.WriteFunction, _pcbWrite),
+ CurlOption.WriteFunction);
+ setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.ReadFunction, _pcbRead),
+ CurlOption.ReadFunction);
+ setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.ProgressFunction, _pcbProgress),
+ CurlOption.ProgressFunction);
+ setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.HeaderFunction, _pcbHeader),
+ CurlOption.HeaderFunction);
+ setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.DebugFunction, _pcbDebug),
+ CurlOption.DebugFunction);
+ setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.SslCtxFunction, _pcbSslCtx),
+ CurlOption.SslCtxFunction);
+ setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.IoctlFunction, _pcbIoctl),
+ CurlOption.IoctlFunction);
setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.NoProgress, (IntPtr) 0),
- CurlOption.NoProgress);
+ CurlOption.NoProgress);
setWriteData(null);
setReadData(null);
setHeaderData(null);
setProgressData(null);
setDebugData(null);
+ setSslCtxData(null);
setIoctlData(null);
#endif
}
#if USE_LIBCURLSHIM
- // called by libcurlshim
+ // called by libcurlshim
private static int _shimWriteCallback(IntPtr buf, int sz, int nmemb, IntPtr parm)
{
var bytes = sz*nmemb;
@@ -1958,9 +2062,7 @@ namespace CurlSharp
var b = new byte[bytes];
var gch = (GCHandle) parm;
var curlEasy = (CurlEasy) gch.Target;
- if (curlEasy == null)
- return 0;
- if (curlEasy._pfCurlRead == null)
+ if (curlEasy?._pfCurlRead == null)
return 0;
var nRead = curlEasy._pfCurlRead(b, sz, nmemb, curlEasy._readData);
if (nRead > 0)
@@ -1976,9 +2078,7 @@ namespace CurlSharp
{
var gch = (GCHandle) parm;
var curlEasy = (CurlEasy) gch.Target;
- if (curlEasy == null)
- return 0;
- if (curlEasy._pfCurlProgress == null)
+ if (curlEasy?._pfCurlProgress == null)
return 0;
var nprog = curlEasy._pfCurlProgress(curlEasy._progressData, dlTotal, dlNow, ulTotal, ulNow);
return nprog;
@@ -1989,12 +2089,10 @@ namespace CurlSharp
{
var gch = (GCHandle) parm;
var curlEasy = (CurlEasy) gch.Target;
- if (curlEasy == null)
- return 0;
- if (curlEasy._pfCurlDebug == null)
+ if (curlEasy?._pfCurlDebug == null)
return 0;
var message = Marshal.PtrToStringAnsi(msgBuf, msgBufSize);
- curlEasy._pfCurlDebug(infoType, message, curlEasy._debugData);
+ curlEasy._pfCurlDebug(infoType, message, msgBufSize, curlEasy._debugData);
return 0;
}
@@ -2079,7 +2177,7 @@ namespace CurlSharp
if (_pfCurlDebug != null)
{
var userdata = getObject(pUserData);
- _pfCurlDebug(infoType, message, userdata);
+ _pfCurlDebug(infoType, message, size, userdata);
}
return 0;
}
@@ -2107,7 +2205,7 @@ namespace CurlSharp
private CurlIoError _curlIoctlCallback(CurlIoCommand cmd, IntPtr parm)
{
- if (_pfCurlIoctl == null || _ioctlData == null)
+ if ((_pfCurlIoctl == null) || (_ioctlData == null))
return CurlIoError.UnknownCommand;
return _pfCurlIoctl(cmd, _ioctlData);
}
diff --git a/src/CurlSharp/CurlHttpMultiPartForm.cs b/src/CurlSharp/CurlHttpMultiPartForm.cs
index 6f814cbd1..5d99cd2eb 100644
--- a/src/CurlSharp/CurlHttpMultiPartForm.cs
+++ b/src/CurlSharp/CurlHttpMultiPartForm.cs
@@ -2,7 +2,7 @@
*
* CurlS#arp
*
- * Copyright (c) 2014 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
*
* This software is licensed as described in the file LICENSE, which you
@@ -31,7 +31,7 @@ namespace CurlSharp
public CurlFormOption Option;
/// Value for the option.
- public Object Value;
+ public object Value;
}
///
@@ -77,10 +77,7 @@ namespace CurlSharp
}
// for CurlEasy.SetOpt()
- internal IntPtr GetHandle()
- {
- return _pItems[0];
- }
+ internal IntPtr GetHandle() => _pItems[0];
///
/// Add a multi-part form section.
@@ -186,7 +183,7 @@ namespace CurlSharp
var formArrayPos = 0;
var argArrayPos = 0;
var ptrArrayPos = 0;
- Object obj = null;
+ object obj = null;
while ((retCode == CurlFormCode.Ok) &&
(ptrArrayPos < nRealCount))
@@ -207,14 +204,14 @@ namespace CurlSharp
{
iCode = (CurlFormOption) Convert.ToInt32(
args.GetValue(argArrayPos++));
- obj = (iCode == CurlFormOption.End)
+ obj = iCode == CurlFormOption.End
? null
: args.GetValue(argArrayPos++);
}
switch (iCode)
{
- // handle byte-array pointer-related items
+ // handle byte-array pointer-related items
case CurlFormOption.PtrName:
case CurlFormOption.PtrContents:
case CurlFormOption.BufferPtr:
@@ -240,7 +237,7 @@ namespace CurlSharp
break;
}
- // length values
+ // length values
case CurlFormOption.NameLength:
case CurlFormOption.ContentsLength:
case CurlFormOption.BufferLength:
@@ -249,7 +246,7 @@ namespace CurlSharp
Convert.ToInt32(obj);
break;
- // strings
+ // strings
case CurlFormOption.CopyName:
case CurlFormOption.CopyContents:
case CurlFormOption.FileContent:
@@ -259,7 +256,7 @@ namespace CurlSharp
case CurlFormOption.Buffer:
{
aPointers[ptrArrayPos++] = (IntPtr) iCode;
- var s = obj as String;
+ var s = obj as string;
if (s == null)
retCode = CurlFormCode.UnknownOption;
else
@@ -273,7 +270,7 @@ namespace CurlSharp
break;
}
- // array case: already handled
+ // array case: already handled
case CurlFormOption.Array:
if (aForms != null)
retCode = CurlFormCode.IllegalArray;
@@ -285,7 +282,7 @@ namespace CurlSharp
}
break;
- // slist
+ // slist
case CurlFormOption.ContentHeader:
{
aPointers[ptrArrayPos++] = (IntPtr) iCode;
@@ -297,12 +294,12 @@ namespace CurlSharp
break;
}
- // erroneous stuff
+ // erroneous stuff
case CurlFormOption.Nothing:
retCode = CurlFormCode.Incomplete;
break;
- // end
+ // end
case CurlFormOption.End:
if (aForms != null) // end of form
{
@@ -313,7 +310,7 @@ namespace CurlSharp
aPointers[ptrArrayPos++] = (IntPtr) iCode;
break;
- // default is unknown
+ // default is unknown
default:
retCode = CurlFormCode.UnknownOption;
break;
@@ -331,9 +328,9 @@ namespace CurlSharp
retCode = (CurlFormCode) NativeMethods.curl_shim_formadd(_pItems, aPointers, nRealCount);
#else
retCode = (CurlFormCode) NativeMethods.curl_formadd(ref _pItems[0], ref _pItems[1],
- (int) aPointers[0], aPointers[1],
- (int) aPointers[2], aPointers[3],
- (int) aPointers[4]);
+ (int) aPointers[0], aPointers[1],
+ (int) aPointers[2], aPointers[3],
+ (int) aPointers[4]);
#endif
}
@@ -350,7 +347,7 @@ namespace CurlSharp
case CurlFormOption.ContentType:
case CurlFormOption.Filename:
case CurlFormOption.Buffer:
- // byte buffer cases
+ // byte buffer cases
case CurlFormOption.PtrName:
case CurlFormOption.PtrContents:
case CurlFormOption.BufferPtr:
diff --git a/src/CurlSharp/CurlMulti.cs b/src/CurlSharp/CurlMulti.cs
index d2f7dfd6b..510b9f9a0 100644
--- a/src/CurlSharp/CurlMulti.cs
+++ b/src/CurlSharp/CurlMulti.cs
@@ -2,7 +2,7 @@
*
* CurlS#arp
*
- * Copyright (c) 2014 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
*
* This software is licensed as described in the file LICENSE, which you
@@ -39,6 +39,7 @@ namespace CurlSharp
private NativeMethods.fd_set _fd_read, _fd_write, _fd_except;
#endif
private IntPtr _pMulti;
+ private CurlPipelining _pipelining;
///
/// Constructor
@@ -74,10 +75,7 @@ namespace CurlSharp
///
/// Max file descriptor
///
- public int MaxFd
- {
- get { return _maxFd; }
- }
+ public int MaxFd => _maxFd;
///
/// Cleanup unmanaged resources.
@@ -149,6 +147,17 @@ namespace CurlSharp
return NativeMethods.curl_multi_add_handle(_pMulti, p);
}
+ public CurlPipelining Pipelining
+ {
+ get { return _pipelining; }
+ set
+ {
+ ensureHandle();
+ _pipelining = value;
+ NativeMethods.curl_multi_setopt(_pMulti, CurlMultiOption.Pipelining, (long) value);
+ }
+ }
+
///
/// Remove an CurlEasy object.
///
@@ -178,10 +187,7 @@ namespace CurlSharp
/// string description.
///
/// The string description.
- public String StrError(CurlMultiCode errorNum)
- {
- return Marshal.PtrToStringAnsi(NativeMethods.curl_multi_strerror(errorNum));
- }
+ public string StrError(CurlMultiCode errorNum) => Marshal.PtrToStringAnsi(NativeMethods.curl_multi_strerror(errorNum));
///
/// Read/write data to/from each CurlEasy object.
@@ -269,8 +275,6 @@ namespace CurlSharp
if (_bGotMultiInfo)
return _multiInfo;
- _bGotMultiInfo = true;
-
#if USE_LIBCURLSHIM
var nMsgs = 0;
var pInfo = NativeMethods.curl_shim_multi_info_read(_pMulti, ref nMsgs);
@@ -286,17 +290,12 @@ namespace CurlSharp
}
NativeMethods.curl_shim_multi_info_free(pInfo);
}
-
- return _multiInfo;
-
+ _bGotMultiInfo = true;
#else
-
- throw new NotImplementedException(
- "Sorry, CurlMulti.InfoRead is not implemented on this system."
- );
-
+ _multiInfo = null;
+ throw new NotImplementedException("CurlMulti.InfoRead()");
#endif
-
+ return _multiInfo;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/CurlSharp/CurlMultiInfo.cs b/src/CurlSharp/CurlMultiInfo.cs
index aa9ab9a44..febd8f7df 100644
--- a/src/CurlSharp/CurlMultiInfo.cs
+++ b/src/CurlSharp/CurlMultiInfo.cs
@@ -2,7 +2,7 @@
*
* CurlS#arp
*
- * Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
*
* This software is licensed as described in the file LICENSE, which you
@@ -26,40 +26,28 @@ namespace CurlSharp
public sealed class CurlMultiInfo
{
// private members
- private readonly CurlEasy _mCurlEasy;
- private readonly CurlMessage _msg;
- private readonly CurlCode _result;
internal CurlMultiInfo(CurlMessage msg, CurlEasy curlEasy, CurlCode result)
{
- _msg = msg;
- _mCurlEasy = curlEasy;
- _result = result;
+ Msg = msg;
+ CurlEasyHandle = curlEasy;
+ Result = result;
}
///
/// Get the status code from the enumeration.
///
- public CurlMessage Msg
- {
- get { return _msg; }
- }
+ public CurlMessage Msg { get; }
///
/// Get the object for this child.
///
- public CurlEasy CurlEasyHandle
- {
- get { return _mCurlEasy; }
- }
+ public CurlEasy CurlEasyHandle { get; }
///
/// Get the return code for the transfer, as a
/// .
///
- public CurlCode Result
- {
- get { return _result; }
- }
+ public CurlCode Result { get; }
}
}
\ No newline at end of file
diff --git a/src/CurlSharp/CurlShare.cs b/src/CurlSharp/CurlShare.cs
index 636f35c84..237f06507 100644
--- a/src/CurlSharp/CurlShare.cs
+++ b/src/CurlSharp/CurlShare.cs
@@ -31,17 +31,12 @@ namespace CurlSharp
{
// private members
private GCHandle _hThis; // for handle extraction
- private CurlShareCode _lastErrorCode;
- private string _lastErrorDescription;
#if USE_LIBCURLSHIM
private NativeMethods._ShimLockCallback _pDelLock; // lock delegate
private NativeMethods._ShimUnlockCallback _pDelUnlock; // unlock delegate
#endif
private IntPtr _pShare; // share handle
- private CurlShareLockCallback _pfLock; // client lock delegate
- private CurlShareUnlockCallback _pfUnlock; // client unlock delegate
private IntPtr _ptrThis; // numeric handle
- private Object _userData; // user data for delegates
///
/// Constructor
@@ -65,23 +60,11 @@ namespace CurlSharp
installDelegates();
}
- public object UserData
- {
- get { return _userData; }
- set { _userData = value; }
- }
+ public object UserData { get; set; }
- public CurlShareUnlockCallback UnlockFunction
- {
- get { return _pfUnlock; }
- set { _pfUnlock = value; }
- }
+ public CurlShareUnlockCallback UnlockFunction { get; set; }
- public CurlShareLockCallback LockFunction
- {
- get { return _pfLock; }
- set { _pfLock = value; }
- }
+ public CurlShareLockCallback LockFunction { get; set; }
public CurlLockData Share
{
@@ -93,15 +76,9 @@ namespace CurlSharp
set { setShareOption(CurlShareOption.Unshare, value); }
}
- public CurlShareCode LastErrorCode
- {
- get { return _lastErrorCode; }
- }
+ public CurlShareCode LastErrorCode { get; private set; }
- public string LastErrorDescription
- {
- get { return _lastErrorDescription; }
- }
+ public string LastErrorDescription { get; private set; }
///
/// Cleanup unmanaged resources.
@@ -140,7 +117,7 @@ namespace CurlSharp
/// This is thrown if
/// the native share handle wasn't created successfully.
///
- public CurlShareCode SetOpt(CurlShareOption option, Object parameter)
+ public CurlShareCode SetOpt(CurlShareOption option, object parameter)
{
EnsureHandle();
var retCode = CurlShareCode.Ok;
@@ -151,14 +128,14 @@ namespace CurlSharp
var lf = parameter as CurlShareLockCallback;
if (lf == null)
return CurlShareCode.BadOption;
- _pfLock = lf;
+ LockFunction = lf;
break;
case CurlShareOption.UnlockFunction:
var ulf = parameter as CurlShareUnlockCallback;
if (ulf == null)
return CurlShareCode.BadOption;
- _pfUnlock = ulf;
+ UnlockFunction = ulf;
break;
case CurlShareOption.Share:
@@ -170,7 +147,7 @@ namespace CurlSharp
}
case CurlShareOption.UserData:
- _userData = parameter;
+ UserData = parameter;
break;
default:
@@ -182,10 +159,10 @@ namespace CurlSharp
private void setLastError(CurlShareCode code, CurlShareOption opt)
{
- if (_lastErrorCode == CurlShareCode.Ok && code != CurlShareCode.Ok)
+ if ((LastErrorCode == CurlShareCode.Ok) && (code != CurlShareCode.Ok))
{
- _lastErrorCode = code;
- _lastErrorDescription = string.Format("Error: {0} setting option {1}", StrError(code), opt);
+ LastErrorCode = code;
+ LastErrorDescription = $"Error: {StrError(code)} setting option {opt}";
}
}
@@ -206,10 +183,8 @@ namespace CurlSharp
/// string description.
///
/// The string description.
- public String StrError(CurlShareCode errorNum)
- {
- return Marshal.PtrToStringAnsi(NativeMethods.curl_share_strerror(errorNum));
- }
+ public string StrError(CurlShareCode errorNum)
+ => Marshal.PtrToStringAnsi(NativeMethods.curl_share_strerror(errorNum));
private void Dispose(bool disposing)
{
@@ -229,10 +204,7 @@ namespace CurlSharp
}
}
- internal IntPtr GetHandle()
- {
- return _pShare;
- }
+ internal IntPtr GetHandle() => _pShare;
private void EnsureHandle()
{
@@ -243,7 +215,7 @@ namespace CurlSharp
private void installDelegates()
{
_hThis = GCHandle.Alloc(this);
- _ptrThis = (IntPtr)_hThis;
+ _ptrThis = (IntPtr) _hThis;
#if USE_LIBCURLSHIM
_pDelLock = LockDelegate;
_pDelUnlock = UnlockDelegate;
@@ -255,22 +227,14 @@ namespace CurlSharp
{
var gch = (GCHandle) userPtr;
var share = (CurlShare) gch.Target;
- if (share == null)
- return;
- if (share.LockFunction == null)
- return;
- share.LockFunction((CurlLockData) data, (CurlLockAccess) access, share.UserData);
+ share?.LockFunction?.Invoke((CurlLockData) data, (CurlLockAccess) access, share.UserData);
}
internal static void UnlockDelegate(int data, IntPtr userPtr)
{
var gch = (GCHandle) userPtr;
var share = (CurlShare) gch.Target;
- if (share == null)
- return;
- if (share.UnlockFunction == null)
- return;
- share.UnlockFunction((CurlLockData) data, share.UserData);
+ share?.UnlockFunction?.Invoke((CurlLockData) data, share.UserData);
}
}
}
\ No newline at end of file
diff --git a/src/CurlSharp/CurlSharp.csproj b/src/CurlSharp/CurlSharp.csproj
index 2c7551238..df315101e 100644
--- a/src/CurlSharp/CurlSharp.csproj
+++ b/src/CurlSharp/CurlSharp.csproj
@@ -1,110 +1,21 @@
-
-
-
+
+
- Debug
- AnyCPU
- {74420A79-CC16-442C-8B1E-7C1B913844F0}
- Library
- Properties
- CurlSharp
- CurlSharp
- 512
- v4.5.2
-
- true
+ net452;netstandard1.5
-
- true
- full
- false
- bin\Debug
- DEBUG
- 4
- false
- true
- false
-
-
- full
- true
- bin\Release
- 4
- false
- true
-
-
- false
+
+
+ True
+ CurlSharp
+ false
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/CurlSharp/CurlSlist.cs b/src/CurlSharp/CurlSlist.cs
index 8d2423188..afa9a207f 100644
--- a/src/CurlSharp/CurlSlist.cs
+++ b/src/CurlSharp/CurlSlist.cs
@@ -2,7 +2,7 @@
*
* CurlS#arp
*
- * Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
*
* This software is licensed as described in the file LICENSE, which you
@@ -31,19 +31,6 @@ namespace CurlSharp
///
public class CurlSlist : IDisposable
{
-#if !USE_LIBCURLSHIM
- [StructLayout(LayoutKind.Sequential)]
- private class curl_slist
- {
- /// char*
- [MarshalAs(UnmanagedType.LPStr)] public string data;
-
- /// curl_slist*
- public IntPtr next;
- }
-#endif
- private IntPtr _handle;
-
///
/// Constructor
///
@@ -54,12 +41,12 @@ namespace CurlSharp
public CurlSlist()
{
Curl.EnsureCurl();
- _handle = IntPtr.Zero;
+ Handle = IntPtr.Zero;
}
public CurlSlist(IntPtr handle)
{
- _handle = handle;
+ Handle = handle;
}
///
@@ -69,13 +56,13 @@ namespace CurlSharp
{
get
{
- if (_handle == IntPtr.Zero)
+ if (Handle == IntPtr.Zero)
return null;
var strings = new List();
#if !USE_LIBCURLSHIM
var slist = new curl_slist();
- Marshal.PtrToStructure(_handle, slist);
+ Marshal.PtrToStructure(Handle, slist);
while (true)
{
@@ -90,6 +77,17 @@ namespace CurlSharp
}
}
+ internal IntPtr Handle { get; private set; }
+
+ ///
+ /// Free all internal strings.
+ ///
+ public void Dispose()
+ {
+ GC.SuppressFinalize(this);
+ Dispose(true);
+ }
+
///
/// Destructor
///
@@ -105,40 +103,38 @@ namespace CurlSharp
public void Append(string str)
{
#if USE_LIBCURLSHIM
- _handle = NativeMethods.curl_shim_add_string_to_slist(_handle, str);
+ Handle = NativeMethods.curl_shim_add_string_to_slist(Handle, str);
#else
- _handle = NativeMethods.curl_slist_append(_handle, str);
+ Handle = NativeMethods.curl_slist_append(Handle, str);
#endif
}
- ///
- /// Free all internal strings.
- ///
- public void Dispose()
- {
- GC.SuppressFinalize(this);
- Dispose(true);
- }
-
- internal IntPtr Handle
- {
- get { return _handle; }
- }
-
private void Dispose(bool disposing)
{
lock (this)
{
- if (_handle != IntPtr.Zero)
+ if (Handle != IntPtr.Zero)
{
#if USE_LIBCURLSHIM
- NativeMethods.curl_shim_free_slist(_handle);
+ NativeMethods.curl_shim_free_slist(Handle);
#else
- NativeMethods.curl_slist_free_all(_handle);
+ NativeMethods.curl_slist_free_all(Handle);
#endif
- _handle = IntPtr.Zero;
+ Handle = IntPtr.Zero;
}
}
}
+
+#if !USE_LIBCURLSHIM
+ [StructLayout(LayoutKind.Sequential)]
+ private class curl_slist
+ {
+ /// char*
+ [MarshalAs(UnmanagedType.LPStr)] public string data;
+
+ /// curl_slist*
+ public IntPtr next;
+ }
+#endif
}
}
\ No newline at end of file
diff --git a/src/CurlSharp/CurlSslContext.cs b/src/CurlSharp/CurlSslContext.cs
index d24ef2698..90fecd625 100644
--- a/src/CurlSharp/CurlSslContext.cs
+++ b/src/CurlSharp/CurlSslContext.cs
@@ -2,7 +2,7 @@
*
* CurlS#arp
*
- * Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
*
* This software is licensed as described in the file LICENSE, which you
@@ -31,19 +31,14 @@ namespace CurlSharp
///
public sealed class CurlSslContext
{
- private readonly IntPtr _pvContext;
-
internal CurlSslContext(IntPtr pvContext)
{
- _pvContext = pvContext;
+ Context = pvContext;
}
///
/// Get the underlying OpenSSL context.
///
- public IntPtr Context
- {
- get { return _pvContext; }
- }
+ public IntPtr Context { get; }
}
}
\ No newline at end of file
diff --git a/src/CurlSharp/CurlVersionInfoData.cs b/src/CurlSharp/CurlVersionInfoData.cs
index 8bd8af882..aa8124fe3 100644
--- a/src/CurlSharp/CurlVersionInfoData.cs
+++ b/src/CurlSharp/CurlVersionInfoData.cs
@@ -2,7 +2,7 @@
*
* CurlS#arp
*
- * Copyright (c) 2013 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
*
* This software is licensed as described in the file LICENSE, which you
diff --git a/src/CurlSharp/Enums/CurlHttpVersion.cs b/src/CurlSharp/Enums/CurlHttpVersion.cs
index f5b4eb115..962dedf87 100644
--- a/src/CurlSharp/Enums/CurlHttpVersion.cs
+++ b/src/CurlSharp/Enums/CurlHttpVersion.cs
@@ -23,9 +23,24 @@ namespace CurlSharp
///
Http1_1 = 2,
+ ///
+ /// Enforce HTTP 2 requests.
+ ///
+ Http2_0 = 3,
+
+ ///
+ /// Enforce version 2 for HTTPS, version 1.1 for HTTP.
+ ///
+ Http2_Tls = 4,
+
+ ///
+ /// Enforce HTTP 2 without HTTP/1.1 upgrade.
+ ///
+ Http2_PriorKnowledge = 5,
+
///
/// Last entry in enumeration; do not use in application code.
///
- Last = 3
- };
+ Last = 6
+ }
}
\ No newline at end of file
diff --git a/src/CurlSharp/Enums/CurlMultiOption.cs b/src/CurlSharp/Enums/CurlMultiOption.cs
new file mode 100644
index 000000000..53ef4c030
--- /dev/null
+++ b/src/CurlSharp/Enums/CurlMultiOption.cs
@@ -0,0 +1,46 @@
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+//
+// Copyright (c) 2017, Dr. Masroor Ehsan. All rights reserved.
+//
+// $Id:$
+//
+// Last modified: 25.01.2017 1:29 AM
+//
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+namespace CurlSharp
+{
+ public enum CurlMultiOption
+ {
+ /* This is the socket callback function pointer */
+ SocketFunction = CurlOptType.FunctionPoint + 1,
+ /* This is the argument passed to the socket callback */
+ SocketData = CurlOptType.ObjectPoint + 2,
+ /* set to 1 to enable pipelining for this multi handle */
+ Pipelining = CurlOptType.Long + 3,
+ /* This is the timer callback function pointer */
+ TimerFunction = CurlOptType.FunctionPoint + 4,
+ /* This is the argument passed to the timer callback */
+ TimerDate = CurlOptType.ObjectPoint + 5,
+ /* maximum number of entries in the connection cache */
+ MaxConnects = CurlOptType.Long + 6,
+ /* maximum number of (pipelining) connections to one host */
+ MaxHostConnections = CurlOptType.Long + 7,
+ /* maximum number of requests in a pipeline */
+ MaxPipelineLength = CurlOptType.Long + 8,
+ /* a connection with a content-length longer than this will not be considered for pipelining */
+ ContentLengthPenaltySize = CurlOptType.Offset + 9,
+ /* a connection with a chunk length longer than this will not be considered for pipelining */
+ ChunkLengthPenaltySize = CurlOptType.Offset + 10,
+ /* a list of site names(+port) that are blacklisted from pipelining */
+ PipeliningSiteBlackList = CurlOptType.ObjectPoint + 11,
+ /* a list of server types that are blacklisted from pipelining */
+ PipeliningServerBlackList = CurlOptType.ObjectPoint + 12,
+ /* maximum number of open connections in total */
+ MaxTotalConnections = CurlOptType.Long + 13,
+ /* This is the server push callback function pointer */
+ PushFunction = CurlOptType.FunctionPoint + 14,
+ /* This is the argument passed to the server push callback */
+ PushData = CurlOptType.ObjectPoint + 15
+ }
+}
\ No newline at end of file
diff --git a/src/CurlSharp/Enums/CurlOptType.cs b/src/CurlSharp/Enums/CurlOptType.cs
new file mode 100644
index 000000000..8cb996a39
--- /dev/null
+++ b/src/CurlSharp/Enums/CurlOptType.cs
@@ -0,0 +1,21 @@
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+//
+// Copyright (c) 2017, Dr. Masroor Ehsan. All rights reserved.
+//
+// $Id:$
+//
+// Last modified: 25.01.2017 1:31 AM
+//
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+namespace CurlSharp
+{
+ public enum CurlOptType
+ {
+ Long = 0,
+ ObjectPoint = 10000,
+ StringPoint = 10000,
+ FunctionPoint = 20000,
+ Offset = 30000
+ }
+}
\ No newline at end of file
diff --git a/src/CurlSharp/Enums/CurlOption.cs b/src/CurlSharp/Enums/CurlOption.cs
index 2eecac8f6..78a7fe3e3 100644
--- a/src/CurlSharp/Enums/CurlOption.cs
+++ b/src/CurlSharp/Enums/CurlOption.cs
@@ -1075,6 +1075,32 @@ namespace CurlSharp
///
SslCipherList = 10083,
+ ///
+ /// Object reference to pass to the ssl context delegate set by the option
+ /// SslCtxFunction, this is the pointer you'll get as the
+ /// second parameter, otherwise null. (Added in 7.11.0)
+ ///
+ SslCtxData = 10109,
+
+ ///
+ /// Reference to an delegate.
+ /// This delegate gets called by libcurl just before the initialization of
+ /// an Ssl connection after having processed all other Ssl related options
+ /// to give a last chance to an application to modify the behaviour of
+ /// openssl's ssl initialization. The parameter
+ /// wraps a pointer to an openssl SSL_CTX. If an error is returned no attempt
+ /// to establish a connection is made and the perform operation will return
+ /// the error code from this callback function. Set the parm argument with
+ /// the SslCtxData option. This option was introduced
+ /// in 7.11.0.
+ ///
+ /// To use this properly, a non-trivial amount of knowledge of the openssl
+ /// libraries is necessary. Using this function allows for example to use
+ /// openssl callbacks to add additional validation code for certificates,
+ /// and even to change the actual URI of an HTTPS request.
+ ///
+ ///
+ SslCtxFunction = 20108,
///
/// Pass an int. Set if we should verify the common name from the
diff --git a/src/CurlSharp/Enums/CurlPipelining.cs b/src/CurlSharp/Enums/CurlPipelining.cs
new file mode 100644
index 000000000..a176f6261
--- /dev/null
+++ b/src/CurlSharp/Enums/CurlPipelining.cs
@@ -0,0 +1,21 @@
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+//
+// Copyright (c) 2017, Dr. Masroor Ehsan. All rights reserved.
+//
+// $Id:$
+//
+// Last modified: 25.01.2017 1:23 AM
+//
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+namespace CurlSharp
+{
+ /* bitmask bits for CURLMOPT_PIPELINING */
+
+ public enum CurlPipelining : long
+ {
+ Nothing = 0,
+ Http1 = 1,
+ Multiplex = 2
+ }
+}
\ No newline at end of file
diff --git a/src/CurlSharp/LICENSE b/src/CurlSharp/LICENSE
new file mode 100644
index 000000000..346d3329d
--- /dev/null
+++ b/src/CurlSharp/LICENSE
@@ -0,0 +1,29 @@
+Copyright (c) 2013, Masroor Ehsan Choudhury
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+
+* Neither the name of the {organization} nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+https://github.com/masroore/CurlSharp
\ No newline at end of file
diff --git a/src/CurlSharp/NativeMethods.cs b/src/CurlSharp/NativeMethods.cs
index fad1fc11f..f97a57a51 100644
--- a/src/CurlSharp/NativeMethods.cs
+++ b/src/CurlSharp/NativeMethods.cs
@@ -2,8 +2,9 @@
*
* CurlS#arp
*
- * Copyright (c) 2014 Dr. Masroor Ehsan (masroore@gmail.com)
+ * Copyright (c) 2013-2017 Dr. Masroor Ehsan (masroore@gmail.com)
* Portions copyright (c) 2004, 2005 Jeff Phillips (jeff@jeffp.net)
+ * Portions copyright (c) 2017 Katelyn Gigante (https://github.com/silasary)
*
* This software is licensed as described in the file LICENSE, which you
* should have received as part of this distribution.
@@ -20,383 +21,598 @@
//#define USE_LIBCURLSHIM
using System;
+using System.IO;
+using System.Reflection;
using System.Runtime.InteropServices;
namespace CurlSharp
{
- ///
- /// P/Invoke signatures.
- ///
- internal static unsafe class NativeMethods
- {
- #if WIN64
- private const string CURL_LIB = "libcurl64.dll";
+ ///
+ /// P/Invoke signatures.
+ ///
+ internal static unsafe class NativeMethods
+ {
+ private const string LIBCURL = "libcurl";
+ private const string LIBCURLSHIM = "libcurlshim";
+ private const string LIBC_LINUX = "libc";
-
-
-#if USE_LIBCURLSHIM
- private const string CURLSHIM_LIB = "libcurlshim64.dll";
-#endif
-
-
-
-
-#else
- #if LINUX
- private const string CURL_LIB = "libcurl";
- #else
- private const string CURL_LIB = "libcurl.dll";
-
-
-
-
-
-#if USE_LIBCURLSHIM
- private const string CURLSHIM_LIB = "libcurlshim.dll";
-#endif
- #endif
- #endif
- #if !USE_LIBCURLSHIM
- #if LINUX
- private const string WINSOCK_LIB = "libc";
- #else
private const string WINSOCK_LIB = "ws2_32.dll";
+
+ private const string LIB_DIR_WIN64 = "amd64";
+
+ private const string LIB_DIR_WIN32 = "i386";
+
+ static NativeMethods()
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ switch (RuntimeInformation.OSArchitecture)
+ {
+ case Architecture.X64:
+ SetDllDirectory(Path.Combine(AssemblyDirectory, LIB_DIR_WIN64));
+ break;
+ case Architecture.X86:
+ SetDllDirectory(Path.Combine(AssemblyDirectory, LIB_DIR_WIN32));
+ break;
+ }
+ }
+#if USE_LIBCURLSHIM
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ throw new InvalidOperationException("Can not run on other platform than Win NET");
#endif
- #endif
+ }
+
+ [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool SetDllDirectory(string lpPathName);
+
+ private static string AssemblyDirectory
+ {
+ get
+ {
+ var codeBase = typeof(NativeMethods).GetTypeInfo().Assembly.CodeBase;
+ var uri = new UriBuilder(codeBase);
+ var path = Uri.UnescapeDataString(uri.Path);
+ return Path.GetDirectoryName(path);
+ }
+ }
- // internal delegates from cURL
+ #region curl_global_init
- // libcurl imports
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_global_init (int flags);
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_global_init(int flags);
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_global_cleanup ();
+ #endregion
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
- internal static extern IntPtr curl_escape (String url, int length);
+ #region curl_global_cleanup
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
- internal static extern IntPtr curl_unescape (String url, int length);
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_global_cleanup();
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_free (IntPtr p);
+ #endregion
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_version ();
+ #region curl_easy_escape
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_easy_init ();
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
+ public static extern IntPtr curl_easy_escape(IntPtr pEasy, string url, int length);
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_easy_cleanup (IntPtr pCurl);
+ #endregion
- [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- internal delegate int _CurlGenericCallback (IntPtr ptr, int sz, int nmemb, IntPtr userdata);
-
- [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- internal delegate int _CurlProgressCallback (
- IntPtr extraData, double dlTotal, double dlNow, double ulTotal, double ulNow);
-
- [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- internal delegate int _CurlDebugCallback (
- IntPtr ptrCurl, CurlInfoType infoType, string message, int size, IntPtr ptrUserData);
-
- [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- internal delegate int _CurlSslCtxCallback (IntPtr ctx, IntPtr parm);
-
- [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
- internal delegate CurlIoError _CurlIoctlCallback (CurlIoCommand cmd, IntPtr parm);
-
- // curl_easy_setopt() overloads
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, IntPtr parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, string parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, byte[] parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, long parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_easy_setopt (IntPtr pCurl, CurlOption opt, bool parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
- internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlGenericCallback parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
- internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlProgressCallback parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
- internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlDebugCallback parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
- internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlSslCtxCallback parm);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "curl_easy_setopt")]
- internal static extern CurlCode curl_easy_setopt_cb (IntPtr pCurl, CurlOption opt, _CurlIoctlCallback parm);
-
- #if !USE_LIBCURLSHIM
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlMultiCode curl_multi_fdset (IntPtr pmulti,
- [In, Out] ref fd_set read_fd_set,
- [In, Out] ref fd_set write_fd_set,
- [In, Out] ref fd_set exc_fd_set,
- [In, Out] ref int max_fd);
-
- [StructLayout (LayoutKind.Sequential)]
- internal struct fd_set
- {
- internal uint fd_count;
- //[MarshalAs(UnmanagedType.ByValArray, SizeConst = FD_SETSIZE)] internal IntPtr[] fd_array;
- internal fixed uint fd_array[FD_SETSIZE];
+ #region curl_easy_unescape
- internal const int FD_SETSIZE = 64;
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
+ public static extern IntPtr curl_easy_unescape(IntPtr pEasy, string url, int inLength, out int outLength);
- internal void Cleanup ()
- {
- //fd_array = null;
- }
+ #endregion
- internal static fd_set Create ()
- {
- return new fd_set {
- //fd_array = new IntPtr[FD_SETSIZE],
- fd_count = 0
- };
- }
-
- internal static fd_set Create (IntPtr socket)
- {
- var handle = Create ();
- handle.fd_count = 1;
- handle.fd_array [0] = (uint)socket;
- return handle;
- }
- }
-
- internal static void FD_ZERO (fd_set fds)
- {
- for (var i = 0; i < fd_set.FD_SETSIZE; i++) {
- //fds.fd_array[i] = (IntPtr) 0;
- fds.fd_array [i] = 0;
- }
- fds.fd_count = 0;
- }
-
- [StructLayout (LayoutKind.Sequential)]
- internal struct timeval
- {
- ///
- /// Time interval, in seconds.
- ///
- internal int tv_sec;
-
- ///
- /// Time interval, in microseconds.
- ///
- internal int tv_usec;
-
- internal static timeval Create (int milliseconds)
- {
- return new timeval {
- tv_sec = milliseconds / 1000,
- tv_usec = (milliseconds % 1000) * 1000
- };
- }
- };
-
- [DllImport (WINSOCK_LIB, EntryPoint = "select")]
- internal static extern int select (
- int nfds, // number of sockets, (ignored in winsock)
- [In, Out] ref fd_set readfds, // read sockets to watch
- [In, Out] ref fd_set writefds, // write sockets to watch
- [In, Out] ref fd_set exceptfds, // error sockets to watch
- ref timeval timeout);
-
- //[DllImport(WINSOCK_LIB, EntryPoint = "select")]
- //internal static extern int select(int ndfs, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout);
- #endif
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_easy_perform (IntPtr pCurl);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_easy_duphandle (IntPtr pCurl);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_easy_strerror (CurlCode err);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_easy_getinfo (IntPtr pCurl, CurlInfo info, ref IntPtr pInfo);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlCode curl_easy_getinfo (IntPtr pCurl, CurlInfo info, ref double dblVal);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_easy_reset (IntPtr pCurl);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_multi_init ();
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlMultiCode curl_multi_cleanup (IntPtr pmulti);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlMultiCode curl_multi_add_handle (IntPtr pmulti, IntPtr peasy);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlMultiCode curl_multi_remove_handle (IntPtr pmulti, IntPtr peasy);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_multi_strerror (CurlMultiCode errorNum);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlMultiCode curl_multi_perform (IntPtr pmulti, ref int runningHandles);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_formfree (IntPtr pForm);
-
- #if !USE_LIBCURLSHIM
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int curl_formadd (ref IntPtr pHttppost, ref IntPtr pLastPost,
- int codeFirst, IntPtr bufFirst,
- int codeNext, IntPtr bufNext,
- int codeLast);
- #endif
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_share_init ();
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlShareCode curl_share_cleanup (IntPtr pShare);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_share_strerror (CurlShareCode errorCode);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlShareCode curl_share_setopt (IntPtr pShare, CurlShareOption optCode, IntPtr option);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
- internal static extern IntPtr curl_slist_append (IntPtr slist, string data);
-
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlShareCode curl_slist_free_all (IntPtr pList);
+ #region curl_free
- [DllImport (CURL_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_version_info (CurlVersion ver);
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_free(IntPtr p);
- #if USE_LIBCURLSHIM
-
- // libcurlshim imports
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_initialize();
+ #endregion
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_cleanup();
+ #region curl_version
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_shim_alloc_strings();
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_version();
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl,
- CharSet = CharSet.Ansi)]
- internal static extern IntPtr curl_shim_add_string_to_slist(
- IntPtr pStrings, String str);
+ #endregion
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl,
- CharSet = CharSet.Ansi)]
- internal static extern IntPtr curl_shim_get_string_from_slist(
- IntPtr pSlist, ref IntPtr pStr);
+ #region curl_version_info
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl,
- CharSet = CharSet.Ansi)]
- internal static extern IntPtr curl_shim_add_string(IntPtr pStrings, String str);
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_version_info(CurlVersion ver);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_free_strings(IntPtr pStrings);
+ #endregion
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int curl_shim_install_delegates(IntPtr pCurl, IntPtr pThis,
- _ShimWriteCallback pWrite, _ShimReadCallback pRead,
- _ShimProgressCallback pProgress, _ShimDebugCallback pDebug,
- _ShimHeaderCallback pHeader, _ShimSslCtxCallback pCtx,
+ #region curl_easy_init
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_easy_init();
+
+ #endregion
+
+ #region curl_easy_cleanup
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_easy_cleanup(IntPtr pCurl);
+
+ #endregion
+
+ #region curl_easy_setopt
+
+ #region Delegates
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate int _CurlGenericCallback(IntPtr ptr, int sz, int nmemb, IntPtr userdata);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate int _CurlProgressCallback(
+ IntPtr extraData,
+ double dlTotal,
+ double dlNow,
+ double ulTotal,
+ double ulNow);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate int _CurlDebugCallback(
+ IntPtr ptrCurl,
+ CurlInfoType infoType,
+ string message,
+ int size,
+ IntPtr ptrUserData);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate int _CurlSslCtxCallback(IntPtr ctx, IntPtr parm);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate CurlIoError _CurlIoctlCallback(CurlIoCommand cmd, IntPtr parm);
+
+ #endregion
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, IntPtr parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, string parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, byte[] parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, long parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, bool parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, _CurlGenericCallback parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, _CurlProgressCallback parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, _CurlDebugCallback parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, _CurlSslCtxCallback parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_setopt(IntPtr pCurl, CurlOption opt, _CurlIoctlCallback parm);
+
+ #endregion
+
+ #region curl_easy_perform
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_perform(IntPtr pCurl);
+
+ #endregion
+
+ #region curl_easy_duphandle
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_easy_duphandle(IntPtr pCurl);
+
+ #endregion
+
+ #region curl_easy_strerror
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_easy_strerror(CurlCode err);
+
+ #endregion
+
+ #region curl_easy_getinfo
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_getinfo(IntPtr pCurl, CurlInfo info, ref IntPtr pInfo);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlCode curl_easy_getinfo(IntPtr pCurl, CurlInfo info, ref double dblVal);
+
+ #endregion
+
+ #region curl_easy_reset
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_easy_reset(IntPtr pCurl);
+
+ #endregion
+
+ #region curl_multi_init
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_multi_init();
+
+ #endregion
+
+ #region curl_multi_cleanup
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlMultiCode curl_multi_cleanup(IntPtr pmulti);
+
+ #endregion
+
+ #region curl_multi_add_handle
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlMultiCode curl_multi_add_handle(IntPtr pmulti, IntPtr peasy);
+
+ #endregion
+
+ #region curl_multi_remove_handle
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlMultiCode curl_multi_remove_handle(IntPtr pmulti, IntPtr peasy);
+
+ #endregion
+
+ #region curl_multi_setopt
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlMultiCode curl_multi_setopt(IntPtr pmulti, CurlMultiOption opt, bool parm);
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlMultiCode curl_multi_setopt(IntPtr pmulti, CurlMultiOption opt, long parm);
+
+ #endregion
+
+ #region curl_multi_strerror
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_multi_strerror(CurlMultiCode errorNum);
+
+ #endregion
+
+ #region curl_multi_perform
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlMultiCode curl_multi_perform(IntPtr pmulti, ref int runningHandles);
+
+ #endregion
+
+#if !USE_LIBCURLSHIM
+
+ #region curl_multi_fdset
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlMultiCode curl_multi_fdset(IntPtr pmulti,
+ [In] [Out] ref fd_set read_fd_set,
+ [In] [Out] ref fd_set write_fd_set,
+ [In] [Out] ref fd_set exc_fd_set,
+ [In] [Out] ref int max_fd);
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct fd_set
+ {
+ public uint fd_count;
+
+ // [MarshalAs(UnmanagedType.ByValArray, SizeConst = FD_SETSIZE)] public IntPtr[] fd_array;
+ public fixed uint fd_array[FD_SETSIZE];
+
+ public const int FD_SETSIZE = 64;
+
+ public void Cleanup()
+ {
+ // fd_array = null;
+ }
+
+ public static fd_set Create()
+ {
+ return new fd_set
+ {
+ // fd_array = new IntPtr[FD_SETSIZE],
+ fd_count = 0
+ };
+ }
+
+ public static fd_set Create(IntPtr socket)
+ {
+ var handle = Create();
+ handle.fd_count = 1;
+ handle.fd_array[0] = (uint) socket;
+ return handle;
+ }
+ }
+
+ public static void FD_ZERO(fd_set fds)
+ {
+ for (var i = 0; i < fd_set.FD_SETSIZE; i++)
+ {
+ fds.fd_array[i] = 0;
+ }
+ fds.fd_count = 0;
+ }
+
+ #endregion
+
+ #region select
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct timeval
+ {
+ ///
+ /// Time interval, in seconds.
+ ///
+ public int tv_sec;
+
+ ///
+ /// Time interval, in microseconds.
+ ///
+ public int tv_usec;
+
+ public static timeval Create(int milliseconds)
+ {
+ return new timeval
+ {
+ tv_sec = milliseconds / 1000,
+ tv_usec = milliseconds % 1000 * 1000
+ };
+ }
+ }
+
+ [DllImport(LIBC_LINUX, EntryPoint = "select")]
+ private static extern int select_unix(
+ int nfds, // number of sockets, (ignored in winsock)
+ [In] [Out] ref fd_set readfds, // read sockets to watch
+ [In] [Out] ref fd_set writefds, // write sockets to watch
+ [In] [Out] ref fd_set exceptfds, // error sockets to watch
+ ref timeval timeout);
+
+ [DllImport(WINSOCK_LIB, EntryPoint = "select")]
+ private static extern int select_win(
+ int nfds, // number of sockets, (ignored in winsock)
+ [In] [Out] ref fd_set readfds, // read sockets to watch
+ [In] [Out] ref fd_set writefds, // write sockets to watch
+ [In] [Out] ref fd_set exceptfds, // error sockets to watch
+ ref timeval timeout);
+
+ public static int select(
+ int nfds, // number of sockets, (ignored in winsock)
+ [In] [Out] ref fd_set readfds, // read sockets to watch
+ [In] [Out] ref fd_set writefds, // write sockets to watch
+ [In] [Out] ref fd_set exceptfds, // error sockets to watch
+ ref timeval timeout)
+ {
+ int result;
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ result = select_win(
+ nfds, // number of sockets, (ignored in winsock)
+ ref readfds, // read sockets to watch
+ ref writefds, // write sockets to watch
+ ref exceptfds, // error sockets to watch
+ ref timeout);
+ }
+ else
+ {
+ result = select_unix(
+ nfds, // number of sockets, (ignored in winsock)
+ ref readfds, // read sockets to watch
+ ref writefds, // write sockets to watch
+ ref exceptfds, // error sockets to watch
+ ref timeout);
+ }
+
+ return result;
+ }
+
+ #endregion
+
+#endif
+
+ #region curl_share_init
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_share_init();
+
+ #endregion
+
+ #region curl_share_cleanup
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlShareCode curl_share_cleanup(IntPtr pShare);
+
+ #endregion
+
+ #region curl_share_strerror
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_share_strerror(CurlShareCode errorCode);
+
+ #endregion
+
+ #region curl_share_setopt
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlShareCode curl_share_setopt(
+ IntPtr pShare,
+ CurlShareOption optCode,
+ IntPtr option);
+
+ #endregion
+
+ #region curl_formadd
+
+#if !USE_LIBCURLSHIM
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int curl_formadd(ref IntPtr pHttppost, ref IntPtr pLastPost,
+ int codeFirst, IntPtr bufFirst,
+ int codeNext, IntPtr bufNext,
+ int codeLast);
+
+#endif
+
+ #endregion
+
+ #region curl_formfree
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_formfree(IntPtr pForm);
+
+ #endregion
+
+ #region curl_slist_append
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
+ public static extern IntPtr curl_slist_append(IntPtr slist, string data);
+
+ #endregion
+
+ #region curl_slist_free_all
+
+ [DllImport(LIBCURL, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_slist_free_all(IntPtr pList);
+
+ #endregion
+
+#if USE_LIBCURLSHIM
+
+ #region libcurlshim imports
+
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_initialize();
+
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_cleanup();
+
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_shim_alloc_strings();
+
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
+ public static extern IntPtr curl_shim_add_string_to_slist(IntPtr pStrings, string str);
+
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
+ public static extern IntPtr curl_shim_get_string_from_slist(IntPtr pSlist, ref IntPtr pStr);
+
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
+ public static extern IntPtr curl_shim_add_string(IntPtr pStrings, string str);
+
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_free_strings(IntPtr pStrings);
+
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int curl_shim_install_delegates(
+ IntPtr pCurl,
+ IntPtr pThis,
+ _ShimWriteCallback pWrite,
+ _ShimReadCallback pRead,
+ _ShimProgressCallback pProgress,
+ _ShimDebugCallback pDebug,
+ _ShimHeaderCallback pHeader,
+ _ShimSslCtxCallback pCtx,
_ShimIoctlCallback pIoctl);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_cleanup_delegates(IntPtr pThis);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_cleanup_delegates(IntPtr pThis);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_get_file_time(int unixTime,
- ref int yy, ref int mm, ref int dd, ref int hh, ref int mn, ref int ss);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_get_file_time(
+ int unixTime,
+ ref int yy,
+ ref int mm,
+ ref int dd,
+ ref int hh,
+ ref int mn,
+ ref int ss);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_free_slist(IntPtr p);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_free_slist(IntPtr p);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_shim_alloc_fd_sets();
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_shim_alloc_fd_sets();
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_free_fd_sets(IntPtr fdsets);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_free_fd_sets(IntPtr fdsets);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern CurlMultiCode curl_shim_multi_fdset(IntPtr multi,
- IntPtr fdsets, ref int maxFD);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern CurlMultiCode curl_shim_multi_fdset(IntPtr multi, IntPtr fdsets, ref int maxFD);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int curl_shim_select(int maxFD, IntPtr fdsets,
- int milliseconds);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int curl_shim_select(int maxFD, IntPtr fdsets, int milliseconds);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_shim_multi_info_read(IntPtr multi,
- ref int nMsgs);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_shim_multi_info_read(IntPtr multi, ref int nMsgs);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_multi_info_free(IntPtr multiInfo);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_multi_info_free(IntPtr multiInfo);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int curl_shim_formadd(IntPtr[] ppForms, IntPtr[] pParams, int nParams);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int curl_shim_formadd(IntPtr[] ppForms, IntPtr[] pParams, int nParams);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int curl_shim_install_share_delegates(IntPtr pShare,
- IntPtr pThis, _ShimLockCallback pLock, _ShimUnlockCallback pUnlock);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int curl_shim_install_share_delegates(
+ IntPtr pShare,
+ IntPtr pThis,
+ _ShimLockCallback pLock,
+ _ShimUnlockCallback pUnlock);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void curl_shim_cleanup_share_delegates(IntPtr pShare);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern void curl_shim_cleanup_share_delegates(IntPtr pShare);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int curl_shim_get_version_int_value(IntPtr p, int offset);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int curl_shim_get_version_int_value(IntPtr p, int offset);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_shim_get_version_char_ptr(IntPtr p, int offset);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_shim_get_version_char_ptr(IntPtr p, int offset);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int curl_shim_get_number_of_protocols(IntPtr p, int offset);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int curl_shim_get_number_of_protocols(IntPtr p, int offset);
- [DllImport(CURLSHIM_LIB, CallingConvention = CallingConvention.Cdecl)]
- internal static extern IntPtr curl_shim_get_protocol_string(IntPtr p, int offset, int index);
+ [DllImport(LIBCURLSHIM, CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr curl_shim_get_protocol_string(IntPtr p, int offset, int index);
- internal delegate void _ShimLockCallback(int data, int access, IntPtr userPtr);
+ public delegate void _ShimLockCallback(int data, int access, IntPtr userPtr);
- internal delegate void _ShimUnlockCallback(int data, IntPtr userPtr);
+ public delegate void _ShimUnlockCallback(int data, IntPtr userPtr);
- internal delegate int _ShimDebugCallback(CurlInfoType infoType, IntPtr msgBuf, int msgBufSize, IntPtr parm);
+ public delegate int _ShimDebugCallback(CurlInfoType infoType, IntPtr msgBuf, int msgBufSize, IntPtr parm);
- internal delegate int _ShimHeaderCallback(IntPtr buf, int sz, int nmemb, IntPtr stream);
+ public delegate int _ShimHeaderCallback(IntPtr buf, int sz, int nmemb, IntPtr stream);
- internal delegate CurlIoError _ShimIoctlCallback(CurlIoCommand cmd, IntPtr parm);
+ public delegate CurlIoError _ShimIoctlCallback(CurlIoCommand cmd, IntPtr parm);
- internal delegate int _ShimProgressCallback(IntPtr parm, double dlTotal, double dlNow, double ulTotal, double ulNow);
+ public delegate int _ShimProgressCallback(
+ IntPtr parm,
+ double dlTotal,
+ double dlNow,
+ double ulTotal,
+ double ulNow);
- internal delegate int _ShimReadCallback(IntPtr buf, int sz, int nmemb, IntPtr parm);
+ public delegate int _ShimReadCallback(IntPtr buf, int sz, int nmemb, IntPtr parm);
- internal delegate int _ShimSslCtxCallback(IntPtr ctx, IntPtr parm);
+ public delegate int _ShimSslCtxCallback(IntPtr ctx, IntPtr parm);
+
+ public delegate int _ShimWriteCallback(IntPtr buf, int sz, int nmemb, IntPtr parm);
+
+ #endregion
- internal delegate int _ShimWriteCallback(IntPtr buf, int sz, int nmemb, IntPtr parm);
#endif
- }
+ }
}
\ No newline at end of file
diff --git a/src/CurlSharp/Properties/AssemblyInfo.cs b/src/CurlSharp/Properties/AssemblyInfo.cs
deleted file mode 100644
index 2296da77a..000000000
--- a/src/CurlSharp/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes.
-// Change them to the values specific to your project.
-[assembly: AssemblyTitle ("CurlSharp")]
-[assembly: AssemblyDescription ("")]
-[assembly: AssemblyConfiguration ("")]
-[assembly: AssemblyCompany ("")]
-[assembly: AssemblyProduct ("")]
-[assembly: AssemblyCopyright ("max")]
-[assembly: AssemblyTrademark ("")]
-[assembly: AssemblyCulture ("")]
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-[assembly: AssemblyVersion ("1.0.*")]
-// The following attributes are used to specify the signing key for the assembly,
-// if desired. See the Mono documentation for more information about signing.
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-
diff --git a/src/CurlSharp/README.md b/src/CurlSharp/README.md
new file mode 100644
index 000000000..0a653521d
--- /dev/null
+++ b/src/CurlSharp/README.md
@@ -0,0 +1,114 @@
+CurlSharp
+=========
+
+CurlSharp is a .Net binding and object-oriented wrapper for [libcurl](http://curl.haxx.se/libcurl/).
+
+libcurl is a web-client library that can provide cross-platform .Net applications with an easy way to implement such things as:
+
+- HTTP ( GET / HEAD / PUT / POST / multi-part / form-data )
+- FTP ( upload / download / list / 3rd-party )
+- HTTPS, FTPS, SSL, TLS ( via OpenSSL or GnuTLS )
+- Proxies, proxy tunneling, cookies, user+password authentication.
+- File transfer resume, byte ranges, multiple asynchronous transfers.
+- and much more...
+
+CurlSharp provides simple get/set properties for libcurl's options and information functions, event-based hooks to libcurl's I/O, status, and progress callbacks, and wraps the c-style file I/O behind simple filename properties. The `CurlEasy` class contains has more than 100 different properties and methods to handle a wide variety of URL transfer requirements. While this may seem overwhelming at first glance, the good news is you will probably need only a tiny subset of these for most situations.
+
+The CurlSharp library consists of these parts:
+
+- Pure C# P/Invoke bindings to the libcurl API.
+- Optional libcurlshim helper DLL [WIN32].
+- The `CurlEasy` class which provides a wrapper around a `curl_easy` session.
+- The `CurlMulti` class, which serves as a container for multiple CurlEasy objects, and provides a wrapper around a `curl_multi` session.
+- The `CurlShare` class which provides an infrastructure for serializing access to data shared by multiple `CurlEasy` objects, including cookie data and DNS hosts. It implements the `curl_share_xxx` API.
+- The `CurlHttpMultiPartForm` to easily construct multi-part forms.
+- The `CurlSlist` class which wraps a linked list of strings used in cURL.
+
+CurlSharp is available for these platforms:
+
+- [Stable] Windows 32-bit
+- [Experimental] Win64 port
+- [Experimental] Mono Linux & OS X support
+
+#### Examples ####
+
+A simple HTTP download program...
+
+```c#
+using System;
+using CurlSharp;
+
+internal class EasyGet
+{
+ public static void Main(String[] args)
+ {
+ Curl.GlobalInit(CurlInitFlag.All);
+
+ try
+ {
+ using (var easy = new CurlEasy())
+ {
+ easy.Url = "http://www.google.com/";
+ easy.WriteFunction = OnWriteData;
+ easy.Perform();
+ }
+ }
+ finally
+ {
+ Curl.GlobalCleanup();
+ }
+ }
+
+ public static Int32 OnWriteData(byte[] buf, Int32 size, Int32 nmemb, object data)
+ {
+ Console.Write(Encoding.UTF8.GetString(buf));
+ return size*nmemb;
+ }
+}
+```
+
+Simple HTTP Post example:
+
+```c#
+using (var easy = new CurlEasy())
+{
+ easy.Url = "http://hostname/testpost.php";
+ easy.Post = true;
+ var postData = "parm1=12345&parm2=Hello+world%21";
+ easy.PostFields = postData;
+ easy.PostFieldSize = postData.Length;
+ easy.Perform();
+}
+```
+
+HTTP/2.0 download:
+
+```c#
+
+using (var easy = new CurlEasy())
+{
+ easy.Url = "https://google.com/";
+ easy.WriteFunction = OnWriteData;
+
+ // HTTP/2 please
+ easy.HttpVersion = CurlHttpVersion.Http2_0;
+
+ // skip SSL verification during debugging
+ easy.SslVerifyPeer = false;
+ easy.SslVerifyhost = false;
+
+ easy.Perform();
+}
+```
+
+More samples are included in the Samples folder.
+
+#### Credits ####
+
+CurlSharp Written by Dr. Masroor Ehsan.
+
+CurlSharp is based on original code by Jeff Phillips [libcurl.NET](http://sourceforge.net/projects/libcurl-net/). Original code has been modified and greatly enhanced.
+
+----------
+
+CurlSharp Copyright © 2013-17 Dr. Masroor Ehsan
\ No newline at end of file
diff --git a/src/DateTimeRoutines/DateTimeRoutines.cs b/src/DateTimeRoutines/DateTimeRoutines.cs
new file mode 100644
index 000000000..a5b337454
--- /dev/null
+++ b/src/DateTimeRoutines/DateTimeRoutines.cs
@@ -0,0 +1,621 @@
+//********************************************************************************************
+//Author: Sergey Stoyan, CliverSoft.com
+// http://cliversoft.com
+// stoyan@cliversoft.com
+// sergey.stoyan@gmail.com
+// 27 February 2007
+//********************************************************************************************
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Collections;
+namespace Cliver
+{
+ ///
+ /// Miscellaneous and parsing methods for DateTime
+ ///
+ public static class DateTimeRoutines
+ {
+ #region miscellaneous methods
+
+ ///
+ /// Amount of seconds elapsed between 1970-01-01 00:00:00 and the date-time.
+ ///
+ /// date-time
+ /// seconds
+ public static uint GetSecondsSinceUnixEpoch(this DateTime date_time)
+ {
+ TimeSpan t = date_time - new DateTime(1970, 1, 1);
+ int ss = (int)t.TotalSeconds;
+ if (ss < 0)
+ return 0;
+ return (uint)ss;
+ }
+
+ #endregion
+
+ #region parsing definitions
+
+ ///
+ /// Defines a substring where date-time was found and result of conversion
+ ///
+ public class ParsedDateTime
+ {
+ ///
+ /// Index of first char of a date substring found in the string
+ ///
+ readonly public int IndexOfDate = -1;
+ ///
+ /// Length a date substring found in the string
+ ///
+ readonly public int LengthOfDate = -1;
+ ///
+ /// Index of first char of a time substring found in the string
+ ///
+ readonly public int IndexOfTime = -1;
+ ///
+ /// Length of a time substring found in the string
+ ///
+ readonly public int LengthOfTime = -1;
+ ///
+ /// DateTime found in the string
+ ///
+ readonly public DateTime DateTime;
+ ///
+ /// True if a date was found within the string
+ ///
+ readonly public bool IsDateFound;
+ ///
+ /// True if a time was found within the string
+ ///
+ readonly public bool IsTimeFound;
+ ///
+ /// UTC offset if it was found within the string
+ ///
+ readonly public TimeSpan UtcOffset;
+ ///
+ /// True if UTC offset was found in the string
+ ///
+ readonly public bool IsUtcOffsetFound;
+ ///
+ /// Utc gotten from DateTime if IsUtcOffsetFound is True
+ ///
+ public DateTime UtcDateTime;
+
+ internal ParsedDateTime(int index_of_date, int length_of_date, int index_of_time, int length_of_time, DateTime date_time)
+ {
+ IndexOfDate = index_of_date;
+ LengthOfDate = length_of_date;
+ IndexOfTime = index_of_time;
+ LengthOfTime = length_of_time;
+ DateTime = date_time;
+ IsDateFound = index_of_date > -1;
+ IsTimeFound = index_of_time > -1;
+ UtcOffset = new TimeSpan(25, 0, 0);
+ IsUtcOffsetFound = false;
+ UtcDateTime = new DateTime(1, 1, 1);
+ }
+
+ internal ParsedDateTime(int index_of_date, int length_of_date, int index_of_time, int length_of_time, DateTime date_time, TimeSpan utc_offset)
+ {
+ IndexOfDate = index_of_date;
+ LengthOfDate = length_of_date;
+ IndexOfTime = index_of_time;
+ LengthOfTime = length_of_time;
+ DateTime = date_time;
+ IsDateFound = index_of_date > -1;
+ IsTimeFound = index_of_time > -1;
+ UtcOffset = utc_offset;
+ IsUtcOffsetFound = Math.Abs(utc_offset.TotalHours) < 12;
+ if (!IsUtcOffsetFound)
+ UtcDateTime = new DateTime(1, 1, 1);
+ else
+ {
+ if (index_of_date < 0)//to avoid negative date exception when date is undefined
+ {
+ TimeSpan ts = date_time.TimeOfDay + utc_offset;
+ if (ts < new TimeSpan(0))
+ UtcDateTime = new DateTime(1, 1, 2) + ts;
+ else
+ UtcDateTime = new DateTime(1, 1, 1) + ts;
+ }
+ else
+ UtcDateTime = date_time + utc_offset;
+ }
+ }
+ }
+
+ ///
+ /// Date that is accepted in the following cases:
+ /// - no date was parsed by TryParseDateOrTime();
+ /// - no year was found by TryParseDate();
+ /// It is ignored if DefaultDateIsNow = true was set after DefaultDate
+ ///
+ public static DateTime DefaultDate
+ {
+ set
+ {
+ _DefaultDate = value;
+ DefaultDateIsNow = false;
+ }
+ get
+ {
+ if (DefaultDateIsNow)
+ return DateTime.Now;
+ else
+ return _DefaultDate;
+ }
+ }
+ static DateTime _DefaultDate = DateTime.Now;
+
+ ///
+ /// If true then DefaultDate property is ignored and DefaultDate is always DateTime.Now
+ ///
+ public static bool DefaultDateIsNow = true;
+
+ ///
+ /// Defines default date-time format.
+ ///
+ public enum DateTimeFormat
+ {
+ ///
+ /// month number goes before day number
+ ///
+ USA_DATE,
+ ///
+ /// day number goes before month number
+ ///
+ UK_DATE,
+ /////
+ ///// time is specifed through AM or PM
+ /////
+ //USA_TIME,
+ }
+
+ #endregion
+
+ #region parsing derived methods for DateTime output
+
+ ///
+ /// Tries to find date and time within the passed string and return it as DateTime structure.
+ ///
+ /// string that contains date and/or time
+ /// format to be used preferably in ambivalent instances
+ /// parsed date-time output
+ /// true if both date and time were found, else false
+ static public bool TryParseDateTime(this string str, DateTimeFormat default_format, out DateTime date_time)
+ {
+ ParsedDateTime parsed_date_time;
+ if (!TryParseDateTime(str, default_format, out parsed_date_time))
+ {
+ date_time = new DateTime(1, 1, 1);
+ return false;
+ }
+ date_time = parsed_date_time.DateTime;
+ return true;
+ }
+
+ ///
+ /// Tries to find date and/or time within the passed string and return it as DateTime structure.
+ /// If only date was found, time in the returned DateTime is always 0:0:0.
+ /// If only time was found, date in the returned DateTime is DefaultDate.
+ ///
+ /// string that contains date and(or) time
+ /// format to be used preferably in ambivalent instances
+ /// parsed date-time output
+ /// true if date and/or time was found, else false
+ static public bool TryParseDateOrTime(this string str, DateTimeFormat default_format, out DateTime date_time)
+ {
+ ParsedDateTime parsed_date_time;
+ if (!TryParseDateOrTime(str, default_format, out parsed_date_time))
+ {
+ date_time = new DateTime(1, 1, 1);
+ return false;
+ }
+ date_time = parsed_date_time.DateTime;
+ return true;
+ }
+
+ ///
+ /// Tries to find time within the passed string and return it as DateTime structure.
+ /// It recognizes only time while ignoring date, so date in the returned DateTime is always 1/1/1.
+ ///
+ /// string that contains time
+ /// format to be used preferably in ambivalent instances
+ /// parsed time output
+ /// true if time was found, else false
+ public static bool TryParseTime(this string str, DateTimeFormat default_format, out DateTime time)
+ {
+ ParsedDateTime parsed_time;
+ if (!TryParseTime(str, default_format, out parsed_time, null))
+ {
+ time = new DateTime(1, 1, 1);
+ return false;
+ }
+ time = parsed_time.DateTime;
+ return true;
+ }
+
+ ///
+ /// Tries to find date within the passed string and return it as DateTime structure.
+ /// It recognizes only date while ignoring time, so time in the returned DateTime is always 0:0:0.
+ /// If year of the date was not found then it accepts the current year.
+ ///
+ /// string that contains date
+ /// format to be used preferably in ambivalent instances
+ /// parsed date output
+ /// true if date was found, else false
+ static public bool TryParseDate(this string str, DateTimeFormat default_format, out DateTime date)
+ {
+ ParsedDateTime parsed_date;
+ if (!TryParseDate(str, default_format, out parsed_date))
+ {
+ date = new DateTime(1, 1, 1);
+ return false;
+ }
+ date = parsed_date.DateTime;
+ return true;
+ }
+
+ #endregion
+
+ #region parsing derived methods for ParsedDateTime output
+
+ ///
+ /// Tries to find date and time within the passed string and return it as ParsedDateTime object.
+ ///
+ /// string that contains date-time
+ /// format to be used preferably in ambivalent instances
+ /// parsed date-time output
+ /// true if both date and time were found, else false
+ static public bool TryParseDateTime(this string str, DateTimeFormat default_format, out ParsedDateTime parsed_date_time)
+ {
+ if (DateTimeRoutines.TryParseDateOrTime(str, default_format, out parsed_date_time)
+ && parsed_date_time.IsDateFound
+ && parsed_date_time.IsTimeFound
+ )
+ return true;
+
+ parsed_date_time = null;
+ return false;
+ }
+
+ ///
+ /// Tries to find time within the passed string and return it as ParsedDateTime object.
+ /// It recognizes only time while ignoring date, so date in the returned ParsedDateTime is always 1/1/1
+ ///
+ /// string that contains date-time
+ /// format to be used preferably in ambivalent instances
+ /// parsed date-time output
+ /// true if time was found, else false
+ static public bool TryParseTime(this string str, DateTimeFormat default_format, out ParsedDateTime parsed_time)
+ {
+ return TryParseTime(str, default_format, out parsed_time, null);
+ }
+
+ ///
+ /// Tries to find date and/or time within the passed string and return it as ParsedDateTime object.
+ /// If only date was found, time in the returned ParsedDateTime is always 0:0:0.
+ /// If only time was found, date in the returned ParsedDateTime is DefaultDate.
+ ///
+ /// string that contains date-time
+ /// format to be used preferably in ambivalent instances
+ /// parsed date-time output
+ /// true if date or time was found, else false
+ static public bool TryParseDateOrTime(this string str, DateTimeFormat default_format, out ParsedDateTime parsed_date_time)
+ {
+ parsed_date_time = null;
+
+ ParsedDateTime parsed_date;
+ ParsedDateTime parsed_time;
+ if (!TryParseDate(str, default_format, out parsed_date))
+ {
+ if (!TryParseTime(str, default_format, out parsed_time, null))
+ return false;
+
+ DateTime date_time = new DateTime(DefaultDate.Year, DefaultDate.Month, DefaultDate.Day, parsed_time.DateTime.Hour, parsed_time.DateTime.Minute, parsed_time.DateTime.Second);
+ parsed_date_time = new ParsedDateTime(-1, -1, parsed_time.IndexOfTime, parsed_time.LengthOfTime, date_time, parsed_time.UtcOffset);
+ }
+ else
+ {
+ if (!TryParseTime(str, default_format, out parsed_time, parsed_date))
+ {
+ DateTime date_time = new DateTime(parsed_date.DateTime.Year, parsed_date.DateTime.Month, parsed_date.DateTime.Day, 0, 0, 0);
+ parsed_date_time = new ParsedDateTime(parsed_date.IndexOfDate, parsed_date.LengthOfDate, -1, -1, date_time);
+ }
+ else
+ {
+ DateTime date_time = new DateTime(parsed_date.DateTime.Year, parsed_date.DateTime.Month, parsed_date.DateTime.Day, parsed_time.DateTime.Hour, parsed_time.DateTime.Minute, parsed_time.DateTime.Second);
+ parsed_date_time = new ParsedDateTime(parsed_date.IndexOfDate, parsed_date.LengthOfDate, parsed_time.IndexOfTime, parsed_time.LengthOfTime, date_time, parsed_time.UtcOffset);
+ }
+ }
+
+ return true;
+ }
+
+ #endregion
+
+ #region parsing base methods
+
+ ///
+ /// Tries to find time within the passed string (relatively to the passed parsed_date if any) and return it as ParsedDateTime object.
+ /// It recognizes only time while ignoring date, so date in the returned ParsedDateTime is always 1/1/1
+ ///
+ /// string that contains date
+ /// format to be used preferably in ambivalent instances
+ /// parsed date-time output
+ /// ParsedDateTime object if the date was found within this string, else NULL
+ /// true if time was found, else false
+ public static bool TryParseTime(this string str, DateTimeFormat default_format, out ParsedDateTime parsed_time, ParsedDateTime parsed_date)
+ {
+ parsed_time = null;
+
+ string time_zone_r;
+ if(default_format == DateTimeFormat.USA_DATE)
+ time_zone_r = @"(?:\s*(?'time_zone'UTC|GMT|CST|EST))?";
+ else
+ time_zone_r = @"(?:\s*(?'time_zone'UTC|GMT))?";
+
+ Match m;
+ if (parsed_date != null && parsed_date.IndexOfDate > -1)
+ {//look around the found date
+ //look for hh:mm:ss
+ m = Regex.Match(str.Substring(parsed_date.IndexOfDate + parsed_date.LengthOfDate), @"(?<=^\s*,?\s+|^\s*at\s*|^\s*[T\-]\s*)(?'hour'\d{2})\s*:\s*(?'minute'\d{2})\s*:\s*(?'second'\d{2})\s+(?'offset_sign'[\+\-])(?'offset_hh'\d{2}):?(?'offset_mm'\d{2})(?=$|[^\d\w])", RegexOptions.Compiled);
+ if (!m.Success)
+ //look for [h]h:mm[:ss] [PM/AM] [UTC/GMT]
+ m = Regex.Match(str.Substring(parsed_date.IndexOfDate + parsed_date.LengthOfDate), @"(?<=^\s*,?\s+|^\s*at\s*|^\s*[T\-]\s*)(?'hour'\d{1,2})\s*:\s*(?'minute'\d{2})\s*(?::\s*(?'second'\d{2}))?(?:\s*(?'ampm'AM|am|PM|pm))?"+time_zone_r+@"(?=$|[^\d\w])", RegexOptions.Compiled);
+ if (!m.Success)
+ //look for [h]h:mm:ss [PM/AM] [UTC/GMT]
+ m = Regex.Match(str.Substring(0, parsed_date.IndexOfDate), @"(?<=^|[^\d])(?'hour'\d{1,2})\s*:\s*(?'minute'\d{2})\s*(?::\s*(?'second'\d{2}))?(?:\s*(?'ampm'AM|am|PM|pm))?"+time_zone_r+@"(?=$|[\s,]+)", RegexOptions.Compiled);
+ if (!m.Success)
+ //look for [h]h:mm:ss [PM/AM] [UTC/GMT] within
+ m = Regex.Match(str.Substring(parsed_date.IndexOfDate, parsed_date.LengthOfDate), @"(?<=^|[^\d])(?'hour'\d{1,2})\s*:\s*(?'minute'\d{2})\s*(?::\s*(?'second'\d{2}))?(?:\s*(?'ampm'AM|am|PM|pm))?"+time_zone_r+@"(?=$|[\s,]+)", RegexOptions.Compiled);
+ }
+ else//look anywhere within string
+ {
+ //look for hh:mm:ss
+ m = Regex.Match(str, @"(?<=^|\s+|\s*T\s*)(?'hour'\d{2})\s*:\s*(?'minute'\d{2})\s*:\s*(?'second'\d{2})\s+(?'offset_sign'[\+\-])(?'offset_hh'\d{2}):?(?'offset_mm'\d{2})?(?=$|[^\d\w])", RegexOptions.Compiled);
+ if (!m.Success)
+ //look for [h]h:mm[:ss] [PM/AM] [UTC/GMT]
+ m = Regex.Match(str, @"(?<=^|\s+|\s*T\s*)(?'hour'\d{1,2})\s*:\s*(?'minute'\d{2})\s*(?::\s*(?'second'\d{2}))?(?:\s*(?'ampm'AM|am|PM|pm))?"+time_zone_r+@"(?=$|[^\d\w])", RegexOptions.Compiled);
+ }
+
+ if (!m.Success)
+ return false;
+
+ //try
+ //{
+ int hour = int.Parse(m.Groups["hour"].Value);
+ if (hour < 0 || hour > 23)
+ return false;
+
+ int minute = int.Parse(m.Groups["minute"].Value);
+ if (minute < 0 || minute > 59)
+ return false;
+
+ int second = 0;
+ if (!string.IsNullOrEmpty(m.Groups["second"].Value))
+ {
+ second = int.Parse(m.Groups["second"].Value);
+ if (second < 0 || second > 59)
+ return false;
+ }
+
+ if (string.Compare(m.Groups["ampm"].Value, "PM", true) == 0 && hour < 12)
+ hour += 12;
+ else if (string.Compare(m.Groups["ampm"].Value, "AM", true) == 0 && hour == 12)
+ hour -= 12;
+
+ DateTime date_time = new DateTime(1, 1, 1, hour, minute, second);
+
+ if (m.Groups["offset_hh"].Success)
+ {
+ int offset_hh = int.Parse(m.Groups["offset_hh"].Value);
+ int offset_mm = 0;
+ if (m.Groups["offset_mm"].Success)
+ offset_mm = int.Parse(m.Groups["offset_mm"].Value);
+ TimeSpan utc_offset = new TimeSpan(offset_hh, offset_mm, 0);
+ if (m.Groups["offset_sign"].Value == "-")
+ utc_offset = -utc_offset;
+ parsed_time = new ParsedDateTime(-1, -1, m.Index, m.Length, date_time, utc_offset);
+ return true;
+ }
+
+ if (m.Groups["time_zone"].Success)
+ {
+ TimeSpan utc_offset;
+ switch (m.Groups["time_zone"].Value)
+ {
+ case "UTC":
+ case "GMT":
+ utc_offset = new TimeSpan(0, 0, 0);
+ break;
+ case "CST":
+ utc_offset = new TimeSpan(-6, 0, 0);
+ break;
+ case "EST":
+ utc_offset = new TimeSpan(-5, 0, 0);
+ break;
+ default:
+ throw new Exception("Time zone: " + m.Groups["time_zone"].Value + " is not defined.");
+ }
+ parsed_time = new ParsedDateTime(-1, -1, m.Index, m.Length, date_time, utc_offset);
+ return true;
+ }
+
+ parsed_time = new ParsedDateTime(-1, -1, m.Index, m.Length, date_time);
+ //}
+ //catch(Exception e)
+ //{
+ // return false;
+ //}
+ return true;
+ }
+
+ ///
+ /// Tries to find date within the passed string and return it as ParsedDateTime object.
+ /// It recognizes only date while ignoring time, so time in the returned ParsedDateTime is always 0:0:0.
+ /// If year of the date was not found then it accepts the current year.
+ ///
+ /// string that contains date
+ /// format to be used preferably in ambivalent instances
+ /// parsed date output
+ /// true if date was found, else false
+ static public bool TryParseDate(this string str, DateTimeFormat default_format, out ParsedDateTime parsed_date)
+ {
+ parsed_date = null;
+
+ if (string.IsNullOrEmpty(str))
+ return false;
+
+ //look for dd/mm/yy
+ Match m = Regex.Match(str, @"(?<=^|[^\d])(?'day'\d{1,2})\s*(?'separator'[\\/\.])+\s*(?'month'\d{1,2})\s*\'separator'+\s*(?'year'\d{2}|\d{4})(?=$|[^\d])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ if (m.Success)
+ {
+ DateTime date;
+ if ((default_format ^ DateTimeFormat.USA_DATE) == DateTimeFormat.USA_DATE)
+ {
+ if (!convert_to_date(int.Parse(m.Groups["year"].Value), int.Parse(m.Groups["day"].Value), int.Parse(m.Groups["month"].Value), out date))
+ return false;
+ }
+ else
+ {
+ if (!convert_to_date(int.Parse(m.Groups["year"].Value), int.Parse(m.Groups["month"].Value), int.Parse(m.Groups["day"].Value), out date))
+ return false;
+ }
+ parsed_date = new ParsedDateTime(m.Index, m.Length, -1, -1, date);
+ return true;
+ }
+
+ //look for [yy]yy-mm-dd
+ m = Regex.Match(str, @"(?<=^|[^\d])(?'year'\d{2}|\d{4})\s*(?'separator'[\-])\s*(?'month'\d{1,2})\s*\'separator'+\s*(?'day'\d{1,2})(?=$|[^\d])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ if (m.Success)
+ {
+ DateTime date;
+ if (!convert_to_date(int.Parse(m.Groups["year"].Value), int.Parse(m.Groups["month"].Value), int.Parse(m.Groups["day"].Value), out date))
+ return false;
+ parsed_date = new ParsedDateTime(m.Index, m.Length, -1, -1, date);
+ return true;
+ }
+
+ //look for month dd yyyy
+ m = Regex.Match(str, @"(?:^|[^\d\w])(?'month'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[uarychilestmbro]*\s+(?'day'\d{1,2})(?:-?st|-?th|-?rd|-?nd)?\s*,?\s*(?'year'\d{4})(?=$|[^\d\w])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ if (!m.Success)
+ //look for dd month [yy]yy
+ m = Regex.Match(str, @"(?:^|[^\d\w:])(?'day'\d{1,2})(?:-?st\s+|-?th\s+|-?rd\s+|-?nd\s+|-|\s+)(?'month'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[uarychilestmbro]*(?:\s*,?\s*|-)'?(?'year'\d{2}|\d{4})(?=$|[^\d\w])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ if (!m.Success)
+ //look for yyyy month dd
+ m = Regex.Match(str, @"(?:^|[^\d\w])(?'year'\d{4})\s+(?'month'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[uarychilestmbro]*\s+(?'day'\d{1,2})(?:-?st|-?th|-?rd|-?nd)?(?=$|[^\d\w])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ if (!m.Success)
+ //look for month dd hh:mm:ss MDT|UTC yyyy
+ m = Regex.Match(str, @"(?:^|[^\d\w])(?'month'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[uarychilestmbro]*\s+(?'day'\d{1,2})\s+\d{2}\:\d{2}\:\d{2}\s+(?:MDT|UTC)\s+(?'year'\d{4})(?=$|[^\d\w])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ if (!m.Success)
+ //look for month dd [yyyy]
+ m = Regex.Match(str, @"(?:^|[^\d\w])(?'month'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[uarychilestmbro]*\s+(?'day'\d{1,2})(?:-?st|-?th|-?rd|-?nd)?(?:\s*,?\s*(?'year'\d{4}))?(?=$|[^\d\w])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+ if (m.Success)
+ {
+ int month = -1;
+ int index_of_date = m.Index;
+ int length_of_date = m.Length;
+
+ switch (m.Groups["month"].Value)
+ {
+ case "Jan":
+ case "JAN":
+ month = 1;
+ break;
+ case "Feb":
+ case "FEB":
+ month = 2;
+ break;
+ case "Mar":
+ case "MAR":
+ month = 3;
+ break;
+ case "Apr":
+ case "APR":
+ month = 4;
+ break;
+ case "May":
+ case "MAY":
+ month = 5;
+ break;
+ case "Jun":
+ case "JUN":
+ month = 6;
+ break;
+ case "Jul":
+ month = 7;
+ break;
+ case "Aug":
+ case "AUG":
+ month = 8;
+ break;
+ case "Sep":
+ case "SEP":
+ month = 9;
+ break;
+ case "Oct":
+ case "OCT":
+ month = 10;
+ break;
+ case "Nov":
+ case "NOV":
+ month = 11;
+ break;
+ case "Dec":
+ case "DEC":
+ month = 12;
+ break;
+ }
+
+ int year;
+ if (!string.IsNullOrEmpty(m.Groups["year"].Value))
+ year = int.Parse(m.Groups["year"].Value);
+ else
+ year = DefaultDate.Year;
+
+ DateTime date;
+ if (!convert_to_date(year, month, int.Parse(m.Groups["day"].Value), out date))
+ return false;
+ parsed_date = new ParsedDateTime(index_of_date, length_of_date, -1, -1, date);
+ return true;
+ }
+
+ return false;
+ }
+
+ static bool convert_to_date(int year, int month, int day, out DateTime date)
+ {
+ if (year >= 100)
+ {
+ if (year < 1000)
+ {
+ date = new DateTime(1, 1, 1);
+ return false;
+ }
+ }
+ else
+ if (year > 30)
+ year += 1900;
+ else
+ year += 2000;
+
+ try
+ {
+ date = new DateTime(year, month, day);
+ }
+ catch
+ {
+ date = new DateTime(1, 1, 1);
+ return false;
+ }
+ return true;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/DateTimeRoutines/DateTimeRoutines.csproj b/src/DateTimeRoutines/DateTimeRoutines.csproj
new file mode 100644
index 000000000..da38696fd
--- /dev/null
+++ b/src/DateTimeRoutines/DateTimeRoutines.csproj
@@ -0,0 +1,7 @@
+
+
+
+ netstandard1.5;net452
+
+
+
diff --git a/src/Jackett.Test/Services/ProtectionServiceTests.cs b/src/Jackett.Test/Services/ProtectionServiceTests.cs
index c9e732da1..00f9449d6 100644
--- a/src/Jackett.Test/Services/ProtectionServiceTests.cs
+++ b/src/Jackett.Test/Services/ProtectionServiceTests.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autofac;
+using Jackett.Services.Interfaces;
namespace Jackett.Test.Services
{
diff --git a/src/Jackett.Test/TestIIndexerManagerServiceHelper.cs b/src/Jackett.Test/TestIIndexerManagerServiceHelper.cs
index 61250626b..5b6cc75f6 100644
--- a/src/Jackett.Test/TestIIndexerManagerServiceHelper.cs
+++ b/src/Jackett.Test/TestIIndexerManagerServiceHelper.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Indexers;
using Newtonsoft.Json.Linq;
+using Jackett.Services.Interfaces;
namespace Jackett.Test
{
diff --git a/src/Jackett.Test/TestUtil.cs b/src/Jackett.Test/TestUtil.cs
index 941c4a6d5..14a771872 100644
--- a/src/Jackett.Test/TestUtil.cs
+++ b/src/Jackett.Test/TestUtil.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using Jackett.Services.Interfaces;
namespace Jackett.Test
{
diff --git a/src/Jackett.Test/TestWebClient.cs b/src/Jackett.Test/TestWebClient.cs
index 653ef35ac..2cb94c229 100644
--- a/src/Jackett.Test/TestWebClient.cs
+++ b/src/Jackett.Test/TestWebClient.cs
@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Jackett.Services.Interfaces;
namespace Jackett.Test
{
diff --git a/src/Jackett.sln b/src/Jackett.sln
index e8681efce..1c0b22166 100644
--- a/src/Jackett.sln
+++ b/src/Jackett.sln
@@ -4,7 +4,7 @@ VisualStudioVersion = 15.0.27004.2005
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett", "Jackett\Jackett.csproj", "{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CurlSharp", "CurlSharp\CurlSharp.csproj", "{74420A79-CC16-442C-8B1E-7C1B913844F0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CurlSharp", "CurlSharp\CurlSharp.csproj", "{74420A79-CC16-442C-8B1E-7C1B913844F0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BE7B0C8A-6144-47CD-821E-B09BA1B7BADE}"
ProjectSection(SolutionItems) = preProject
@@ -24,6 +24,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Updater", "Jackett.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Test", "Jackett.Test\Jackett.Test.csproj", "{FA22C904-9F5D-4D3C-9122-3E33652E7373}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Vendor", "Vendor", "{7D7FA63C-3C2C-4B56-BD93-8CD28CF44E5D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DateTimeRoutines", "DateTimeRoutines\DateTimeRoutines.csproj", "{C28A79EE-EF81-4EEE-A7FE-EB636423C935}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -58,12 +62,20 @@ Global
{FA22C904-9F5D-4D3C-9122-3E33652E7373}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA22C904-9F5D-4D3C-9122-3E33652E7373}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA22C904-9F5D-4D3C-9122-3E33652E7373}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C28A79EE-EF81-4EEE-A7FE-EB636423C935}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C28A79EE-EF81-4EEE-A7FE-EB636423C935}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C28A79EE-EF81-4EEE-A7FE-EB636423C935}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C28A79EE-EF81-4EEE-A7FE-EB636423C935}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {74420A79-CC16-442C-8B1E-7C1B913844F0} = {7D7FA63C-3C2C-4B56-BD93-8CD28CF44E5D}
+ {C28A79EE-EF81-4EEE-A7FE-EB636423C935} = {7D7FA63C-3C2C-4B56-BD93-8CD28CF44E5D}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {EAA42E3F-ECA9-4A9C-BCD6-D730DD817B76}
+ SolutionGuid = {54BC4102-8B85-49C1-BA12-257D941D1B97}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
diff --git a/src/Jackett/Controllers/BlackholeController.cs b/src/Jackett/Controllers/BlackholeController.cs
index a65444dbd..b5d551e5b 100644
--- a/src/Jackett/Controllers/BlackholeController.cs
+++ b/src/Jackett/Controllers/BlackholeController.cs
@@ -1,18 +1,13 @@
-using Jackett.Services;
-using Jackett.Utils;
+using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
+using Jackett.Services.Interfaces;
namespace Jackett.Controllers
{
diff --git a/src/Jackett/Controllers/DownloadController.cs b/src/Jackett/Controllers/DownloadController.cs
index 36cb6b90b..374366091 100644
--- a/src/Jackett/Controllers/DownloadController.cs
+++ b/src/Jackett/Controllers/DownloadController.cs
@@ -1,8 +1,5 @@
-using Jackett.Services;
-using NLog;
+using NLog;
using System;
-using System.Collections.Generic;
-using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
@@ -12,6 +9,7 @@ using System.Web;
using System.Web.Http;
using MonoTorrent.BEncoding;
using Jackett.Utils;
+using Jackett.Services.Interfaces;
namespace Jackett.Controllers
{
diff --git a/src/Jackett/Controllers/IndexerApiController.cs b/src/Jackett/Controllers/IndexerApiController.cs
index 0a14a4fe1..1934b350b 100644
--- a/src/Jackett/Controllers/IndexerApiController.cs
+++ b/src/Jackett/Controllers/IndexerApiController.cs
@@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
-using AutoMapper;
using Jackett.Indexers;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Controllers/ResultsController.cs b/src/Jackett/Controllers/ResultsController.cs
index 50506e05e..58df84c50 100644
--- a/src/Jackett/Controllers/ResultsController.cs
+++ b/src/Jackett/Controllers/ResultsController.cs
@@ -5,21 +5,17 @@ using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
-using System.Text.RegularExpressions;
using System.Threading.Tasks;
-using System.Web;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using System.Xml.Linq;
using Jackett.Indexers;
using Jackett.Models;
-using Jackett.Services;
using Jackett.Utils;
-using Jackett.Utils.Clients;
-using Newtonsoft.Json;
using NLog;
using Jackett.Models.DTO;
+using Jackett.Services.Interfaces;
namespace Jackett.Controllers.V20
{
diff --git a/src/Jackett/Controllers/ServerConfigurationController.cs b/src/Jackett/Controllers/ServerConfigurationController.cs
index 9168437ec..ab7198cc6 100644
--- a/src/Jackett/Controllers/ServerConfigurationController.cs
+++ b/src/Jackett/Controllers/ServerConfigurationController.cs
@@ -6,6 +6,7 @@ using System.Threading;
using System.Web.Http;
using Jackett.Models;
using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using NLog;
diff --git a/src/Jackett/Controllers/UIController.cs b/src/Jackett/Controllers/UIController.cs
index 7e0a21ce8..99e61f959 100644
--- a/src/Jackett/Controllers/UIController.cs
+++ b/src/Jackett/Controllers/UIController.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using NLog;
diff --git a/src/Jackett/Engine.cs b/src/Jackett/Engine.cs
index 65d006bec..96c9fb78d 100644
--- a/src/Jackett/Engine.cs
+++ b/src/Jackett/Engine.cs
@@ -12,6 +12,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web.Http.Dependencies;
using Autofac.Integration.WebApi;
+using Jackett.Services.Interfaces;
namespace Jackett
{
diff --git a/src/Jackett/Indexers/7tor.cs b/src/Jackett/Indexers/7tor.cs
index 3c6077dba..9d2795f8e 100644
--- a/src/Jackett/Indexers/7tor.cs
+++ b/src/Jackett/Indexers/7tor.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Abnormal.cs b/src/Jackett/Indexers/Abnormal.cs
index 284cda5ec..e0aee3a8c 100644
--- a/src/Jackett/Indexers/Abnormal.cs
+++ b/src/Jackett/Indexers/Abnormal.cs
@@ -11,7 +11,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig.Bespoke;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/Abstract/AvistazTracker.cs b/src/Jackett/Indexers/Abstract/AvistazTracker.cs
index bdebc3529..7d4777e7f 100644
--- a/src/Jackett/Indexers/Abstract/AvistazTracker.cs
+++ b/src/Jackett/Indexers/Abstract/AvistazTracker.cs
@@ -7,14 +7,12 @@ using Jackett.Models;
using Newtonsoft.Json.Linq;
using NLog;
using Jackett.Utils;
-using System.Net;
-using System.Net.Http;
using CsQuery;
using System.Web;
-using Jackett.Services;
using Jackett.Utils.Clients;
using System.Text.RegularExpressions;
using Jackett.Models.IndexerConfig;
+using Jackett.Services.Interfaces;
namespace Jackett.Indexers
{
diff --git a/src/Jackett/Indexers/Abstract/CouchPotatoTracker.cs b/src/Jackett/Indexers/Abstract/CouchPotatoTracker.cs
index e688fdef1..2a211f129 100644
--- a/src/Jackett/Indexers/Abstract/CouchPotatoTracker.cs
+++ b/src/Jackett/Indexers/Abstract/CouchPotatoTracker.cs
@@ -9,6 +9,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Threading.Tasks;
+using Jackett.Services.Interfaces;
namespace Jackett.Indexers.Abstract
{
diff --git a/src/Jackett/Indexers/Abstract/GazelleTracker.cs b/src/Jackett/Indexers/Abstract/GazelleTracker.cs
index e2224a912..4eb05141f 100644
--- a/src/Jackett/Indexers/Abstract/GazelleTracker.cs
+++ b/src/Jackett/Indexers/Abstract/GazelleTracker.cs
@@ -1,8 +1,8 @@
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
using Jackett.Utils;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
using NLog;
diff --git a/src/Jackett/Indexers/AlphaRatio.cs b/src/Jackett/Indexers/AlphaRatio.cs
index d50e23f90..1cb928dba 100644
--- a/src/Jackett/Indexers/AlphaRatio.cs
+++ b/src/Jackett/Indexers/AlphaRatio.cs
@@ -1,6 +1,6 @@
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/Andraste.cs b/src/Jackett/Indexers/Andraste.cs
index bda5099d0..2ba71e83f 100644
--- a/src/Jackett/Indexers/Andraste.cs
+++ b/src/Jackett/Indexers/Andraste.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/AnimeBytes.cs b/src/Jackett/Indexers/AnimeBytes.cs
index ea2103f0d..44098f2d7 100644
--- a/src/Jackett/Indexers/AnimeBytes.cs
+++ b/src/Jackett/Indexers/AnimeBytes.cs
@@ -9,7 +9,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig.Bespoke;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/AnimeTorrents.cs b/src/Jackett/Indexers/AnimeTorrents.cs
index d8ac5b6d3..b40c082cb 100644
--- a/src/Jackett/Indexers/AnimeTorrents.cs
+++ b/src/Jackett/Indexers/AnimeTorrents.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Avistaz.cs b/src/Jackett/Indexers/Avistaz.cs
index 3f0a0ff1f..80106da3d 100644
--- a/src/Jackett/Indexers/Avistaz.cs
+++ b/src/Jackett/Indexers/Avistaz.cs
@@ -1,4 +1,4 @@
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/BB.cs b/src/Jackett/Indexers/BB.cs
index 08e2c344c..49007bf9f 100644
--- a/src/Jackett/Indexers/BB.cs
+++ b/src/Jackett/Indexers/BB.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/BJShare.cs b/src/Jackett/Indexers/BJShare.cs
index c5e936bdf..6b042dc81 100644
--- a/src/Jackett/Indexers/BJShare.cs
+++ b/src/Jackett/Indexers/BJShare.cs
@@ -9,7 +9,7 @@ using AngleSharp.Dom;
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/BakaBT.cs b/src/Jackett/Indexers/BakaBT.cs
index 352733f48..2a546c2a1 100644
--- a/src/Jackett/Indexers/BakaBT.cs
+++ b/src/Jackett/Indexers/BakaBT.cs
@@ -7,7 +7,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
using NLog;
diff --git a/src/Jackett/Indexers/BaseIndexer.cs b/src/Jackett/Indexers/BaseIndexer.cs
index 17db2d32d..0df50cf2c 100644
--- a/src/Jackett/Indexers/BaseIndexer.cs
+++ b/src/Jackett/Indexers/BaseIndexer.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using AutoMapper;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/BeyondHD.cs b/src/Jackett/Indexers/BeyondHD.cs
index 93883be27..d2a2cd856 100644
--- a/src/Jackett/Indexers/BeyondHD.cs
+++ b/src/Jackett/Indexers/BeyondHD.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/BitCityReloaded.cs b/src/Jackett/Indexers/BitCityReloaded.cs
index c214787fe..63145bee3 100644
--- a/src/Jackett/Indexers/BitCityReloaded.cs
+++ b/src/Jackett/Indexers/BitCityReloaded.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/BitHdtv.cs b/src/Jackett/Indexers/BitHdtv.cs
index cc08746c4..bb6c72966 100644
--- a/src/Jackett/Indexers/BitHdtv.cs
+++ b/src/Jackett/Indexers/BitHdtv.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/BitMeTV.cs b/src/Jackett/Indexers/BitMeTV.cs
index 57ff7159f..8512bd105 100644
--- a/src/Jackett/Indexers/BitMeTV.cs
+++ b/src/Jackett/Indexers/BitMeTV.cs
@@ -9,7 +9,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/BitSoup.cs b/src/Jackett/Indexers/BitSoup.cs
index 55704c93d..0400d9e20 100644
--- a/src/Jackett/Indexers/BitSoup.cs
+++ b/src/Jackett/Indexers/BitSoup.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/BroadcastTheNet.cs b/src/Jackett/Indexers/BroadcastTheNet.cs
index c0f85d8fa..98b6c73be 100644
--- a/src/Jackett/Indexers/BroadcastTheNet.cs
+++ b/src/Jackett/Indexers/BroadcastTheNet.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/BrokenStones.cs b/src/Jackett/Indexers/BrokenStones.cs
index e424233eb..1dc07b80e 100644
--- a/src/Jackett/Indexers/BrokenStones.cs
+++ b/src/Jackett/Indexers/BrokenStones.cs
@@ -1,6 +1,6 @@
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/CardigannIndexer.cs b/src/Jackett/Indexers/CardigannIndexer.cs
index 42cda605d..52a1344b7 100644
--- a/src/Jackett/Indexers/CardigannIndexer.cs
+++ b/src/Jackett/Indexers/CardigannIndexer.cs
@@ -1,6 +1,6 @@
using Jackett.Utils.Clients;
using NLog;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Models;
using System.Threading.Tasks;
diff --git a/src/Jackett/Indexers/CinemaZ.cs b/src/Jackett/Indexers/CinemaZ.cs
index f81f77f74..7989d0069 100644
--- a/src/Jackett/Indexers/CinemaZ.cs
+++ b/src/Jackett/Indexers/CinemaZ.cs
@@ -1,4 +1,4 @@
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/DanishBits.cs b/src/Jackett/Indexers/DanishBits.cs
index fcb4e8df0..ccea129d3 100644
--- a/src/Jackett/Indexers/DanishBits.cs
+++ b/src/Jackett/Indexers/DanishBits.cs
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
using Jackett.Indexers.Abstract;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/Demonoid.cs b/src/Jackett/Indexers/Demonoid.cs
index 57c1da6fb..0f5ff5bd0 100644
--- a/src/Jackett/Indexers/Demonoid.cs
+++ b/src/Jackett/Indexers/Demonoid.cs
@@ -8,7 +8,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/DigitalHive.cs b/src/Jackett/Indexers/DigitalHive.cs
index 220c0af67..85ea4b31d 100644
--- a/src/Jackett/Indexers/DigitalHive.cs
+++ b/src/Jackett/Indexers/DigitalHive.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/EliteTracker.cs b/src/Jackett/Indexers/EliteTracker.cs
index 7a5150805..e9ddb401b 100644
--- a/src/Jackett/Indexers/EliteTracker.cs
+++ b/src/Jackett/Indexers/EliteTracker.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Feeds/AnimeTosho.cs b/src/Jackett/Indexers/Feeds/AnimeTosho.cs
index d9133fa54..868aa0885 100644
--- a/src/Jackett/Indexers/Feeds/AnimeTosho.cs
+++ b/src/Jackett/Indexers/Feeds/AnimeTosho.cs
@@ -4,7 +4,7 @@ using System.Text;
using System.Xml.Linq;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/Feeds/BaseFeedIndexer.cs b/src/Jackett/Indexers/Feeds/BaseFeedIndexer.cs
index c4b3ed4f1..eed4eb937 100644
--- a/src/Jackett/Indexers/Feeds/BaseFeedIndexer.cs
+++ b/src/Jackett/Indexers/Feeds/BaseFeedIndexer.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Feeds/BaseNewznabIndexer.cs b/src/Jackett/Indexers/Feeds/BaseNewznabIndexer.cs
index c9479472f..0b0e89571 100644
--- a/src/Jackett/Indexers/Feeds/BaseNewznabIndexer.cs
+++ b/src/Jackett/Indexers/Feeds/BaseNewznabIndexer.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Xml.Linq;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/FileList.cs b/src/Jackett/Indexers/FileList.cs
index fd2d6c48f..68464da3f 100644
--- a/src/Jackett/Indexers/FileList.cs
+++ b/src/Jackett/Indexers/FileList.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig.Bespoke;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/FunFile.cs b/src/Jackett/Indexers/FunFile.cs
index d74079bb6..8db6d84a3 100644
--- a/src/Jackett/Indexers/FunFile.cs
+++ b/src/Jackett/Indexers/FunFile.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Fuzer.cs b/src/Jackett/Indexers/Fuzer.cs
index f229328ed..9067d9675 100644
--- a/src/Jackett/Indexers/Fuzer.cs
+++ b/src/Jackett/Indexers/Fuzer.cs
@@ -10,7 +10,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/GFTracker.cs b/src/Jackett/Indexers/GFTracker.cs
index 4aa0e910f..0ea023916 100644
--- a/src/Jackett/Indexers/GFTracker.cs
+++ b/src/Jackett/Indexers/GFTracker.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/GhostCity.cs b/src/Jackett/Indexers/GhostCity.cs
index 01d997338..a8336bd65 100644
--- a/src/Jackett/Indexers/GhostCity.cs
+++ b/src/Jackett/Indexers/GhostCity.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/GimmePeers.cs b/src/Jackett/Indexers/GimmePeers.cs
index 3faec8b79..b0a38f2c6 100644
--- a/src/Jackett/Indexers/GimmePeers.cs
+++ b/src/Jackett/Indexers/GimmePeers.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/HD4Free.cs b/src/Jackett/Indexers/HD4Free.cs
index af2900596..b6f7b07ca 100644
--- a/src/Jackett/Indexers/HD4Free.cs
+++ b/src/Jackett/Indexers/HD4Free.cs
@@ -7,7 +7,7 @@ using AngleSharp.Parser.Html;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/HDForever.cs b/src/Jackett/Indexers/HDForever.cs
index 88d5023f0..d80406b41 100644
--- a/src/Jackett/Indexers/HDForever.cs
+++ b/src/Jackett/Indexers/HDForever.cs
@@ -1,6 +1,6 @@
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/HDOnly.cs b/src/Jackett/Indexers/HDOnly.cs
index 9256fe708..22491aaf6 100644
--- a/src/Jackett/Indexers/HDOnly.cs
+++ b/src/Jackett/Indexers/HDOnly.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
using NLog;
diff --git a/src/Jackett/Indexers/HDSpace.cs b/src/Jackett/Indexers/HDSpace.cs
index 1026813d2..e1e50d103 100644
--- a/src/Jackett/Indexers/HDSpace.cs
+++ b/src/Jackett/Indexers/HDSpace.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/HDTorrents.cs b/src/Jackett/Indexers/HDTorrents.cs
index 39ab7c31f..abcaaa397 100644
--- a/src/Jackett/Indexers/HDTorrents.cs
+++ b/src/Jackett/Indexers/HDTorrents.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Hardbay.cs b/src/Jackett/Indexers/Hardbay.cs
index 08a796a0d..ad7653c01 100644
--- a/src/Jackett/Indexers/Hardbay.cs
+++ b/src/Jackett/Indexers/Hardbay.cs
@@ -6,7 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/Hebits.cs b/src/Jackett/Indexers/Hebits.cs
index c897cfb2d..882db775d 100644
--- a/src/Jackett/Indexers/Hebits.cs
+++ b/src/Jackett/Indexers/Hebits.cs
@@ -8,7 +8,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Hounddawgs.cs b/src/Jackett/Indexers/Hounddawgs.cs
index 5b017e48e..ca8aa8f1b 100644
--- a/src/Jackett/Indexers/Hounddawgs.cs
+++ b/src/Jackett/Indexers/Hounddawgs.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/HouseOfTorrents.cs b/src/Jackett/Indexers/HouseOfTorrents.cs
index e4470c452..e782dd784 100644
--- a/src/Jackett/Indexers/HouseOfTorrents.cs
+++ b/src/Jackett/Indexers/HouseOfTorrents.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/IPTorrents.cs b/src/Jackett/Indexers/IPTorrents.cs
index c5e646622..22b09e899 100644
--- a/src/Jackett/Indexers/IPTorrents.cs
+++ b/src/Jackett/Indexers/IPTorrents.cs
@@ -8,7 +8,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/ImmortalSeed.cs b/src/Jackett/Indexers/ImmortalSeed.cs
index 8ee56743f..3db685854 100644
--- a/src/Jackett/Indexers/ImmortalSeed.cs
+++ b/src/Jackett/Indexers/ImmortalSeed.cs
@@ -8,7 +8,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/LostFilm.cs b/src/Jackett/Indexers/LostFilm.cs
index 65e78ca12..effd45ebb 100644
--- a/src/Jackett/Indexers/LostFilm.cs
+++ b/src/Jackett/Indexers/LostFilm.cs
@@ -11,7 +11,7 @@ using Jackett.Models;
using Jackett.Models.IndexerConfig;
using Jackett.Utils;
using Jackett.Utils.Clients;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using AngleSharp.Dom;
using AngleSharp.Parser.Html;
diff --git a/src/Jackett/Indexers/Meta/BaseMetaIndexer.cs b/src/Jackett/Indexers/Meta/BaseMetaIndexer.cs
index 67f06ee4c..d370cee8a 100644
--- a/src/Jackett/Indexers/Meta/BaseMetaIndexer.cs
+++ b/src/Jackett/Indexers/Meta/BaseMetaIndexer.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Meta/Fallbacks.cs b/src/Jackett/Indexers/Meta/Fallbacks.cs
index f7b5e4fb2..ec31f6d60 100644
--- a/src/Jackett/Indexers/Meta/Fallbacks.cs
+++ b/src/Jackett/Indexers/Meta/Fallbacks.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
namespace Jackett.Indexers.Meta
diff --git a/src/Jackett/Indexers/Meta/MetaIndexers.cs b/src/Jackett/Indexers/Meta/MetaIndexers.cs
index ab7b64f75..4e3aaf88c 100644
--- a/src/Jackett/Indexers/Meta/MetaIndexers.cs
+++ b/src/Jackett/Indexers/Meta/MetaIndexers.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Newtonsoft.Json.Linq;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
using Jackett.Models.IndexerConfig;
diff --git a/src/Jackett/Indexers/Meta/ResultFilters.cs b/src/Jackett/Indexers/Meta/ResultFilters.cs
index 90a0a3b53..7fb5495fa 100644
--- a/src/Jackett/Indexers/Meta/ResultFilters.cs
+++ b/src/Jackett/Indexers/Meta/ResultFilters.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
namespace Jackett.Indexers.Meta
diff --git a/src/Jackett/Indexers/MoreThanTV.cs b/src/Jackett/Indexers/MoreThanTV.cs
index 82f83faa6..ccea10edb 100644
--- a/src/Jackett/Indexers/MoreThanTV.cs
+++ b/src/Jackett/Indexers/MoreThanTV.cs
@@ -11,7 +11,7 @@ using AngleSharp.Parser.Html;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/MyAnonamouse.cs b/src/Jackett/Indexers/MyAnonamouse.cs
index 5b087889a..752162438 100644
--- a/src/Jackett/Indexers/MyAnonamouse.cs
+++ b/src/Jackett/Indexers/MyAnonamouse.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/NCore.cs b/src/Jackett/Indexers/NCore.cs
index 816044a07..ade1771e0 100644
--- a/src/Jackett/Indexers/NCore.cs
+++ b/src/Jackett/Indexers/NCore.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig.Bespoke;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/NewRealWorld.cs b/src/Jackett/Indexers/NewRealWorld.cs
index 4cdce0148..b5d616af0 100644
--- a/src/Jackett/Indexers/NewRealWorld.cs
+++ b/src/Jackett/Indexers/NewRealWorld.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Norbits.cs b/src/Jackett/Indexers/Norbits.cs
index c0ad1b0e0..cff5727df 100644
--- a/src/Jackett/Indexers/Norbits.cs
+++ b/src/Jackett/Indexers/Norbits.cs
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig.Bespoke;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/PassThePopcorn.cs b/src/Jackett/Indexers/PassThePopcorn.cs
index e40e6b734..4ed17fe39 100644
--- a/src/Jackett/Indexers/PassThePopcorn.cs
+++ b/src/Jackett/Indexers/PassThePopcorn.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using System.Web;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
using NLog;
diff --git a/src/Jackett/Indexers/PiXELHD.cs b/src/Jackett/Indexers/PiXELHD.cs
index e33745abd..2d45c0757 100644
--- a/src/Jackett/Indexers/PiXELHD.cs
+++ b/src/Jackett/Indexers/PiXELHD.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/PirateTheNet.cs b/src/Jackett/Indexers/PirateTheNet.cs
index 477d467c3..a9b17c669 100644
--- a/src/Jackett/Indexers/PirateTheNet.cs
+++ b/src/Jackett/Indexers/PirateTheNet.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/PolishTracker.cs b/src/Jackett/Indexers/PolishTracker.cs
index e1e6f1504..0350127fa 100644
--- a/src/Jackett/Indexers/PolishTracker.cs
+++ b/src/Jackett/Indexers/PolishTracker.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/Pretome.cs b/src/Jackett/Indexers/Pretome.cs
index aefb409dc..a2c28b670 100644
--- a/src/Jackett/Indexers/Pretome.cs
+++ b/src/Jackett/Indexers/Pretome.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/PrivateHD.cs b/src/Jackett/Indexers/PrivateHD.cs
index 7f6022040..d547eacca 100644
--- a/src/Jackett/Indexers/PrivateHD.cs
+++ b/src/Jackett/Indexers/PrivateHD.cs
@@ -1,4 +1,4 @@
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/Psytorrents.cs b/src/Jackett/Indexers/Psytorrents.cs
index 4de3427f9..0246429af 100644
--- a/src/Jackett/Indexers/Psytorrents.cs
+++ b/src/Jackett/Indexers/Psytorrents.cs
@@ -1,6 +1,6 @@
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/Rarbg.cs b/src/Jackett/Indexers/Rarbg.cs
index 964f188f4..a730a6244 100644
--- a/src/Jackett/Indexers/Rarbg.cs
+++ b/src/Jackett/Indexers/Rarbg.cs
@@ -7,7 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Redacted.cs b/src/Jackett/Indexers/Redacted.cs
index 8339bd986..087054dd9 100644
--- a/src/Jackett/Indexers/Redacted.cs
+++ b/src/Jackett/Indexers/Redacted.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/RevolutionTT.cs b/src/Jackett/Indexers/RevolutionTT.cs
index e65a067c4..1d73ff07f 100644
--- a/src/Jackett/Indexers/RevolutionTT.cs
+++ b/src/Jackett/Indexers/RevolutionTT.cs
@@ -10,7 +10,7 @@ using System.Xml.Linq;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/SceneFZ.cs b/src/Jackett/Indexers/SceneFZ.cs
index 12ef67dfc..bd0007668 100644
--- a/src/Jackett/Indexers/SceneFZ.cs
+++ b/src/Jackett/Indexers/SceneFZ.cs
@@ -12,7 +12,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig.Bespoke;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/SceneTime.cs b/src/Jackett/Indexers/SceneTime.cs
index d5ac3294d..8be3cbd3e 100644
--- a/src/Jackett/Indexers/SceneTime.cs
+++ b/src/Jackett/Indexers/SceneTime.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Shazbat.cs b/src/Jackett/Indexers/Shazbat.cs
index 9127d66e7..6f74a71f3 100644
--- a/src/Jackett/Indexers/Shazbat.cs
+++ b/src/Jackett/Indexers/Shazbat.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/ShowRSS.cs b/src/Jackett/Indexers/ShowRSS.cs
index caf7e67fc..45c786331 100644
--- a/src/Jackett/Indexers/ShowRSS.cs
+++ b/src/Jackett/Indexers/ShowRSS.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using System.Xml;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/SpeedCD.cs b/src/Jackett/Indexers/SpeedCD.cs
index c4f49ace7..1aaa713c2 100644
--- a/src/Jackett/Indexers/SpeedCD.cs
+++ b/src/Jackett/Indexers/SpeedCD.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Superbits.cs b/src/Jackett/Indexers/Superbits.cs
index 3bbace62d..7ff6d0f6a 100644
--- a/src/Jackett/Indexers/Superbits.cs
+++ b/src/Jackett/Indexers/Superbits.cs
@@ -6,7 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/Synthesiz3r.cs b/src/Jackett/Indexers/Synthesiz3r.cs
index 78aa13fc2..146f3aad4 100644
--- a/src/Jackett/Indexers/Synthesiz3r.cs
+++ b/src/Jackett/Indexers/Synthesiz3r.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/TVChaosUK.cs b/src/Jackett/Indexers/TVChaosUK.cs
index 6768de3fe..abb091905 100644
--- a/src/Jackett/Indexers/TVChaosUK.cs
+++ b/src/Jackett/Indexers/TVChaosUK.cs
@@ -9,7 +9,7 @@ using System.Xml.Linq;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/TVVault.cs b/src/Jackett/Indexers/TVVault.cs
index 650655776..935bef80a 100644
--- a/src/Jackett/Indexers/TVVault.cs
+++ b/src/Jackett/Indexers/TVVault.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/TehConnection.cs b/src/Jackett/Indexers/TehConnection.cs
index 3234f1da1..388f8316a 100644
--- a/src/Jackett/Indexers/TehConnection.cs
+++ b/src/Jackett/Indexers/TehConnection.cs
@@ -8,7 +8,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/TorrentBytes.cs b/src/Jackett/Indexers/TorrentBytes.cs
index 5b5aa917c..2c48175e8 100644
--- a/src/Jackett/Indexers/TorrentBytes.cs
+++ b/src/Jackett/Indexers/TorrentBytes.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/TorrentDay.cs b/src/Jackett/Indexers/TorrentDay.cs
index 68631e77a..8cc35e32e 100644
--- a/src/Jackett/Indexers/TorrentDay.cs
+++ b/src/Jackett/Indexers/TorrentDay.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/TorrentHeaven.cs b/src/Jackett/Indexers/TorrentHeaven.cs
index cbd0f22c8..7bb7c8cf6 100644
--- a/src/Jackett/Indexers/TorrentHeaven.cs
+++ b/src/Jackett/Indexers/TorrentHeaven.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/TorrentLeech.cs b/src/Jackett/Indexers/TorrentLeech.cs
index a12cf3fba..09519394c 100644
--- a/src/Jackett/Indexers/TorrentLeech.cs
+++ b/src/Jackett/Indexers/TorrentLeech.cs
@@ -8,7 +8,7 @@ using System.Web;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/TorrentNetwork.cs b/src/Jackett/Indexers/TorrentNetwork.cs
index 538bd50c3..e4a64b109 100644
--- a/src/Jackett/Indexers/TorrentNetwork.cs
+++ b/src/Jackett/Indexers/TorrentNetwork.cs
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/TorrentSyndikat.cs b/src/Jackett/Indexers/TorrentSyndikat.cs
index 380fc7ef6..bbe894cf9 100644
--- a/src/Jackett/Indexers/TorrentSyndikat.cs
+++ b/src/Jackett/Indexers/TorrentSyndikat.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Torrentech.cs b/src/Jackett/Indexers/Torrentech.cs
index 3564a9bd5..034b4096d 100644
--- a/src/Jackett/Indexers/Torrentech.cs
+++ b/src/Jackett/Indexers/Torrentech.cs
@@ -8,7 +8,7 @@ using AngleSharp.Dom;
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/TransmitheNet.cs b/src/Jackett/Indexers/TransmitheNet.cs
index b1793337c..8bd24d646 100644
--- a/src/Jackett/Indexers/TransmitheNet.cs
+++ b/src/Jackett/Indexers/TransmitheNet.cs
@@ -8,7 +8,7 @@ using System.Web;
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/WiHD.cs b/src/Jackett/Indexers/WiHD.cs
index 227a17b35..bb5092373 100644
--- a/src/Jackett/Indexers/WiHD.cs
+++ b/src/Jackett/Indexers/WiHD.cs
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig.Bespoke;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/XSpeeds.cs b/src/Jackett/Indexers/XSpeeds.cs
index 9e8410d10..64ed09964 100644
--- a/src/Jackett/Indexers/XSpeeds.cs
+++ b/src/Jackett/Indexers/XSpeeds.cs
@@ -9,7 +9,7 @@ using System.Xml.Linq;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/Xthor.cs b/src/Jackett/Indexers/Xthor.cs
index f3a66dc4f..e42461900 100644
--- a/src/Jackett/Indexers/Xthor.cs
+++ b/src/Jackett/Indexers/Xthor.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using System.Web;
using Jackett.Models;
using Jackett.Models.IndexerConfig.Bespoke;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json;
diff --git a/src/Jackett/Indexers/cgpeers.cs b/src/Jackett/Indexers/cgpeers.cs
index 3b5cb74bb..362bffa9f 100644
--- a/src/Jackett/Indexers/cgpeers.cs
+++ b/src/Jackett/Indexers/cgpeers.cs
@@ -1,6 +1,6 @@
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/myAmity.cs b/src/Jackett/Indexers/myAmity.cs
index 40cfdbd49..5e2ff881f 100644
--- a/src/Jackett/Indexers/myAmity.cs
+++ b/src/Jackett/Indexers/myAmity.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/notwhatcd.cs b/src/Jackett/Indexers/notwhatcd.cs
index c3b28ed79..6d4692377 100644
--- a/src/Jackett/Indexers/notwhatcd.cs
+++ b/src/Jackett/Indexers/notwhatcd.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Jackett.Indexers.Abstract;
using Jackett.Models;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils.Clients;
using NLog;
diff --git a/src/Jackett/Indexers/rutracker.cs b/src/Jackett/Indexers/rutracker.cs
index a85417c80..aab7229d1 100644
--- a/src/Jackett/Indexers/rutracker.cs
+++ b/src/Jackett/Indexers/rutracker.cs
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using AngleSharp.Parser.Html;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/x264.cs b/src/Jackett/Indexers/x264.cs
index 06ee6e01d..b4c4ad979 100644
--- a/src/Jackett/Indexers/x264.cs
+++ b/src/Jackett/Indexers/x264.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using CsQuery;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Indexers/yts.cs b/src/Jackett/Indexers/yts.cs
index 009487985..8bbfa63af 100644
--- a/src/Jackett/Indexers/yts.cs
+++ b/src/Jackett/Indexers/yts.cs
@@ -7,7 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Jackett.Models.IndexerConfig;
-using Jackett.Services;
+using Jackett.Services.Interfaces;
using Jackett.Utils;
using Jackett.Utils.Clients;
using Newtonsoft.Json.Linq;
diff --git a/src/Jackett/Jackett.csproj b/src/Jackett/Jackett.csproj
index 9bf927f0c..686beb684 100644
--- a/src/Jackett/Jackett.csproj
+++ b/src/Jackett/Jackett.csproj
@@ -203,6 +203,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -446,12 +461,6 @@
-
-
- {74420A79-CC16-442C-8B1E-7C1B913844F0}
- CurlSharp
-
-
False
@@ -488,9 +497,6 @@
1.3.5-beta5
-
- 1.0.16
-
5.2.3
@@ -513,8 +519,16 @@
4.2.2
-
-
+
+
+ {74420a79-cc16-442c-8b1e-7c1b913844f0}
+ CurlSharp
+
+
+ {c28a79ee-ef81-4eee-a7fe-eb636423c935}
+ DateTimeRoutines
+
+