{"action":"created","issue":{"url":"https://api.github.com/repos/gevent/gevent/issues/723","labels_url":"https://api.github.com/repos/gevent/gevent/issues/723/labels{/name}","comments_url":"https://api.github.com/repos/gevent/gevent/issues/723/comments","events_url":"https://api.github.com/repos/gevent/gevent/issues/723/events","html_url":"https://github.com/gevent/gevent/issues/723","id":128287630,"number":723,"title":"SSLSocket.recv sometimes returns str or bytes","user":{"login":"kchen","id":31767,"avatar_url":"https://avatars.githubusercontent.com/u/31767?v=3","gravatar_id":"","url":"https://api.github.com/users/kchen","html_url":"https://github.com/kchen","followers_url":"https://api.github.com/users/kchen/followers","following_url":"https://api.github.com/users/kchen/following{/other_user}","gists_url":"https://api.github.com/users/kchen/gists{/gist_id}","starred_url":"https://api.github.com/users/kchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kchen/subscriptions","organizations_url":"https://api.github.com/users/kchen/orgs","repos_url":"https://api.github.com/users/kchen/repos","events_url":"https://api.github.com/users/kchen/events{/privacy}","received_events_url":"https://api.github.com/users/kchen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-23T02:44:49Z","updated_at":"2016-01-23T02:51:22Z","closed_at":null,"body":"I'm having some trouble cleanly reproducing this, and may try more next week, but figured I'd submit this bug in case the problem is obvious:\r\n\r\nI'm running python 3.4 with gevent 1.1b6.  I have a class that inherits from WSGIServer that handles connections with:\r\n```python\r\n            while True:\r\n                try:\r\n                    data = sock.recv()\r\n                    log_info(\"data is %s, %s\" % (data, type(data)))\r\n                    log_info(\"sock is %s, %s\" % (sock, type(sock)))\r\n                    if data == \"\":\r\n                        log_info(\"Lost connection to %s\" % (queue.remote))\r\n                        break\r\n```\r\nMy log file shows:\r\n```\r\nSat Jan 23 02:15:58 2016 INFO: data is , <class 'str'>\r\nSat Jan 23 02:15:58 2016 INFO: sock is <gevent._ssl3.SSLSocket object, fd=43, family=2, type=2049, proto=0>, <class 'gevent._ssl3.SSLSocket'>\r\nSat Jan 23 02:18:13 2016 INFO: data is b'', <class 'bytes'>\r\nSat Jan 23 02:18:13 2016 INFO: sock is <gevent._ssl3.SSLSocket object, fd=25, family=2, type=2049, proto=0>, <class 'gevent._ssl3.SSLSocket'>\r\n```\r\n\r\nSSLSocket should presumably consistently return bytes, rather than sometimes str or bytes.  (I've fixed the code above to \"if not data\" instead.)"},"comment":{"url":"https://api.github.com/repos/gevent/gevent/issues/comments/174113327","html_url":"https://github.com/gevent/gevent/issues/723#issuecomment-174113327","issue_url":"https://api.github.com/repos/gevent/gevent/issues/723","id":174113327,"user":{"login":"jamadden","id":1256082,"avatar_url":"https://avatars.githubusercontent.com/u/1256082?v=3","gravatar_id":"","url":"https://api.github.com/users/jamadden","html_url":"https://github.com/jamadden","followers_url":"https://api.github.com/users/jamadden/followers","following_url":"https://api.github.com/users/jamadden/following{/other_user}","gists_url":"https://api.github.com/users/jamadden/gists{/gist_id}","starred_url":"https://api.github.com/users/jamadden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamadden/subscriptions","organizations_url":"https://api.github.com/users/jamadden/orgs","repos_url":"https://api.github.com/users/jamadden/repos","events_url":"https://api.github.com/users/jamadden/events{/privacy}","received_events_url":"https://api.github.com/users/jamadden/received_events","type":"User","site_admin":false},"created_at":"2016-01-23T02:51:22Z","updated_at":"2016-01-23T02:51:22Z","body":"Thanks. I believe this issue with empty strings was fixed in 1.1rc1(http://www.gevent.org/changelog.html#rc1-nov-14-2015)"}}