Fix: Redhat/NSS based libcurl not being able to access certain indexers

This commit is contained in:
KZ
2015-07-31 20:27:59 +01:00
parent 1606e3379f
commit 796bb70421
16 changed files with 144 additions and 182 deletions

View File

@@ -118,7 +118,6 @@ 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;
@@ -293,18 +292,6 @@ namespace CurlSharp
return setCurlOpt(_curlDebugData, CurlOption.DebugData);
}
private IntPtr _curlSslCtxData = IntPtr.Zero;
/// <summary>
/// Object to pass to OnSslCtxCallback.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
private CurlCode setSslCtxData(object data)
{
_curlSslCtxData = getHandle(data);
return setCurlOpt(_curlSslCtxData, CurlOption.SslCtxData);
}
private IntPtr _curlIoctlData = IntPtr.Zero;
@@ -368,17 +355,6 @@ namespace CurlSharp
}
}
public object SslCtxData
{
get { return _sslContextData; }
set
{
_sslContextData = value;
#if !USE_LIBCURLSHIM
setSslCtxData(value);
#endif
}
}
public object IoctlData
{
@@ -538,11 +514,6 @@ namespace CurlSharp
set { setFunctionOptions(CurlOption.IoctlFunction, value); }
}
public CurlSslContextCallback SslContextFunction
{
get { return _pfCurlSslContext; }
set { setFunctionOptions(CurlOption.SslCtxFunction, value); }
}
public string LastErrorDescription
{
@@ -1262,7 +1233,6 @@ namespace CurlSharp
freeHandle(ref _curlProgressData);
freeHandle(ref _curlHeaderData);
freeHandle(ref _curlIoctlData);
freeHandle(ref _curlSslCtxData);
#endif
NativeMethods.curl_easy_cleanup(_pCurl);
@@ -1439,9 +1409,6 @@ namespace CurlSharp
case CurlOption.HeaderData:
_headerData = parameter;
break;
case CurlOption.SslCtxData:
_sslContextData = parameter;
break;
case CurlOption.IoctlData:
_ioctlData = parameter;
break;
@@ -1593,14 +1560,6 @@ namespace CurlSharp
break;
}
case CurlOption.SslCtxFunction:
{
var sf = pfn as CurlSslContextCallback;
if (sf == null)
return CurlCode.BadFunctionArgument;
_pfCurlSslContext = sf;
break;
}
case CurlOption.IoctlFunction:
{
@@ -1949,7 +1908,6 @@ namespace CurlSharp
_pcbProgress = _curlProgressCallback;
_pcbDebug = _curlDebugCallback;
_pcbHeader = _curlHeaderCallback;
_pcbSslCtx = _curlSslCtxCallback;
_pcbIoctl = _curlIoctlCallback;
setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.WriteFunction, _pcbWrite),
@@ -1962,8 +1920,6 @@ namespace CurlSharp
CurlOption.HeaderFunction);
setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.DebugFunction, _pcbDebug),
CurlOption.DebugFunction);
setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.SslCtxFunction, _pcbSslCtx),
CurlOption.SslCtxFunction);
setLastError(NativeMethods.curl_easy_setopt_cb(_pCurl, CurlOption.IoctlFunction, _pcbIoctl),
CurlOption.IoctlFunction);
setLastError(NativeMethods.curl_easy_setopt(_pCurl, CurlOption.NoProgress, (IntPtr) 0),
@@ -1974,7 +1930,6 @@ namespace CurlSharp
setHeaderData(null);
setProgressData(null);
setDebugData(null);
setSslCtxData(null);
setIoctlData(null);
#endif
}

View File

@@ -78,6 +78,7 @@
<Compile Include="Enums\CurlVersionFeatureBitmask.cs" />
<Compile Include="Callbacks\CurlEasyCallbacks.cs" />
<Compile Include="Callbacks\CurlShareCallbacks.cs" />
<Compile Include="SSLFix.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -1075,32 +1075,6 @@ namespace CurlSharp
/// </summary>
SslCipherList = 10083,
/// <summary>
/// Object reference to pass to the ssl context delegate set by the option
/// <c>SslCtxFunction</c>, this is the pointer you'll get as the
/// second parameter, otherwise <c>null</c>. (Added in 7.11.0)
/// </summary>
SslCtxData = 10109,
/// <summary>
/// Reference to an <see cref="CurlEasy.CurlSslContextCallback" /> 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 <see cref="CurlSslContext" /> 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 <c>SslCtxData</c> option. This option was introduced
/// in 7.11.0.
/// <note>
/// 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.
/// </note>
/// </summary>
SslCtxFunction = 20108,
/// <summary>
/// Pass an <c>int</c>. Set if we should verify the common name from the

13
src/CurlSharp/SSLFix.cs Normal file
View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CurlSharp
{
public class SSLFix
{
public const string CipherList = "rsa_aes_128_sha,ecdhe_rsa_aes_256_sha,ecdhe_ecdsa_aes_128_sha";
}
}