In developing for IMAP I type raw commands into an IMAP openssl connection very often, and I'm trying to figure out how to make this tool more usable. I connect via

openssl s_client -connect imap.gmail.com:993 -crlf

(for instance)

But arrow keys rather than navigating print what I can only call "strange characters":

t login chetsteadman^[[D^[[D^[[D^[[D

(That would be left arrow)

Ideally I'd like something that operates much more like a bash shell. Left arrow goes left, ctrl+a goes to beginning of line, up arrow goes to previous line.

Trying to figure out how to get this configuration on openssl and also researching other tools that might do a better job of this. I definitely need something low level though, especially given that I'm debugging problems with line-endings in iCloud currently.


This is likely occurring because of the way you're communicating. Protocols like IMAP are designed for computers to use, not humans, and as such they routinely ignore control sequences like arrow keys and backspace. I've had the same problem when working with HTTP servers; I need to get the server command exactly right, or… HTTP 400 (Bad Request).

My solution here has been to type very carefully, or compose the requests in a text editor ahead of time and copy-and-paste each command into the terminal—OpenSSL, in your case—window as required. You could also use some sort of line editor that accepts—and lets you edit—a line of input at a time, then sends the whole line at once to the server when you press return/enter. However, I've no experience with such things, and I don't know if they could be made to work with OpenSSL without resorting to writing your own code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.