Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

SSL error #6

Closed
ipmb opened this Issue Jun 15, 2011 · 4 comments

Comments

Projects
None yet
3 participants
Contributor

ipmb commented Jun 15, 2011

I've seen this in both Py2.6 on Ubuntu and Py2.7 on OS X

In [1]: from refreshbooks import api
In [2]: c = api.TokenClient("me.freshbooks.com", "my_auth_token", user_agent="Python/0.1")
In [3]: response = c.invoice.create(invoice=dict(client_id='8', discount='33.33', status='draft', lines=[api.types.line(name='development', unit_cost='150', quantity='5')]))
---------------------------------------------------------------------------
SSLError                                  Traceback (most recent call last)

/home/pete/sandbox/freshbooks/<ipython console> in <module>()

/home/pete/sandbox/freshbooks/src/refreshbooks/refreshbooks/client.pyc in __call__(self, *args, **kwargs)
     15 
     16         request = self.request_encoder(method, *args, **kwargs)
---> 17         raw_response = self.transport(request)
     18         return self.response_decoder(raw_response)
     19 

/home/pete/sandbox/freshbooks/src/refreshbooks/refreshbooks/transport.pyc in __call__(self, entity)
     92             'POST',
     93             headers=self.headers_factory(),
---> 94             body=entity
     95         )
     96         if resp.status >= 400:

/home/pete/sandbox/freshbooks/lib/python2.6/site-packages/httplib2/__init__.pyc in request(self, uri, method, body, headers, redirections, connection_type)
   1434                     content = ""
   1435                 else:
-> 1436                     (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
   1437         except Exception, e:
   1438             if self.force_exception_to_status_code:

/home/pete/sandbox/freshbooks/lib/python2.6/site-packages/httplib2/__init__.pyc in _request(self, conn, host, absolute_uri, request_uri, method, body, headers, redirections, cachekey)
   1186             auth.request(method, request_uri, headers, body)
   1187 
-> 1188         (response, content) = self._conn_request(conn, request_uri, method, body, headers)
   1189 
   1190         if auth:

/home/pete/sandbox/freshbooks/lib/python2.6/site-packages/httplib2/__init__.pyc in _conn_request(self, conn, request_uri, method, body, headers)
   1121             try:
   1122                 if conn.sock is None:
-> 1123                   conn.connect()
   1124                 conn.request(method, request_uri, body, headers)
   1125             except socket.timeout:

/home/pete/sandbox/freshbooks/lib/python2.6/site-packages/httplib2/__init__.pyc in connect(self)
    888                 self.sock =_ssl_wrap_socket(
    889                     sock, self.key_file, self.cert_file,
--> 890                     self.disable_ssl_certificate_validation, self.ca_certs)
    891                 if self.debuglevel > 0:
    892                     print "connect: (%s, %s)" % (self.host, self.port)

/home/pete/sandbox/freshbooks/lib/python2.6/site-packages/httplib2/__init__.pyc in _ssl_wrap_socket(sock, key_file, cert_file, disable_validation, ca_certs)
     74         # of SSLv23.

     75         return ssl.wrap_socket(sock, keyfile=key_file, certfile=cert_file,
---> 76                                cert_reqs=cert_reqs, ca_certs=ca_certs)
     77 except (AttributeError, ImportError):
     78     ssl_SSLError = None

/usr/lib/python2.6/ssl.pyc in wrap_socket(sock, keyfile, certfile, server_side, cert_reqs, ssl_version, ca_certs, do_handshake_on_connect, suppress_ragged_eofs)
    348                      ssl_version=ssl_version, ca_certs=ca_certs,
    349                      do_handshake_on_connect=do_handshake_on_connect,
--> 350                      suppress_ragged_eofs=suppress_ragged_eofs)
    351 
    352 

/usr/lib/python2.6/ssl.pyc in __init__(self, sock, keyfile, certfile, server_side, cert_reqs, ssl_version, ca_certs, do_handshake_on_connect, suppress_ragged_eofs)
    111             self._sslobj = _ssl.sslwrap(self._sock, server_side,
    112                                         keyfile, certfile,
--> 113                                         cert_reqs, ssl_version, ca_certs)
    114             if do_handshake_on_connect:
    115                 timeout = self.gettimeout()

SSLError: [Errno 185090050] _ssl.c:326: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
Contributor

ojacobson commented Jun 27, 2011

Looks like this may have been fixed in a recent httplib2 update, per http://code.google.com/p/httplib2/issues/detail?id=93. I'm going to leave this open, and re-test it in a week or so. If it's still broken, I'll lock httplib2 to a known-working version for refreshbooks 1.3.1 and possibly 1.4, then go back to "latest and greatest".

If you want to fix this yourself immediately, please downgrade httplib2 to version 0.5.0.

Contributor

ojacobson commented Jul 25, 2011

Fixed in 0388f38 and released as refreshbooks 1.3.1.

@ojacobson ojacobson closed this Jul 25, 2011

Contributor

ojacobson commented Jul 25, 2011

Make that 1.3.2 - 1.3.1 has been removed from PyPI (it contained unintended changes).

Contributor

rbdcti commented Jan 8, 2012

This appears to be fixed in the newest version of httplib2. Please see my pull request #10

ghost pushed a commit that referenced this issue Jan 9, 2012

Merge pull request #10 from rbdrbd/master
fix for closed issue #6 (httplib2 ssl fix) no longer necessary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment