Movatterモバイル変換


[0]ホーム

URL:


everything curl

    TELNET

    Telnet is an ancient application protocol for bidirectionalclear-textcommunication. It was designed for interactive text-oriented communicationsandthere is no encrypted or secure version of Telnet.

    TELNET is not a perfect match for curl. The protocol is not done to handleplain uploads or downloads so the usual curl paradigms have had to bestretched somewhat to make curl deal with it appropriately.

    curl sends received data to stdout and it reads input to send on stdin. Thetransfer is complete when the connection is dropped or when the user pressescontrol-c.

    Historic TELNET

    Once upon the time, systems provided telnet access for login. Then you couldconnect to a server and login to it, much like how you would do it with SSHtoday. That practice has fortunately now mostly been moved into the museumcabinets due to the insecure nature of the protocol.

    The default port number for telnet is 23.

    Debugging with TELNET

    The fact that TELNET is basically just a simple clear-text TCP connection tothe target host and port makes it somewhat useful to debug other protocols andservices at times.

    Example, connect to your local HTTP server on port 80 and send a (broken)request to it by manually enteringGET / and press return twice:

    curl telnet://localhost:80

    Your web server most probably returns something like this back:

    HTTP/1.1 400 Bad RequestDate: Tue, 07 Dec 2021 07:41:16 GMTServer: softeare/7.8.9Content-Length: 31Connection: closeContent-Type: text/html[message]

    Options

    When curl sets up a TELNET connection to a server, you can ask it to pass onoptions. You do this with--telnet-option (or-t), and there are threeoptions available to use:

    • TTYPE=<term> sets the "terminal type" for the session to be<term>.
    • XDISPLOC=<X display> sets the X display location
    • NEW_ENV=<var,val> sets the environment variablevar to the valuevalin the remote session

    Login to your local machine's telnet server and tell it you use avt100terminal:

    curl --telnet-option TTYPE=vt100 telnet://localhost

    You need to manually enter your name and password when prompted.


    [8]ページ先頭

    ©2009-2025 Movatter.jp