Hi Scott,

Well done on isolating the error. I'm just wondering though if your
corrected function has the right logic.

The original function closes the port outside the IF block for "IF empty?
file-list" but you have moved it inside along with the lines starting
"port/locals/dir-cache:"

So I guess I'm wondering if there needs to be another close for the case
when the IF fails and also whether those extra lines for the directory cache
should have been moved? I don't know one way or the other - just looking at
what has changed.

Regards,
Brett.

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Rebol List" <[EMAIL PROTECTED]>
Sent: Tuesday, November 11, 2003 10:41 AM
Subject: [REBOL] Re: Reading empty directories via FTP error


> Carl Read wrote:
> > Grrrr!
>
> Grrrr is right!
>
> You were correct in that the error occurs in the parse-dir-list function
in the
> ftp protocol.  The code closes the "port/sub-port" and then tries to use
that
> port/sub-port specification.  Whoops!
>
> The corrected function is as follows (as usual watch for line wraps):
>
> parse-dir-list: func [] [
>     all [not passive not proxy listen-port port/sub-port: first
listen-port]
>     if all [not passive proxy listen-port] [
>         net-utils/accept-proxy port/sub-port
>     ]
>     temp: 'list
>     file-list: make string! 2000
>     while [line: system/words/pick port/sub-port 1] [append file-list join
> line "^/"]
>     net-utils/confirm/multiline port/locals/cmd-port transfer-check
>     if empty? file-list [
>         data-connect
>         port/locals/dir-cache: system/words/copy []
>         insert port/locals/cmd-port "NLST"
>         if (first system/words/pick port/locals/cmd-port 1) <> #"5" [
>             while [line: system/words/pick port/sub-port 1] [
>             append file-list join line "^/"
>         ]
>         temp: 'nlist
>         net-utils/confirm/multiline port/locals/cmd-port transfer-check
>     ]
>     system/words/close port/sub-port
>     port/locals/dir-cache: parse-files file-list temp
>     foreach temp [%./ %../] [
>         if loc: find port/locals/dir-cache temp [loop 2
[system/words/remove
> loc]]
>     ]
>     port/state/tail: length? port/locals/dir-cache
> ]
>
> My bindology skills are rusty at best, so perhaps a bindologist would be
so
> kind as to create a patch for this.  The way I do it, when I forget
bindology
> (which is usually within two days of learning it), is to print the network
> scheme to disk, patch the scheme and then read it back in.
>
> One way to do this is to:
>
> 1) at a console prompt:
>     type "echo %/path-to-file/ftp-scheme.txt"
>     type "probe system/schemes/ftp"
>     type "quit"
> 2) open the ftp-scheme.txt file and change the opening to read:
>   system/schemes/ftp: make object! [
>     scheme: 'FTP
>     host: none ...
> 3) replace the parse-dir-list function
> 4) clean the ">> " from the end of the file and save.
> 5) this file may be then pasted into a console or "do" the file (adding a
rebol
> header)
>
> I look forward to seeing the "bind" version of the patch (I don't have
time to
> refigure out the bind command again).
>
> Hope that helps!
>
> --Scott Jones
> --
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
>
>

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to