lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev Potential patch for HTFTP.c


From: Doug Kaufman
Subject: lynx-dev Potential patch for HTFTP.c
Date: Sat, 5 Aug 2000 23:13:12 -0700 (PDT)

A user of the DOS port of lynx recently pointed out to me that
DOS mode text files (EOL=LF CR) are rendered differently by lynx,
depending on whether they are accessed via ftp:// or by http:// (or
file://). When accessed by http:// or file://, the files are seen as
they would normally be viewed by any file viewer. When accessed via
ftp://, ftp defaults to ASCII mode and shows a blank line between
each of the file lines. This can be seen both with the DOS port and
in unix binaries. It seems that lynx emulates the usual ftp client by
defaulting to ASCII mode, but only when viewing the file, not when
downloading it. I am not sure that this makes sense. Should a file be
viewed differently depending on the protocol used to access it? The
following patch attempts to change the default ftp mode for viewing
to image, leaving it ascii when using a CMS server. Does this break
anything? Does anyone else think that this change is a good idea?

As usual, please  remember that I am not a programmer. This patch was
against 2.8.4dev.4.
                             Doug


--- lynx2-8-4/WWW/Library/Implementation/HTFTP.c        Fri Jun  2 18:01:06 2000
+++ lynx2-8-4/WWW/Library/Implementation/HTFTP.c.new    Sat Aug  5 22:26:32 2000
@@ -2952,9 +2952,10 @@
        char *filename = HTParse(name, "", PARSE_PATH + PARSE_PUNCTUATION);
        char *fname = filename; /** Save for subsequent free() **/
        char *vmsname = NULL;
-       BOOL binary;
+       BOOL binary = TRUE;
        char *type = NULL;
        char *cp;
+       char *mode;
 
        if (server_type == CMS_SERVER) {
            /** If the unescaped path has a %2f, reject it as illegal. - FM **/
@@ -3064,9 +3065,6 @@
            format = HTFileFormat(filename, &encoding, NULL);
        }
        format = HTCharsetFormat(format, anchor, -1);
-       binary = (BOOL) (encoding != HTAtom_for("8bit") &&
-                 encoding != HTAtom_for("7bit"));
-       if (!binary &&
            /*
            **  Force binary if we're in source, download or dump
            **  mode and this is not a VM/CMS server, so we don't
@@ -3074,11 +3072,8 @@
            **  files.  Can't do this for VM/CMS or we'll get
            **  raw EBCDIC.  - FM
            */
-           (format_out == WWW_SOURCE ||
-            format_out == HTAtom_for("www/download") ||
-            format_out == HTAtom_for("www/dump")) &&
-           (server_type != CMS_SERVER))
-           binary = TRUE;
+       if (binary && (server_type == CMS_SERVER))
+           binary = FALSE;
        if (!binary && type && *type == 'I') {
            /*
            **  Force binary if we had ;type=I - FM
@@ -3090,18 +3085,13 @@
            */
            binary = FALSE;
        }
-       if (binary != control->binary) {
-           /*
-           **  Act on our setting if not already set. - FM
-           */
-           char * mode = binary ? "I" : "A";
+           mode = binary ? "I" : "A";
            status = send_cmd_2("TYPE", mode);
            if (status != 2) {
                init_help_message_cache();  /* to free memory */
                return ((status < 0) ? status : -status);
            }
            control->binary = binary;
-       }
        switch (server_type) {
        /*
        **  Handle what for Lynx are special case servers, e.g.,

__ 
Doug Kaufman
Internet: address@hidden


; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]