socket SSL Fehler - EOF occurred in violation of protocol

Sockets, TCP/IP, (XML-)RPC und ähnliche Themen gehören in dieses Forum
Antworten
thonix
User
Beiträge: 47
Registriert: Samstag 12. August 2006, 00:06

Hallo zuammen,

ich habe ein ssl script das leider nicht so funktioniert wie ich das gerne hätte.
Ich bekommen folgenden Fehler:

Code: Alles auswählen

Traceback (most recent call last):
  File "ms.py", line 27, in ?
    ssl = socket.ssl(proxy, None, None)
  File "/usr/lib64/python2.3/socket.py", line 73, in ssl
    return _realssl(sock, keyfile, certfile)
socket.sslerror: (8, '')

Das Script:

Code: Alles auswählen

import httplib,base64,socket

user='proxy_login';passwd='proxy_pass'
host='login.yahoo.com';port=443
phost='proxy_host';pport=80

#setup basic authentication
user_pass=base64.encodestring(user+':'+passwd)
proxy_authorization='Proxy-authorization: Basic '+user_pass+'\r\n'
proxy_connect='CONNECT %s:%s HTTP/1.0\r\n'%(host,port)
user_agent='User-Agent: python\r\n'
proxy_pieces=proxy_connect+proxy_authorization+user_agent+'\r\n'

#now connect, very simple recv and error checking
proxy=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
proxy.connect((phost,pport))
proxy.sendall(proxy_pieces)
response=proxy.recv(8192) 
status=response.split()[1]
if status!=str(200):  raise 'Error status=',str(status)

#trivial setup for ssl socket
ssl = socket.ssl(proxy, None, None)
sock = httplib.FakeSocket(proxy, ssl)

#initalize httplib and replace with your socket
h=httplib.HTTPConnection('localhost')
h.sock=sock
h.request('GET','/')
r=h.getresponse()
print r.read()
Habe ich aus einen ASPN Eintrag. Kann mir jemand den Fehlergund ein bissel näherbringen ?


Vielen Dank schon mal

Thonix
BlackJack

thonix hat geschrieben:Habe ich aus einen ASPN Eintrag.
Falls Du Rezept 301740 meinst, hast Du Dir die Kommentare durchgelesen und den Lösungsvorschlag ausprobiert?
thonix
User
Beiträge: 47
Registriert: Samstag 12. August 2006, 00:06

Hallo,

das Problem - unten - ist schon im code behoben ...
Daher kann es das nicht sein..
(8, 'EOF occurred in violation of protocol'), Tomas Brabenec, 2005/11/10
Hello all, problem with this error is here:
proxy.sendall(proxy_pieces+'\r\n')

This is fixed:
proxy.sendall(proxy_pieces)


Problem is in three end of lines in request. The request must include only two end of lines.
Zu info: Als OS ist Linux drauf ...
Antworten