473,499 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can't send large messages over SSL socket

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:! MD5:@STRENGTH')

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

Mar 10 '06 #1
1 4292
Well the first thing to note is that the maximum record length in SSL
is exactly 16384. SSL/TLS does not preserve message boundaries - it is
up to the application to determine if there are multiple messages in a
single record, or a single message spanning multiple records. Sounds
like the particular wrapper function is not properly chunking the
message up into multiple records (or just does not support large
messages).

Mar 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
268
by: Kueishiong Tu | last post by:
How do I send and receive internet messages using socket in the .net Vc++ environment Coding samples will be very helpful?
1
7803
by: Steve | last post by:
Please take a look at the simple code segment below and advise me what is wrong. According to the help and examples I've seen it should work unless I misunderstand something. The problem is...
6
4837
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
0
1062
by: bertymaes | last post by:
Hi, I'm using VB in VS2005 on a WXP SP2 machine to build a windows service that listens to a port to accept messages. This solution works fine when a connecting client sends a message, waits for...
11
7673
by: hazz | last post by:
smtpClient.Send(message) is causing me problems as per specifics in the trace below. Email is sent but not without this error typically upon sending the second email, but sometimes when running...
3
4070
by: Valli | last post by:
Hi, I want to send ascii data over the tcp socket in VB.NET. When the data reaches the destination, the special characters in the messages are recived as '?'. I meant the special characters...
13
2702
by: Wade Yin | last post by:
Hi, If I can write a ActiveX component that can support socket communication in webpage, that will make browser have strongger capability to communicate with different clients, but not only can...
1
2722
by: danfolkes | last post by:
Hey Everyone, I am trying to send repeated messages from a "Node" to a "Server". It works the first time I send the from the Node to Server, but after that it either errors, or does not do...
7
4672
by: Anil | last post by:
I have a Javascript program which runs in the browser and has functions work(), and stop(). It listens to commands from the server to work() and can be interrupted by the server to stop(). I am...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.