Добрый день,
Это только у меня E2210 v3.13 зависает после 10 подключений по CGI?
Симптомы следующие - после 10 подключений с успешной аутентификацией, при одинадцатом устройство больше не присылает MoxaPass cookie.
Соответственно, дальнейшие действия по CGI невозможны до перезагрузки E2210.
Код для воспроизведения ошибки:
#tested with Python v3.8.2
#lxml is not installed by default, run "pip install lxml" 1st
import hashlib
import http.client
from lxml import html
moxaServer = '10.10.10.39'
moxaPort = 80
moxaPassw = 'just1024atest'
conn = http.client.HTTPConnection(moxaServer, moxaPort, timeout = 4)
header = {'Accept': 'text/html'}
conn.request('GET', '/', '', header)
response = conn.getresponse()
body = response.read()
tree = html.fromstring(body)
tokenList = tree.xpath('/html/body/center/form//*[@name="Token"]/@value')
token = tokenList[0]
str = moxaPassw + token
md = hashlib.md5(str.encode())
auth = 'Password=' + md.hexdigest() + '&Token=' + token + '&Submit=Submit'
conn.request('POST', '/home.htm', auth, header)
response = conn.getresponse()
body = response.read()
cookie = response.getheader('Set-Cookie').replace(',', ';') #authenticated now, send cookie back in header
header = {'Cookie': cookie, 'Accept': 'text/html'}
print(header)
conn.request('GET', '/getParam.cgi?DIStatus_00=?&DIStatus_02=?', '', header)
response = conn.getresponse()
body = response.read()
print(body.decode('utf-8'))
conn.request('GET', '/setParam.cgi?DOMode_00=0&DOStatus_00=0&DOMode_01=0&DOStatus_01=0', '', header)
response = conn.getresponse()
body = response.read()
print(body.decode('utf-8'))
conn.close()