Skip to content

Instantly share code, notes, and snippets.

@nickmbailey
Last active January 17, 2016 20:28
Show Gist options
  • Save nickmbailey/f80ad965a048c1d4df22 to your computer and use it in GitHub Desktop.
Save nickmbailey/f80ad965a048c1d4df22 to your computer and use it in GitHub Desktop.
import httplib
for i in range(20):
conn = httplib.HTTPSConnection("www.python.org")
conn.request("GET", "/")
r1 = conn.getresponse()
print r1.status, r1.reason
print i
@nickmbailey
Copy link
Author

Demonstrates a netty ssl bug when run through jython 2.7.1b2. If you download the jython standalone jar, you can run this script to see the bug (I've only seen it occur on ubuntu 14.04):

java -jar jython-standalone-2.7.1b2.jar netty-ssl-bug.py

@nickmbailey
Copy link
Author

An example run:

automaton@atestssl-c862026:~/ripcord/opscenterd$ java -jar jython-standalone-2.7.1b2.jar netty-ssl-bug.py
200 OK
0
200 OK
1
Traceback (most recent call last):
  File "netty-ssl-bug.py", line 4, in <module>
    conn.request("GET", "/")
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/httplib.py", line 1001, in request
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/httplib.py", line 1035, in _send_request
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/httplib.py", line 997, in endheaders
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/httplib.py", line 850, in _send_output
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/httplib.py", line 812, in send
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/httplib.py", line 1204, in connect
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/_socket.py", line 357, in handle_exception
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/_socket.py", line 357, in handle_exception
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/ssl.py", line 320, in wrap_socket
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/ssl.py", line 147, in __init__
  File "/home/automaton/ripcord/opscenterd/jython-standalone-2.7.1b2.jar/Lib/ssl.py", line 196, in do_handshake
_socket.SSLError: [Errno 1] Unmapped exception: java.lang.NullPointerException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment