Как отправить http 101 только с одним CRLFPython

Программы на Python
Гость
Как отправить http 101 только с одним CRLF

Сообщение Гость »


There is an SSH client application that after requesting HTTP GET to an http server, should receive HTTP 101 switching protocol and a header for "Protocol Version Exchange".

The RFC 4253 -- section 4.2. Protocol Version Exchange indicates that the header format MUST be

Код: Выделить всё

SSH-protoversion-softwareversion 
example

Код: Выделить всё

SSH-2.0-OpenSSH_9.5\r\n 
and doing so in pytong3 as follow

Код: Выделить всё

... ... class MyServer(BaseHTTPRequestHandler):     def do_GET(self):         self.send_response(101)         self.send_header("Content-type", "text/plain")         self.end_headers()         self.wfile.write(bytes("SSH-2.0-OpenSSH_9.5", "utf-8")) ... ... 
the response header will be (what the SSH client receives)

Код: Выделить всё

SSH-2.0-OpenSSH_9.5\r\n\r\n 
and therefor SSH client application closes the connection.

How to properly set just one for the header or remove the second one ?

it should be and start with

Код: Выделить всё

SSH-2.0-OpenSSH_9.5\r\n 


Источник: https://stackoverflow.com/questions/781 ... h-one-crlf

Вернуться в «Python»