diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-19 00:55:49 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-19 01:02:53 +0200 |
commit | 50932ee701f0cb9454b145dec775ada3670ea768 (patch) | |
tree | b91aa01d713b7b04c33f04a62f946354365a6c02 /src/loader/loader.nim | |
parent | 8a826ba92b7c744a995a9593834d63acd6d040b3 (diff) | |
download | chawan-50932ee701f0cb9454b145dec775ada3670ea768.tar.gz |
loader: add FTP support
works, sort of still needs some work: * better dirlist, ideally make it look like file dirlist (or make file look like ftp dirlist. well, anyway, they should look the same) * absolute paths? (for now you have to append an extra slash to the path beginning) * ssh keys for sftp? (actually I haven't even tested sftp yet...)
Diffstat (limited to 'src/loader/loader.nim')
-rw-r--r-- | src/loader/loader.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/loader/loader.nim b/src/loader/loader.nim index 162dd120..7ccd9a7f 100644 --- a/src/loader/loader.nim +++ b/src/loader/loader.nim @@ -30,8 +30,10 @@ import js/error import js/javascript import loader/about import loader/connecterror +import loader/curlhandle import loader/data import loader/file +import loader/ftp import loader/headers import loader/http import loader/loaderhandle @@ -113,6 +115,10 @@ proc loadResource(ctx: LoaderContext, request: Request, handle: LoaderHandle) = of "data": handle.loadData(request) handle.close() + of "ftp", "ftps", "sftp": + let handleData = handle.loadFtp(ctx.curlm, request) + if handleData != nil: + ctx.handleList.add(handleData) else: discard handle.sendResult(ERROR_UNKNOWN_SCHEME) handle.close() @@ -164,6 +170,8 @@ proc acceptConnection(ctx: LoaderContext) = proc finishCurlTransfer(ctx: LoaderContext, handleData: CurlHandle, res: int) = if res != int(CURLE_OK): discard handleData.handle.sendResult(int(res)) + if handleData.finish != nil: + handleData.finish(handleData) discard curl_multi_remove_handle(ctx.curlm, handleData.curl) handleData.cleanup() |