kakkyz81 / evervim

edit evernote on vim.
232 stars 48 forks source link

Python SSL Error #8

Closed hbunke closed 12 years ago

hbunke commented 12 years ago

This happens on a (rather up-to-date) Arch Linux installation with gvim 7.3.515 when I try to authenticate with Evernote (I only paste the relevant last part of the Python traceback, to give the idea):

 File "/usr/lib/python2.7/ssl.py", line 143, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 305, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [Errno 8] _ssl.c:504: EOF occurred in violation of protocol

Seems to be a SSL error, already reported elsewhere, for example here: http://devcup.evernote.com/forum_topics/1042 and http://askubuntu.com/questions/116020/python-https-requests-urllib2-to-some-sites-fail-on-ubuntu-12-04-without-proxy

ppwwyyxx commented 12 years ago

I also use Arch Linux and met with the same problem, have you managed to solve this?..

ferrouswheel commented 12 years ago

I also get this error. Damn, I was really excited about accessing evernote through vim!

ferrouswheel commented 12 years ago

This is the bug in question: https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/965371

Seems to be related to openssl rather than python, but it'd be nice if the python libraries allowed one to specify what connection protocol to use. Seems like there isn't anything evervim can do so can understand why the issue was closed.

ppwwyyxx commented 12 years ago

All right it seems so.. Using evernote is quite important so I manage to change the code in the python libraries as suggested in the bug report.

Yagger commented 12 years ago

EDIT httplib.py (/usr/lib/pythonX.X/httplib.py on Linux)

FIND HTTPSConnection class declaration

class HTTPSConnection(HTTPConnection): ....

Inside class code CHANGE line

self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)

TO

self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, ssl_version=ssl.PROTOCOL_TLSv1)

Then httplib HTTPS request should work

import httplib
from urlparse import urlparse
url = XXX
URL = urlparse(url)
connection = httplib.HTTPSConnection(URL.hostname)
connection.request('POST', URL.path + URL.query)
response = connection.getresponse()