Hi Yutaka, Thanks for your help the new one works fine. Thx Thorsten -----Original Message----- From: Yutaka Sato [mailto:pficabdyi-pg3up57puedw.ml@delegate.org] Sent: Donnerstag, 7. Juni 2007 16:04 To: pficabdyi-pg3up57puedw.ml@delegate.org Cc: Nuellmann, Thorsten Subject: Re: [DeleGate-En:3754] ftp sftp get problem Hi, In message <_A3752@delegate-en.ML_> on 06/07/07(12:51:42) I wrote: |you "Nuellmann, Thorsten" <puyhabdyi-pg3up57puedw.ml@delegate.org> wrote: | |Hi, I have a delegate server running and try to use the ftp/sftp | |gateway. It works, I can put files bigger 500MB no problem | | | |Now I will get files from sftp server, I can only get files less 32786, | |which is the same size as the buffersize. Any idea thanks for reply | |The current (tentative) SFTP/FTP gateway of DeleGate is implemented based |on the "sftp" command so the behavior of it depends on the implementation |and specification of the sftp command and the pty device on each platform. | |Especially it is not recommended to upload a large file via the SFTP/FTP |gateway because it makes a temporary file of the copy of the transfered |data on the local disk, becuase the (resent) sftp command is implemented |to require the target file of downloaded data to be "seekable". | |But anyway the problem you saw should be fixed and the modification will |be as the enclosed patch. I uploaded DeleGate/9.6.1-pre6 (which is expected to be 9.6.1 soon) including the patch, but I found it was not enough for large files which takes longer than 10 seconds to transfer it. I'll fix it as the enclosed patch in 9.6.1. Cheers, Yutaka -- 9 9 Yutaka Sato <pfqcabdyi-pg3up57puedw.ml@delegate.org> http://delegate.org/y.sato/ ( ~ ) National Institute of Advanced Industrial Science and Technology _< >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan Do the more with the less -- B. Fuller *** /Users/yutaka/dist/src/delegate9.6.1-pre6/src/sftp.c Thu Jun 7 11:44:44 2007 --- src/sftp.c Thu Jun 7 22:57:02 2007 *************** *** 234,239 **** --- 234,240 ---- } return rcc; } + int SFTP_DATA_TIMEOUT = 10; static int relay_fifo(FILE *fs,FILE *tc,PCStr(fifo),int dsock,PCStr(com)){ FILE *sfp; FILE *dfp; *************** *** 263,269 **** --- 264,273 ---- /* nready = PollIns(1000,2,fv,rv); */ + /* nready = fPollIns(1000,2,fv,rv); + */ + nready = fPollIns(SFTP_DATA_TIMEOUT*1000,2,fv,rv); DEBUG("--SFTP poll [%s] %d[%d %d]\n",fifo,nready,rv[0],rv[1]); if( nready <= 0 ){ DEBUG("--SFTP NO RESP-B\n"); *************** *** 326,336 **** --- 330,344 ---- int file_size(int fd); int File_size(PCStr(path)); int File_is(PCStr(path)); + /* int relayFile2Fifo(FILE *rfp,PCStr(regfile),PCStr(fifo)){ + */ + int relayFile2Fifo(FILE *fs,FILE *rfp,PCStr(regfile),PCStr(fifo)){ FILE *ffp; CStr(buf,8*1024); int siz,rem,rcc,rcc1; int start; + int last = time(0); ffp = fopen(fifo,"w+"); if( rfp == 0 || ffp == 0 ) *************** *** 355,360 **** --- 363,369 ---- break; rcc += rcc1; fwrite(buf,1,rcc1,ffp); + last = time(0); }else{ if( !File_is(fifo) ){ /* fifo is unlinked on recv. complete */ *************** *** 362,367 **** --- 371,380 ---- } fflush(ffp); if( 10 < time(0)-start ){ + if( fPollIn(fs,1) == 0 + && time(0)-last < SFTP_DATA_TIMEOUT ){ + /* no prompt for the next command yet */ + }else break; } msleep(100); *************** *** 650,656 **** --- 663,672 ---- if( rfp ){ pid = Fork("SFTP-DATA"); if( pid == 0 ){ + /* relayFile2Fifo(rfp,rpath,fifo); + */ + relayFile2Fifo(fs,rfp,rpath,fifo); _exit(0); } }