B
Bryan
i'm having some trouble this code which i hope someone can help me with. the
following client side code works correctly if the length of the message being
sent in the POST request is 16384 (1024 * 16) chars or less. if the length of
message is greater than 16384 an
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')
exception is raised. this is a port of code that exists in c++ and java
implementations where they are able to send messages with lengths of 100,000
bytes. all three implementations are using openssl 0.9.7d and are sharing the
exact same binary in a common area, so odds are openssl is not the problem. as
for python, i'm using python 2.4.2 and pyOpenSSL wrapper 0.6. is this a
limitation with httplib or pyopensll? i googled for this problem, but came up
empty handed.
import socket
import httplib
import SSL
def verify(conn, cert, err, width, ok):
return ok
header = {'Content-Type': 'text/foo', 'Connection': 'Keep-Alive'}
ctx = SSL.Context(SSL.SSLv3_METHOD)
ctx.set_verify(SSL.VERIFY_NONE, verify)
ctx.set_options(SSL.OP_ALL | SSL.OP_NO_SSLv2)
ctx.set_cipher_list('ALL:!aNULL:!eNULL:!LOW:!EXP:!MD5STRENGTH')
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssl = SSL.Connection(ctx, sock)
ssl.connect((host, port))
con = httplib.HTTPSConnection(host, port)
con.sock = httplib.FakeSocket(sock, ssl)
# raises exception if len(message) > 1024*16
con.request('POST', '/foo', message, header)
res = con.getresponse().read()
thanks,
bryan
following client side code works correctly if the length of the message being
sent in the POST request is 16384 (1024 * 16) chars or less. if the length of
message is greater than 16384 an
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')
exception is raised. this is a port of code that exists in c++ and java
implementations where they are able to send messages with lengths of 100,000
bytes. all three implementations are using openssl 0.9.7d and are sharing the
exact same binary in a common area, so odds are openssl is not the problem. as
for python, i'm using python 2.4.2 and pyOpenSSL wrapper 0.6. is this a
limitation with httplib or pyopensll? i googled for this problem, but came up
empty handed.
import socket
import httplib
import SSL
def verify(conn, cert, err, width, ok):
return ok
header = {'Content-Type': 'text/foo', 'Connection': 'Keep-Alive'}
ctx = SSL.Context(SSL.SSLv3_METHOD)
ctx.set_verify(SSL.VERIFY_NONE, verify)
ctx.set_options(SSL.OP_ALL | SSL.OP_NO_SSLv2)
ctx.set_cipher_list('ALL:!aNULL:!eNULL:!LOW:!EXP:!MD5STRENGTH')
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssl = SSL.Connection(ctx, sock)
ssl.connect((host, port))
con = httplib.HTTPSConnection(host, port)
con.sock = httplib.FakeSocket(sock, ssl)
# raises exception if len(message) > 1024*16
con.request('POST', '/foo', message, header)
res = con.getresponse().read()
thanks,
bryan