diff options
author | bptato <nincsnevem662@gmail.com> | 2024-09-28 17:56:45 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-09-28 17:56:45 +0200 |
commit | 1dea3e9fbe4a902db6325195df0d7a465f82cfc5 (patch) | |
tree | d400bcaa2fdf4c71a81919a45c0a58a345bbc8fc /src/io | |
parent | 6a0e957e1f2c9f5bea0882efbf2e0494cd5074fa (diff) | |
download | chawan-1dea3e9fbe4a902db6325195df0d7a465f82cfc5.tar.gz |
gopher: do not depend on libcurl
I'm thinking of making libcurl entirely optional; let's start with the easiest part. I've added a SOCKS5 client for ALL_PROXY support; I know curl supported others too, but whatever.
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/dynstream.nim | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/io/dynstream.nim b/src/io/dynstream.nim index e9c69c58..4a711c12 100644 --- a/src/io/dynstream.nim +++ b/src/io/dynstream.nim @@ -80,6 +80,9 @@ proc recvDataLoop*(s: DynStream; buffer: pointer; len: int) = proc recvDataLoop*(s: DynStream; buffer: var openArray[uint8]) {.inline.} = s.recvDataLoop(addr buffer[0], buffer.len) +proc recvDataLoop*(s: DynStream; buffer: var openArray[char]) {.inline.} = + s.recvDataLoop(addr buffer[0], buffer.len) + proc recvAll*(s: DynStream): string = var buffer = newString(4096) var idx = 0 @@ -161,7 +164,10 @@ method sclose*(s: PosixStream) = s.closed = true proc newPosixStream*(fd: FileHandle): PosixStream = - return PosixStream(fd: fd, blocking: true) + return PosixStream(fd: cint(fd), blocking: true) + +proc newPosixStream*(fd: SocketHandle): PosixStream = + return PosixStream(fd: cint(fd), blocking: true) proc newPosixStream*(path: string; flags, mode: cint): PosixStream = let fd = open(cstring(path), flags, mode) |