Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Reading empty directories via FTP error

From: gscottjones:mchsi at: 10-Nov-2003 23:41

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