Hallo, In message <_A3227@delegate-en.ML_> on 05/19/06(22:52:55) you Steffen Kaiser <p44eqbdyi-mykgh47vj6tw.ml@delegate.org> wrote: |the same problem arise if you serve DVD images via FTP, e.g. we mirror |images for Linux distributions locally, but files greater than 2GB are |hidden. On MacOSX, I did experiments of FTP-DeleGate as both an origin server and a caching proxy server for two data of size 2.5GB (minus size in signed int) and 4.6GB (33bits size), using the "ftp" command on MacOSX as a client. It succeeded data transmission although it showed some wrong data size in FTP messages and log. So I think the problem depend on the client to be used. Anyway, I made a patch as enclosed which does: - display a file size in FTP response messages in unsigned int (by "%u" instead of "%d") - testing the existense of a cache file not based on the file size to be able to reuse a cache file larger than 2GB I know it should be the combination of "off_t" (can be 32 or 64 bits) and "%u" or "%lld" or "%I64d". With the patched version of 9.2.1, I did a test as follows. MacOSX-10.4$ ftp localhost 9998 Trying ::1... ftp: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. 220-extended FTP [MODE XDC][XDC/BASE64][PIPELINE] (1) localhost 220- localhost PROXY-FTP server (DeleGate/9.2.1) ready. 220- @ @ 220- ( - ) { DeleGate/9.2.1 (May 13, 2006) } 220- AIST-Product-ID: 2000-ETL-198715-01, H14PRO-049, H15PRO-165, H18PRO-443 ... 220 Name (localhost:yutaka): ftp 331- Guest login ok, enter your E-mail address as password. 331 Default value is: ? Password: 230- Guest login ok, your E-mail address is <?> 230 Now you can select a FTP SERVER by cd //SERVER Remote system type is UNIX. Using binary mode to transfer files. ftp> cd ftp 250 CWD command successful. ftp> ls 229 Entering Extended Passive Mode (|||54174|) 150- Opening ASCII mode data connection for LIST (54 bytes). 150 DeleGate Port(|||54174|) Cached(May 21 04:58) -rw-r--r-- 1 yutaka 2416460040 May 21 04:17 2.5GB 226 Transfer complete (54 bytes). ftp> bi 200 Type set to I ftp> get 2.5GB local: 2.5GB remote: 2.5GB 229 Entering Extended Passive Mode (|||54177|) 150 Opening BINARY mode data connection for 2.5GB (2416460040 bytes). 100% |*************************************| 2304 MB 13.11 MB/s --:-- ETA 226 Transfer complete (2416460040 bytes) -1878507256 bytes received in 02:55 (13.10 MB/s) ftp> [1]+ Stopped ftp localhost 9998 $ ls -l 2.5GB -rw-r--r-- 1 yutaka yutaka 2416460040 May 21 04:17 2.5GB (succeeded the fresh download) $ fg ftp localhost 9998 ftp> get 2.5GB local: 2.5GB remote: 2.5GB 229 Entering Extended Passive Mode (|||54181|) 150- Opening BINARY mode data connection for 2.5GB (2416460040 bytes). 150 DeleGate Port(|||54181|) Cached(May 21 05:15) 100% |*************************************| 2304 MB 19.92 MB/s --:-- ETA 226 Transfer complete (-1878507256 bytes). -1878507256 bytes received in 01:55 (19.92 MB/s) ftp> ftp> [1]+ Stopped ftp localhost 9998 $ ls -l 2.5GB -rw-r--r-- 1 yutaka yutaka 2416460040 May 21 04:17 2.5GB (succeeded the cached download) Cheers, Yutaka -- D G Yutaka Sato <pfqcabdyi-mykgh47vj6tw.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 diff -cr ../delegate9.2.1/rary/fstat.c ./rary/fstat.c *** ../delegate9.2.1/rary/fstat.c Fri Nov 11 12:21:49 2005 --- ./rary/fstat.c Sun May 21 03:46:24 2006 *************** *** 542,548 **** --- 542,551 ---- case 'M': strcpy(op,Fmodes(st)); break; case 'L': sprintf(op,"%*d",width,Fnlink(st)); break; case 'O': sprintf(op,"%*s",width,Fowner(st,AVStr(buf))); break; + /* case 'S': sprintf(op,"%*d",width,Fbytes(st)); break; + */ + case 'S': sprintf(op,"%*u",width,Fbytes(st)); break; case 'K': sprintf(op,"%*d",width,Fkbytes(st)); break; case 'D': sprintf(op,"%*s",width,rsctime(st.st_mtime,AVStr(buf))); break; case 'U': sprintf(op,"%*s",width,rsctime(st.st_atime,AVStr(buf))); break; diff -cr ../delegate9.2.1/src/cache.c ./src/cache.c *** ../delegate9.2.1/src/cache.c Sun May 7 20:13:43 2006 --- ./src/cache.c Sun May 21 05:23:22 2006 *************** *** 183,189 **** --- 183,192 ---- path_escchar(AVStr(path)); xnew = path; + /* if( File_size(old) < 0 ) + */ + if( !File_is(old) ) return -1; if( rename(old,xnew) == 0 ) *************** *** 309,315 **** --- 312,321 ---- } stat = file_stat(fileno(fp),&size,&mtime,&atime); + /* if( stat != 0 || size <= 0 ){ + */ + if( stat != 0 || size == 0 ){ /* can be empty in FTP-cache ... */ expfopen_log(what,Start,file,atime,"cache-EMPTY: %d",size,0); fclose(fp); fp = NULL; diff -cr ../delegate9.2.1/src/ftp.c ./src/ftp.c *** ../delegate9.2.1/src/ftp.c Mon May 1 20:09:35 2006 --- ./src/ftp.c Sun May 21 05:20:49 2006 *************** *** 1496,1502 **** --- 1496,1505 ---- close(cdsock); } + /* fprintf(tc,"226 Transfer complete (%d bytes)\r\n",wcc); + */ + fprintf(tc,"226 Transfer complete (%u bytes)\r\n",wcc); return wcc; } *************** *** 1650,1656 **** --- 1653,1662 ---- fprintf(tc,"213 %s\r\n",stime); }else if( strcaseeq(com,"SIZE") ){ + /* fprintf(tc,"213 %d\r\n",File_size(path)); + */ + fprintf(tc,"213 %u\r\n",File_size(path)); } }else fprintf(tc,"550 %s: No such file\r\n",arg); }else *************** *** 3143,3149 **** --- 3149,3158 ---- return -1; } int FTP_data_relay(Connection *Conn,FtpStat *FS,int src,int dst,FILE *cachefp,int tosv) + /* { CStr(buff,0x8000); + */ + { CStr(buff,0x100000); int xc,rc,wc1,wc,size; int sr,ss,dr,ds; int dstEOF; *************** *** 3804,3810 **** --- 3813,3822 ---- }else what = com; sprintf(msg, + /* "Opening %s mode data connection for %s (%d bytes).", + */ + "Opening %s mode data connection for %s (%u bytes).", mode,what,fsize); }