dk1z+@ANDREW.CMU.EDU (David Kovar) (06/03/87)
As several people pointed out to me, 0xa is a '\n' (newline) and 0xd is a '\r' (carriage return), so what I was seeing was CRLF-LF translations in the ascii mode of the transfer. It turns out the Stanford's FTP does indeed do binary mode correctly. I realize now why I thought that it did not. Life and debugging were a bit confused at the time. (Being told that that 0xa was ^-A and 0xd was ^-D and not bothering to think about that was a bad start.) NCSA's telnet does not do binary transfers correctly. (I tested this twice this morning, I could still be wrong, but ...). I transfered the MacPaint document down with Stanford's FTP and checked it to make sure it was valid. I uploaded it again with Stanford's FTP (and last night I think I forgot to put it back in binary mode ...) and it was fine. I uploaded it with NCSA's FTP and acquired 14 more bytes from somewhere. At line 2140 in the 6th byte, a f1ff went to a 0af1 and everything after that died. It is not the first occurance of f1ff in that file. (2120 has another one, for example.) From UNIX to Mac, NCSA does not do this. From Mac to UNIX, this happens. (I just tested it again. Binary mode, both directions. 14 more bytes coming into the UNIX machine.) Ah ha! (Excuse my rambling.) The byte before the ff in that line is a 0xd. So, NCSA added a 0xa after that, doing the translation despite binary mode transfer. But why only in one direction? /* Original file */ 0002100 ff00 47df ff00 f1f0 ffef ff01 fe8f dfff 0002120 01fc 5ff1 ffef ff01 e85f dfff 01fe 37f1 0002140 ffef ff01 da7f deff 000d f1ff <- efff 00a1 0002160 ddff 0087 f1ff f0ff 01fe d3dd ff01 e1bf 0002200 f2ff efff 000f ddff 00f1 f1ff f0ff 01fe 0002220 8fdd ff01 fc6f f2ff f0ff 01fa 7fdd ff01 0002240 fe1f f2ff f0ff 01f4 7fdc ff00 8df2 fff0 0002260 ff00 d3db ff00 cff2 fff0 ff00 a3db ff01 0002300 f17f f3ff f1ff 01fe 8fdb ff00 f1f2 fff0 /* NCSA binary mode FTP upload */ 0002100 ff00 47df ff00 f1f0 ffef ff01 fe8f dfff 0002120 01fc 5ff1 ffef ff01 e85f dfff 01fe 37f1 0002140 ffef ff01 da7f deff 000d 0af1 <- ffef ff00 0002160 a1dd ff00 87f1 fff0 ff01 fed3 ddff 01e1 0002200 bff2 ffef ff00 0fdd ff00 f1f1 fff0 ff01 0002220 fe8f ddff 01fc 6ff2 fff0 ff01 fa7f ddff 0002240 01fe 1ff2 fff0 ff01 f47f dcff 008d f2ff 0002260 f0ff 00d3 dbff 00cf f2ff f0ff 00a3 dbff 0002300 01f1 7ff3 fff1 ff01 fe8f dbff 00f1 f2ff Thank you all for the polite comments (noone said "You idiot, that's CRLF-LF!!"). -David C. Kovar (Sleep hacking is my speciality, and my embarassment.)