merged #823 against devel
This commit is contained in:
parent
38db937193
commit
435610e0af
2 changed files with 18 additions and 13 deletions
|
|
@ -311,7 +311,8 @@ when defined(ssl):
|
||||||
newCTX.SSLCTXSetVerify(SSLVerifyNone, nil)
|
newCTX.SSLCTXSetVerify(SSLVerifyNone, nil)
|
||||||
if newCTX == nil:
|
if newCTX == nil:
|
||||||
SSLError()
|
SSLError()
|
||||||
|
|
||||||
|
discard newCTX.SSLCTXSetMode(SSL_MODE_AUTO_RETRY)
|
||||||
newCTX.loadCertificates(certFile, keyFile)
|
newCTX.loadCertificates(certFile, keyFile)
|
||||||
return PSSLContext(newCTX)
|
return PSSLContext(newCTX)
|
||||||
|
|
||||||
|
|
@ -1291,14 +1292,14 @@ proc readLine*(socket: TSocket, line: var TaintedString, timeout = -1) {.
|
||||||
var c: char
|
var c: char
|
||||||
discard waitFor(socket, waited, timeout, 1, "readLine")
|
discard waitFor(socket, waited, timeout, 1, "readLine")
|
||||||
var n = recv(socket, addr(c), 1)
|
var n = recv(socket, addr(c), 1)
|
||||||
if n < 0: osError(osLastError())
|
if n < 0: socket.socketError()
|
||||||
elif n == 0: return
|
elif n == 0: return
|
||||||
if c == '\r':
|
if c == '\r':
|
||||||
discard waitFor(socket, waited, timeout, 1, "readLine")
|
discard waitFor(socket, waited, timeout, 1, "readLine")
|
||||||
n = peekChar(socket, c)
|
n = peekChar(socket, c)
|
||||||
if n > 0 and c == '\L':
|
if n > 0 and c == '\L':
|
||||||
discard recv(socket, addr(c), 1)
|
discard recv(socket, addr(c), 1)
|
||||||
elif n <= 0: osError(osLastError())
|
elif n <= 0: socket.socketError()
|
||||||
addNLIfEmpty()
|
addNLIfEmpty()
|
||||||
return
|
return
|
||||||
elif c == '\L':
|
elif c == '\L':
|
||||||
|
|
|
||||||
|
|
@ -268,14 +268,22 @@ proc OpenSSL_add_all_algorithms*(){.cdecl, dynlib: DLLUtilName, importc: "OPENSS
|
||||||
|
|
||||||
proc OPENSSL_config*(configName: cstring){.cdecl, dynlib: DLLSSLName, importc.}
|
proc OPENSSL_config*(configName: cstring){.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc CRYPTO_set_mem_functions(a,b,c: pointer){.cdecl, dynlib: DLLSSLName, importc.}
|
when not defined(windows):
|
||||||
|
proc CRYPTO_set_mem_functions(a,b,c: pointer){.cdecl,
|
||||||
|
dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc CRYPTO_malloc_init*() =
|
proc CRYPTO_malloc_init*() =
|
||||||
when not defined(windows):
|
when not defined(windows):
|
||||||
CRYPTO_set_mem_functions(alloc, realloc, dealloc)
|
CRYPTO_set_mem_functions(alloc, realloc, dealloc)
|
||||||
|
|
||||||
when True:
|
proc SSL_CTX_ctrl*(ctx: PSSL_CTX, cmd: cInt, larg: int, parg: pointer): int{.
|
||||||
nil
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
|
proc SSLCTXSetMode*(ctx: PSSL_CTX, mode: int): int =
|
||||||
|
result = SSL_CTX_ctrl(ctx, SSL_CTRL_MODE, mode, nil)
|
||||||
|
|
||||||
|
when true:
|
||||||
|
discard
|
||||||
else:
|
else:
|
||||||
proc SslCtxSetCipherList*(arg0: PSSL_CTX, str: cstring): cInt{.cdecl,
|
proc SslCtxSetCipherList*(arg0: PSSL_CTX, str: cstring): cInt{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
|
|
@ -288,7 +296,6 @@ else:
|
||||||
proc SslCTXCtrl*(ctx: PSSL_CTX, cmd: cInt, larg: int, parg: Pointer): int{.
|
proc SslCTXCtrl*(ctx: PSSL_CTX, cmd: cInt, larg: int, parg: Pointer): int{.
|
||||||
cdecl, dynlib: DLLSSLName, importc.}
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SSLCTXSetMode*(ctx: PSSL_CTX, mode: int): int
|
|
||||||
proc SSLSetMode*(s: PSSL, mode: int): int
|
proc SSLSetMode*(s: PSSL, mode: int): int
|
||||||
proc SSLCTXGetMode*(ctx: PSSL_CTX): int
|
proc SSLCTXGetMode*(ctx: PSSL_CTX): int
|
||||||
proc SSLGetMode*(s: PSSL): int
|
proc SSLGetMode*(s: PSSL): int
|
||||||
|
|
@ -417,15 +424,12 @@ else:
|
||||||
enc: cInt){.cdecl, dynlib: DLLUtilName, importc.}
|
enc: cInt){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
# implementation
|
# implementation
|
||||||
|
|
||||||
proc SSLCTXSetMode(ctx: PSSL_CTX, mode: int): int =
|
|
||||||
Result = SslCTXCtrl(ctx, SSL_CTRL_MODE, mode, nil)
|
|
||||||
|
|
||||||
proc SSLSetMode(s: PSSL, mode: int): int =
|
proc SSLSetMode(s: PSSL, mode: int): int =
|
||||||
Result = SSLctrl(s, SSL_CTRL_MODE, mode, nil)
|
result = SSLctrl(s, SSL_CTRL_MODE, mode, nil)
|
||||||
|
|
||||||
proc SSLCTXGetMode(ctx: PSSL_CTX): int =
|
proc SSLCTXGetMode(ctx: PSSL_CTX): int =
|
||||||
Result = SSLCTXctrl(ctx, SSL_CTRL_MODE, 0, nil)
|
result = SSLCTXctrl(ctx, SSL_CTRL_MODE, 0, nil)
|
||||||
|
|
||||||
proc SSLGetMode(s: PSSL): int =
|
proc SSLGetMode(s: PSSL): int =
|
||||||
Result = SSLctrl(s, SSL_CTRL_MODE, 0, nil)
|
result = SSLctrl(s, SSL_CTRL_MODE, 0, nil)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue