Hello all,

     I am working on a man in the middle proxy and am almost finished with
it.  The particulars of this proxy are as follows:

*     Multi threading is enabled, and used
*     The write, and read operations are Non blocking, neither are the
underlying bios
*     The proxy pays attention to the error codes returned from SSL_read,
and SSL_write, and handles each one according to the man pages.  This
includes but is not limited to SSL_WANT_READ and SSL_WANT_WRITE

The issue that I am having is, as you probably guessed from the subject,
file uploading.  If run as is, the connection is reset by the proxy after
about 20K of whatever file was supposed to be transferred.  But if I add a
usleep(40000) (40 ms delay) after each SSL_read/write operation, then the
proxy both grabs all of the data presented, and writes all of the data that
it is supposed to.  I am really confused about how this small delay could
mean the difference between a 20K and 20 MB file uploading.  Is there some
error condition possibly that I am not handling, or some underlying write
buffer that needs to be cleared before I continue with operation of the
program that the sleep allows for the Kernel to clear on it's own?  I am
really at a loss for reason why this works.  I would prefer to know why, and
implement a more elegant solution to this problem than just letting it clean
itself up.  Any ideas, thoughts, or pointers would be much appreciated.  I
can provide more details if needed as well.  Thank you.


     -Sam


-- 
Sam Jantz
Software Engineer

Reply via email to