Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-387

TelnetClient use of FromNetASCIIInputStream and ToNetASCIIOutputStream breaks binary mode on non-Windows platforms

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 3.0
    • Component/s: Telnet
    • Labels:
      None

      Description

      I am trying to use the telnet client in conjunction with the telnet BINARY option.

      However, the commons-net telnet client has ASCII line-ending conversion hard-coded into it! The result is that even in BINARY mode, any occurrence of CR-LF is replaced by your platform's default line ending sequence. So unless you happen to be running Windows, BINARY mode is screwed up. How ironic.

      The attached patch works for me: it seems like this line ending conversion that it's doing is not the job of this library. The telnet protocol has CRLF line endings by definition so this is what any user of this client should expect. If the user of this library wants platform-specific line endings then they can wrap their input in a java.io.LineNumberReader.

        Attachments

        1. crlf-bugfix.txt
          1 kB
          Archie Cobbs

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                archie172 Archie Cobbs
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 5m
                  5m
                  Remaining:
                  Remaining Estimate - 5m
                  5m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified