On Sep 24, 1:02pm, Lars.Slettjord@cc.uit.no wrote:
} Subject: Re: ftpget is adding cr nl to the end of the lines
} I got basically the same hint from 3 of you, and I found the cause of my
} problems.
}
} In the src/ftp.c file there is a ftpTransferMode function which uses the
} table in include/mime_table.h to switch between ASCII and Binary mode for
} the FTP transfer based on the MIME type of the file.
}
} For testing purposes I have modified the function like this:
}
} static const char *
} ftpTransferMode(const char *urlpath)
} {
} const char *const ftpASCII = "A";
} const char *const ftpBinary = "I";
} /*
} * char *ext = NULL;
} * const ext_table_entry *mime = NULL;
} * int len;
} * len = strlen(urlpath);
} * if (*(urlpath + len - 1) == '/')
} * return ftpASCII;
} * if ((ext = strrchr(urlpath, '.')) == NULL)
} * return ftpBinary;
} * if ((mime = mime_ext_to_type(++ext)) == NULL)
} * return ftpBinary;
} * if (!strcmp(mime->mime_encoding, "7bit"))
} * return ftpASCII;
} */
} return ftpBinary;
} }
}
} And it will probably solve my specific problem (I'll know tomorrow when I
} have restarted my cache).
}
} But does this break anything else? There is probably a reason why it is
} done like this in the first place, even though it causes certain files to
} be modified during the transfer.
It will break as soon as you transfer a text file from a machine that
has a different line termination standard. For instance if you transfer
a something.TXT from an NT server, you'll be see CR/LF again. If you
fetch a file from a MAC, you'll see something else. If you fetch a file
from a Unix server and your client is a PC, then the line termination
won't be right.
If you're fetching a text file, the only sane thing to do is to do an
ASCII mode tranfer which always changes the line termination to CR/LF.
Your browser should then see the MIME type text/plain or whatever and
translate the CR/LF into the native line termination for your platform.
Received on Wed Sep 24 1997 - 15:53:42 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:37:10 MST