Denys Vlasenko wrote:
On Thu, Sep 13, 2012 at 2:55 PM, Ralf Friedl <[email protected]> wrote:
Denys Vlasenko wrote:
Changed it to this in git:

                else if (c == '\r')
-                       outbuf[j++] = '\0'; /* CR -> CR NUL */
+                       /* See RFC 1123 3.3.1 Telnet End-of-Line
Convention.
+                        * Using CR LF instead of other allowed
possibilities
+                        * like CR NUL - easier to talk to HTTP/SMTP
servers.
+                        */
+                       outbuf[j++] = '\n'; /* CR -> CR LF */
This sends a CR-LF End-of-Line, but as a response to Ctrl-M.
Is that wrong or what? I don't understand what you want to say.
This change converts CR to CR-LF. But to type CR you have to press Ctrl-V Ctrl-M, not the enter key. The enter key is read as LF or '\n'. This the "end-of-line" key or "Return" or "Enter" from RFC1123 section 3.3.1. According to this section, "end-of-line" or LF should be sent by default to a telnet server and what must be sent to a non telnet server.

I looked at the behavior of the standard telnet client when talking to an SMTP server (and probably to any non telnet server) and it is this:
CR -> CR NUL
LF -> CR LF

So a single CR is converted to CR NUL to show the server that CR or '\r' or Ctrl-M was pressed. A single LF is converted to CR LF to show the server that LF or '\n' or Ctrl-J was pressed.

In line mode
the telnet client reads Ctrl-J or LF when the user presses enter.

I am not even familiar with this line mode thingy.
Let me experiment... ok, so in line more we see '\n'
from keyboard, not '\r'.
I think busybox telnet doesn't really implement the telnet linemode, but what is called 'old line by line' in the telnet manual. Just read a line terminated by '\n' from the keyboard and sent it to the server. But this mode is what I meant when I wrote line mode.

The right thing to do would be to revert this change and to add
+  else if (c == '\n' && G.charmode != CHM_ON) {
+    outbuf[j] = '\r'; /* LF -> CR LF */
+    outbuf[j++] = '\n';
+  }

Probably...
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to