pmattes / x3270

Family of IBM 3270 emulators
46 stars 18 forks source link

s3270: data containing new line #70

Closed ronytw closed 10 months ago

ronytw commented 10 months ago

I'm using a socket connection to interact with s3270 (in Java, in my case). I noticed that when the Connect action fails, the data: line it returns might, itself, contains one or more new line characters.

Here's an example interaction with telnet (easily reproducible with any fake network address):

-> % telnet localhost 3576
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Connect(someaddress.org)
data: Connection failed:
someaddress.org/23:
nodename nor servname provided, or not known
L U U N N 4 24 80 0 0 0x0 0.040
error

Of course, I can't rule out the possibility that this behaviour extends to other actions, but I haven't verified.

To understand whether this is, in fact, an issue, I tried to look at the protocol description.

Based on the following...

Each line of output produced by the action is prefixed by the string data:

... I assumed that building response parsing logic based on consuming lines and checking for that data: prefix would make sense (e.g. py3270 or j3270), but these extra lines without the appropriate prefix seem to leave them in a broken state.

Using version s3270 v4.2ga10 Mon May 29 22:29:34 UTC 2023 brew on MacOs Ventura 13.5.1.

pmattes commented 10 months ago

It took me a moment to realize that you were showing me the output of the ‘telnet’ command for comparison.

Yes, the output should not include a bare newline. I will look into this in the next day or two.

pmattes commented 10 months ago

Fixed in 4.2ga11 and 4.3beta3.